MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / manageTopicLink

Method manageTopicLink

tools/monitor/MonitorDataStorage.cpp:581–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581void
582Monitor::MonitorDataStorage::manageTopicLink(
583 TreeNode* node,
584 const OpenDDS::DCPS::GUID_t& dp_id,
585 const OpenDDS::DCPS::GUID_t& topic_id,
586 bool& create
587)
588{
589 // This gets a bit tedious. Here are the cases:
590 // 1) We currently have no reference, and found a Topic node to
591 // reference:
592 // - attach a reference to the topic node;
593 // 2) We currently have no reference, and found a Name node to
594 // reference:
595 // - attach a reference to the name node;
596 // 3) We currently have a Topic node referenced, and found the same
597 // topic node to reference:
598 // - nothing to do;
599 // 4) We currently have a Topic node referenced, and found a different
600 // Topic node to reference:
601 // - detach previous reference and reattach to new topic node;
602 // 5) We currently have a Topic node referenced, but were able to find
603 // a name node to reference:
604 // - detach previous reference and reattach to new name node;
605 // 6) We currently have a Name node referenced, and found the same name
606 // node to reference:
607 // - nothing to do;
608 // 7) We currently have a Name node referenced, and found a different
609 // name node to reference:
610 // - detach previous reference and reattach to new name node;
611 // 8) We currently have a Name node referenced, and found a different
612 // Topic node to reference:
613 // - detach previous reference and reattach to new topic node.
614 //
615 // Note that cases (4), (7), and (8) indicate inconsistent data reports
616 // and are error conditions. We chose to not handle these cases.
617 // Cases (3) and (6) require no action, so the only code paths we need
618 // to consider are for cases (1), (2), and (5).
619
620 // Find the actual topic.
621 TreeNode* topicNode = this->getNode(
622 std::string( "Topic"),
623 dp_id,
624 topic_id,
625 create
626 );
627 if( !topicNode) {
628 return;
629 }
630
631 // Find the topic name to reference instead of the GUID value.
632 TreeNode* nameNode = 0;
633 QString nameLabel( QObject::tr( "Topic Name"));
634 int row = topicNode->indexOf( 0, nameLabel);
635 if( row != -1) {
636 nameNode = (*topicNode)[ row];
637 }
638

Callers

nothing calls this directly

Calls 7

getNodeMethod · 0.95
indexOfMethod · 0.80
valueSourceMethod · 0.80
removeValueRefMethod · 0.80
setColorMethod · 0.80
addValueRefMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected