Session test
This commit is contained in:
@@ -41,12 +41,12 @@ public:
|
||||
{
|
||||
const uint32_t lastIdx = currentChunk->getStartIndex() + currentChunk->numMeasurements();
|
||||
if( lastIdx <= startIdx) {
|
||||
encoder.sendArray(nullptr, 0);
|
||||
encoder.template sendArray<Measurement_T>(nullptr, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Chunk_T::sendHeader(encoder, currentChunk->getStartTime(), startIdx);
|
||||
encoder.sendArrayHeader(lastIdx - startIdx);
|
||||
encoder.template sendArrayHeader<Measurement_T>(lastIdx - startIdx);
|
||||
while(startIdx < lastIdx)
|
||||
startIdx = serializeChunk(encoder, startIdx);
|
||||
assert(startIdx == lastIdx, "Not all data was sent");
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
};
|
||||
|
||||
template< typename T>
|
||||
uint32_t serializeChunk(StreamingMsgPackEncoder<T> & encoder, uint32_t startIdx) {
|
||||
uint32_t serializeChunk(StreamingMsgPackEncoder<T> & encoder, uint32_t startIdx) const {
|
||||
assert( startIdx < currentChunk->getStartIndex() + currentChunk->numMeasurements(),
|
||||
"serializeChunk: invalid startIdx" );
|
||||
|
||||
@@ -92,12 +92,12 @@ private:
|
||||
return otherChunk->getStartIndex() + otherChunk->numMeasurements();
|
||||
} else {
|
||||
if( encoder.getSizeCountMode() ) {
|
||||
encoder.sendArrayPartialContents(nullptr, CHUNK_SIZE);
|
||||
encoder.template sendArrayPartialContents<Measurement_T>(nullptr, CHUNK_SIZE);
|
||||
} else {
|
||||
const uint32_t chunkNr = startIdx / CHUNK_SIZE;
|
||||
const auto chunkFileName = (chunkNr, currentChunk->getStartTime());
|
||||
Reader reader(chunkFileName);
|
||||
reader.seek(Chunk_T::valueOffset());
|
||||
const auto chunkFileNameStr = chunkFileName(chunkNr, currentChunk->getStartTime());
|
||||
Reader reader(chunkFileNameStr);
|
||||
reader.seek(Chunk_T::template valueOffset<T>());
|
||||
|
||||
const uint32_t PART_SIZE = 32;
|
||||
static_assert( PART_SIZE < CHUNK_SIZE && CHUNK_SIZE % PART_SIZE == 0);
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
for(uint32_t i = 0; i < CHUNK_SIZE; i += PART_SIZE)
|
||||
{
|
||||
reader.readBytes((char*) buffer, sizeof(Measurement_T) * PART_SIZE);
|
||||
encoder.sendArrayPartialContents(buffer, PART_SIZE);
|
||||
encoder.template sendArrayPartialContents<Measurement_T>(buffer, PART_SIZE);
|
||||
}
|
||||
}
|
||||
return startIdx + CHUNK_SIZE;
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
StreamingMsgPackEncoder<T> encoder(nullptr);
|
||||
encoder.setSizeCountMode(true);
|
||||
sendHeader(encoder, 0, 0);
|
||||
encoder.template sendArrayHeader<Measurement_T>(0);
|
||||
return encoder.getContentLength();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user