MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / ParseRecord

Method ParseRecord

lib/mdflib/mdflib/src/readcache.cpp:47–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47bool ReadCache::ParseRecord() {
48
49 if (dg4_block_ == nullptr || dg4_block_->Cg4().empty() ) {
50 return false;
51 }
52 if (data_count_ >= max_data_count_ || block_list_.empty()) {
53 return false;
54 }
55 bool continue_reading = true;
56 try {
57 const auto record_id = ParseRecordId();
58 const auto itr_group = available_cg_list_.size() == 1 ?
59 available_cg_list_.begin() : available_cg_list_.find(record_id);
60 const auto* channel_group = itr_group == available_cg_list_.cend() ?
61 nullptr : itr_group->second;
62 // const auto *channel_group = dg4_block_->FindCgRecordId(record_id);
63 if (channel_group == nullptr) {
64 throw std::runtime_error("No channel group found.");
65 }
66 if (channel_group->Flags() & CgFlag::VlsdChannel) {
67 // This is normally used for the string,
68 // and the CG block only includes one signal
69 std::vector<uint8_t> temp(4, 0);
70 GetArray(temp);
71 const LittleBuffer<uint32_t> length(temp, 0);
72
73 if (record_id_list_.find(record_id) == record_id_list_.cend()) {
74 SkipBytes(length.value());
75 const size_t sample = channel_group->Sample();
76 if (sample < channel_group->NofSamples()) {
77 channel_group->IncrementSample();
78 }
79 } else {
80 std::vector<uint8_t> record(length.value(), 0);
81 GetArray(record);
82 const size_t sample = channel_group->Sample();
83 if (sample < channel_group->NofSamples()) {
84 continue_reading = dg4_block_->NotifySampleObservers(sample,
85 channel_group->RecordId(), record);
86 channel_group->IncrementSample();
87 }
88 }
89
90 } else {
91 const size_t record_size = channel_group->NofDataBytes()
92 + channel_group->NofInvalidBytes();
93 // Normal fixed length records
94 if (record_id_list_.find(record_id) == record_id_list_.cend()) {
95 SkipBytes(record_size);
96 const size_t sample = channel_group->Sample();
97 if (sample < channel_group->NofSamples()) {
98 channel_group->IncrementSample();
99 }
100 } else {
101 std::vector<uint8_t> record(record_size, 0);
102 GetArray(record);
103 const size_t sample = channel_group->Sample();
104 if (sample < channel_group->NofSamples()) {

Callers 1

ReadDataMethod · 0.80

Calls 14

emptyMethod · 0.80
beginMethod · 0.80
findMethod · 0.80
cendMethod · 0.80
SampleMethod · 0.80
IncrementSampleMethod · 0.80
NotifySampleObserversMethod · 0.80
NofDataBytesMethod · 0.80
NofInvalidBytesMethod · 0.80
sizeMethod · 0.45
FlagsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected