13 #include <QDataStream>
33 if (dataVersion < 44) {
38 QDataStream outStream(&out);
56 QDataStream inStream(&in);
58 if (dataVersion < 44)
return false;
75 m_descriptorID(descriptorID),
85 const uint8_t* dataStorage)
const {
91 const uint8_t* _data =
data(dataStorage);
97 return reinterpret_cast<const uint16_t*
>(_data)[i];
100 uint32_t v = *
reinterpret_cast<const uint32_t*
>(_data + 3 * i);
102 static const uint32_t Byte4Mask = 0x0FFF;
108 return reinterpret_cast<const uint32_t*
>(_data)[i];
113 uint32_t firstByteIndex = (firstBitIndex >> 3);
115 uint32_t lastBitIndex =
117 uint32_t lastByteIndex = (lastBitIndex >> 3);
124 uint32_t value = _data[lastByteIndex];
127 uint32_t r = ((lastByteIndex + 1) % 8);
130 value &= ((1 << r) - 1);
135 while (lastByteIndex != firstByteIndex) {
138 value |= _data[lastByteIndex];
143 uint32_t r = firstBitIndex - 8 * firstByteIndex;
160 const uint8_t* dataStorage)
const {
161 uint32_t raw =
getRawSample(i, descriptor, dataStorage);
168 const uint8_t* dataStorage)
const {
172 values[i] =
getSample(i, descriptor, dataStorage);
174 }
catch (
const std::bad_alloc&) {
184 const uint8_t* dataStorage)
const {
190 std::vector<double> values;
192 CVLog::Warning(QString(
"[ccWaveform::toASCII] Not enough memory"));
200 std::vector<double>& values,
201 uint32_t samplingRate_ps) {
203 if (!file.open(QFile::Text | QFile::WriteOnly)) {
204 CVLog::Warning(QString(
"[ccWaveform::toASCII] Failed to open file '%1' "
210 QTextStream stream(&file);
211 stream.setRealNumberPrecision(6);
212 stream.setRealNumberNotation(QTextStream::FixedNotation);
215 for (uint32_t i = 0; i < values.size(); ++i) {
216 stream << i * samplingRate_ps <<
";" << values[i] <<
QtCompat::endl;
220 CVLog::Print(QString(
"[ccWaveform::toASCII] File '%1' has been saved "
230 const uint8_t* dataStorage)
const {
233 minVal = maxVal = std::numeric_limits<double>::quiet_NaN();
236 minVal = maxVal =
getSample(0, descriptor, dataStorage);
240 double c =
getSample(i, descriptor, dataStorage);
241 maxVal = std::max(maxVal, c);
242 minVal = std::min(minVal, c);
245 return maxVal - minVal;
264 if (dataVersion < 46) {
269 QDataStream outStream(&out);
276 outStream << static_cast<quint64>(
283 if (dataVersion >= 47) {
300 QDataStream inStream(&in);
302 if (dataVersion < 46)
return false;
320 if (dataVersion > 46) {
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Print(const char *format,...)
Prints out a formatted message in console.
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
void applyRotation(Vector3Tpl< float > &vec) const
Applies rotation only to a 3D vector (in place) - float version.
Float version of ccGLMatrixTpl.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
QTextStream & endl(QTextStream &stream)