MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / decodeAsVarvalue

Function decodeAsVarvalue

pj_datastore/src/derived_engine.cpp:107–123  ·  view source on GitHub ↗

Decode one row of a chunk column into a VarValue, based on the column's StorageKind.

Source from the content-addressed store, hash-verified

105
106// Decode one row of a chunk column into a VarValue, based on the column's StorageKind.
107static VarValue decodeAsVarvalue(const TopicChunk& chunk, std::size_t col, std::size_t row, StorageKind kind) {
108 switch (kind) {
109 case StorageKind::kFloat32:
110 case StorageKind::kFloat64:
111 return chunk.readNumericAsDouble(col, row);
112 case StorageKind::kInt32:
113 case StorageKind::kInt64:
114 return chunk.readNumericAsInt64(col, row);
115 case StorageKind::kUint64:
116 return chunk.readNumericAsUint64(col, row);
117 case StorageKind::kBool:
118 return static_cast<int64_t>(chunk.readBool(col, row) ? 1 : 0);
119 case StorageKind::kString:
120 return std::string(chunk.readString(col, row));
121 }
122 return 0.0;
123}
124
125// Write a VarValue to a DataWriter row at (topic, col), coercing to out_kind.
126static void writeVarvalue(

Callers 2

runSisoIncrementalFunction · 0.85
runMimoIncrementalFunction · 0.85

Calls 5

readNumericAsDoubleMethod · 0.80
readNumericAsInt64Method · 0.80
readNumericAsUint64Method · 0.80
readBoolMethod · 0.45
readStringMethod · 0.45

Tested by

no test coverage detected