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

Method GetBlockProperty

lib/mdflib/mdflib/src/ca4block.cpp:151–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149namespace mdf::detail {
150
151void Ca4Block::GetBlockProperty(BlockPropertyList &dest) const {
152 MdfBlock::GetBlockProperty(dest);
153 // Set up all the link list
154 const auto nof_links = link_list_.size();
155 const auto nof_data_blocks = Storage() == ArrayStorage::DgTemplate ? cycle_count_list_.size() : 0;
156 const auto nof_dynamic_sizes = (Flags() & CaFlag::DynamicSize) != 0 ? 3 * dimensions_ : 0;
157 const auto nof_input_quantities = (Flags() & CaFlag::InputQuantity) != 0 ? 3 * dimensions_ : 0;
158 const auto nof_output_quantities = (Flags() & CaFlag::OutputQuantity) != 0 ? 3 * dimensions_ : 0;
159 const auto nof_comp_quantities = (Flags() & CaFlag::ComparisonQuantity) != 0 ? 3 : 0;
160 const auto nof_axis_conversions = (Flags() & CaFlag::Axis) != 0 ? dimensions_ : 0;
161 const auto nof_axis = ((Flags() & CaFlag::Axis) != 0 ) && ((Flags() & CaFlag::FixedAxis) == 0) ? 3 * dimensions_ : 0;
162
163 dest.emplace_back("Links", "", "", BlockItemType::HeaderItem);
164
165 size_t max_index;
166 const auto* hd_block = HeaderBlock(); // Need header block so the function Find() search from there.
167
168 for (size_t link_index = 0; link_index < nof_links && hd_block != nullptr; ++link_index) {
169 std::ostringstream desc;
170 const auto index = Link(link_index);
171 const auto* block = hd_block->Find(index);
172 const std::string comment = BlockDescription(block);
173
174 if (link_index == kIndexComposition) {
175 dest.emplace_back("Composition Block", ToHexString(index),
176 comment, BlockItemType::LinkItem);
177 continue;
178 }
179
180 // DATA LINKS
181 max_index = kIndexArray + nof_data_blocks;
182 if (link_index < max_index) {
183 dest.emplace_back("Data Block", ToHexString(index),
184 comment,
185 BlockItemType::LinkItem);
186 continue;
187 }
188
189 // DYNAMIC LINKS
190 max_index = kIndexArray + nof_data_blocks + nof_dynamic_sizes;
191 if (link_index < max_index) {
192 dest.emplace_back("Dynamic Size Block ", ToHexString(index),
193 comment, BlockItemType::LinkItem);
194 continue;
195 }
196
197 // INPUT QUANTITY
198 max_index = kIndexArray + nof_data_blocks + nof_dynamic_sizes + nof_input_quantities;
199 if (link_index < max_index) {
200 dest.emplace_back("InputQuantity Block ", ToHexString(index),
201 comment, BlockItemType::LinkItem);
202 continue;
203 }
204
205 // OUTPUT QUANTITY
206 max_index = kIndexArray + nof_data_blocks + nof_dynamic_sizes + nof_input_quantities
207 + nof_output_quantities;
208 if (link_index < max_index) {

Callers

nothing calls this directly

Calls 7

BlockDescriptionFunction · 0.85
ToHexStringFunction · 0.85
MakeStorageStringFunction · 0.85
MakeTypeStringFunction · 0.70
MakeFlagStringFunction · 0.70
sizeMethod · 0.45
FindMethod · 0.45

Tested by

no test coverage detected