add gesturepoint serialize support

This commit is contained in:
侯歌 2024-07-24 11:25:36 +08:00
parent 4dd7cd50b6
commit dbe9ae8d71
2 changed files with 6 additions and 5 deletions

View File

@ -186,9 +186,9 @@ void Gesture::serialize(std::ostream& out){
const int count = strokes.size();
// Write gesture ID
//out.writeLong(mGestureID);
GestureIOHelper::writeLong(out,mGestureID);
// Write number of strokes
//out.writeInt(count);
GestureIOHelper::writeInt(out,count);
for (int i = 0; i < count; i++) {
strokes.at(i)->serialize(out);

View File

@ -1,5 +1,6 @@
#ifndef __GESTURE_POINT_H__
#define __GESTURE_POINT_H__
#include <gesture/gesturestore.h>
namespace cdroid{
class GesturePoint {
public:
@ -14,10 +15,10 @@ public:
}
static GesturePoint deserialize(std::istream& in) {
// Read X and Y
const float x =1;// in.readFloat();
const float y =1;// in.readFloat();
const float x = GestureIOHelper::readFloat(in);
const float y = GestureIOHelper::readFloat(in);
// Read timestamp
const long timeStamp =1;// in.readLong();
const long timeStamp = GestureIOHelper::readLong(in);
return GesturePoint{x, y, timeStamp};
}
};