47 }
while (m_parent->getNodeByID(m_ID));
54 CHMHMapNode::~CHMHMapNode()
57 if (m_parent.get()) m_parent->onNodeDestruction(
this);
60 for (
auto& m_arc : m_arcs) m_arc->onNodeDestruction(
this);
63 uint8_t CHMHMapNode::serializeGetVersion()
const {
return 0; }
66 out << m_ID << m_label;
72 void CHMHMapNode::serializeFrom(
79 in >> m_ID >> m_label >> m_nodeType >> m_annotations >>
104 auto it = m_arcs.find_ptr_to(arc);
105 if (it != m_arcs.end()) m_arcs.erase(it);
119 if (arc->m_nodeFrom == m_ID || arc->m_nodeTo == m_ID)
122 auto it = m_arcs.find(arc);
123 if (it == m_arcs.end()) m_arcs.push_back(arc);
135 unsigned int CHMHMapNode::getLevelInTheHierarchy()
137 TArcList::iterator itArc;
138 unsigned int level = 0;
140 for (itArc = m_arcs.begin(); itArc != m_arcs.end(); itArc++)
144 if ((*itArc)->m_arcType ==
"Membership" &&
145 (*itArc)->m_nodeTo == this->m_ID)
147 unsigned int L = m_parent->getNodeByID((*itArc)->m_nodeFrom)
148 ->getLevelInTheHierarchy();
149 level = max(L + 1, level);
159 unsigned int CHMHMapNode::getRelatedArcsCount()
161 return (
unsigned int)m_arcs.size();
170 for (
const auto& m_arc : m_arcs)
171 if (m_arc->m_hypotheses.has(hyp_id))
out.push_back(m_arc);
177 void CHMHMapNode::getArcs(
181 for (
const auto& a : m_arcs)
182 if (a->m_hypotheses.has(hyp_id) && a->m_arcType == arcType)
189 bool CHMHMapNode::isNeighbor(
192 for (
const auto& m_arc : m_arcs)
193 if (m_arc->m_hypotheses.has(hyp_id) &&
194 (m_arc->m_nodeFrom == otherArea || m_arc->m_nodeTo == otherArea))
mrpt::graphs::TNodeID TNodeID
The type of the IDs of nodes.
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
CHMHMapNode::TNodeID m_nodeTo
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CHMHMapNode::TNodeID m_nodeFrom
The origin/target nodes for this arc.
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps. ...
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model...
#define DEFAULT_NODE_TYPE
#define NODE_TYPES
Used in constructor of mrpt::hmtslam::CHMHMapNode.
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map...
A class for storing a sequence of arcs (a path).
A class for representing a node in a hierarchical, multi-hypothesis map.