Version 0.10.1: user_data is now a cv::Mat to avoid a deep copy when SensorData is copied

This commit is contained in:
matlabbe
2015-06-28 19:22:18 -04:00
parent 7d3a3317b7
commit 4f96fd3530
22 changed files with 516 additions and 640 deletions
+4 -4
View File
@@ -207,10 +207,10 @@ private:
{
double stamp = UTimer::now();
// Create user data [level, stamp] with the value (int = 4 bytes) and a timestamp (double = 8 bytes)
std::vector<unsigned char> data(sizeof(int) + sizeof(double));
memcpy(data.data(), &dBm, sizeof(int));
memcpy(data.data()+sizeof(int), &stamp, sizeof(double));
// Create user data [level, stamp] with the value and a timestamp
cv::Mat data(1, 2, CV_64FC1);
data.at<double>(0) = double(dBm);
data.at<double>(1) = stamp;
this->post(new UserDataEvent(data));
//UWARN("posting level %d dBm", dBm);
}