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

Method ReadReference

lib/mdflib/mdflib/src/ca4block.cpp:624–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624CaTripleReference Ca4Block::ReadReference(size_t index) const {
625 CaTripleReference ref;
626 const auto* header = HeaderBlock();
627 if (header == nullptr) {
628 return ref;
629 }
630
631 const int64_t dg_position = Link(index);
632 const int64_t cg_position = Link(index + 1);
633 const int64_t cn_position = Link(index + 2);
634 if (dg_position > 0) {
635 try {
636 ref.DataGroup = dynamic_cast<const IDataGroup*>
637 (header->Find(dg_position));
638 } catch (const std::exception& ) {
639 ref.DataGroup = nullptr;
640 }
641 }
642
643 if (cg_position > 0) {
644 try {
645 ref.ChannelGroup = dynamic_cast<const IChannelGroup*>
646 (header->Find(cg_position));
647 } catch (const std::exception& ) {
648 ref.ChannelGroup = nullptr;
649 }
650 }
651
652 if (cn_position > 0) {
653 try {
654 ref.Channel = dynamic_cast<const IChannel*>
655 (header->Find(cn_position));
656 } catch (const std::exception& ) {
657 ref.Channel = nullptr;
658 }
659 }
660 return ref;
661}
662
663void Ca4Block::WriteReference(std::streambuf& buffer,
664 const CaTripleReference& ref, size_t start_index) {

Callers

nothing calls this directly

Calls 1

FindMethod · 0.45

Tested by

no test coverage detected