Main MRPT website > C++ reference for MRPT 1.4.0
CHMHMapNode.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef CHMHMapNode_H
10#define CHMHMapNode_H
11
15
19#include <map>
20
21namespace mrpt
22{
23 namespace hmtslam
24 {
27
29
30 /** A class for representing a node in a hierarchical, multi-hypothesis map.
31 * The node itself will be considered only if some given hypothesisID matchs its own ID.
32 * \note Create objects by invoking the class factory "::Create"
33 *
34 * \sa CHierarchicalMHMap,CHMHMapArc
35 * \ingroup mrpt_hmtslam_grp
36 */
37 class HMTSLAM_IMPEXP CHMHMapNode : public mrpt::utils::CSerializable
38 {
40 friend class HMTSLAM_IMPEXP CHierarchicalMHMapPartition;
42
43 // This must be added to any CSerializable derived class:
45
46 public:
47 /** The type of the IDs of nodes.
48 */
50
51 /** The hypothesis IDs under which this node exists.
52 */
54
55 protected:
56 /** An unique identifier for the node: it is randomly generated at construction or read from stream when loaded.
57 */
59
60 /** The list of all arcs from/to this node:
61 */
63
64 /** Event handler for arc destruction: It should be only called for arcs from/to this node, altought other case must be handled without effects.
65 * \note At *addition we use a smart pointer to assure all the implied guys use the same smrt. pnt., but at destructors the objects don't know anything but "this", thus the usage of plain pointers.
66 */
68
69 /** Event handler for arc addition: It should be only called for arcs from/to this node, altought other cases have no effects.
70 */
71 void onArcAddition(CHMHMapArcPtr &arc);
72
73 /** The hierarchical graph in which this object is into.
74 */
76
77 private:
78 /** Private constructor (see ::Create class factory)
79 */
81 CHierarchicalMHMap *parent = NULL,
82 const THypothesisIDSet &hyps = THypothesisIDSet() );
83
84 public:
85 /** Class factory
86 */
87 static CHMHMapNodePtr Create(
88 CHierarchicalMHMap *parent = NULL,
89 const THypothesisIDSet &hyps = THypothesisIDSet() );
90
91 /** Destructor
92 */
93 virtual ~CHMHMapNode();
94
95 /** The annotations of the node, see the general description of the class for possible properties and values.
96 */
98
99 /** The type of the node, the possibilities are:
100 * - Place
101 * - Area
102 * - TopologicalMap
103 * - Object
104 */
106
107 /** Reads the ID of the node (read-only property)
108 */
109 TNodeID getID() const;
110
111 /** The label of the node, only for display it to the user.
112 */
113 std::string m_label;
114
115 /** Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.
116 */
118
119 /** Returns the number of arcs starting from/ending into this node.
120 */
121 unsigned int getRelatedArcsCount();
122
123 /** Returns a list with the arcs from/to this node.
124 */
125 void getArcs( TArcList &out ) const
126 {
127 out = m_arcs;
128 }
129
130 /** Returns a list with the arcs from/to this node existing in a given hypothesis ID.
131 */
132 void getArcs( TArcList &out, const THypothesisID &hyp_id ) const;
133
134 /** Returns a list with the arcs from/to this node existing in a given hypothesis ID and of a given type.
135 */
136 void getArcs( TArcList &out, const char *arcType, const THypothesisID &hyp_id ) const;
137
138 /** Check whether an arc exists towards the given area */
139 bool isNeighbor(const TNodeID &otherArea, const THypothesisID &hyp_id ) const;
140
141 }; // End of class def.
143
144
145 /** A map between node IDs and nodes (used in HMT-SLAM).
146 * \sa CHMTSLAM
147 */
148 typedef std::map<CHMHMapNode::TNodeID,CHMHMapNodePtr> TNodeList;
149 typedef mrpt::utils::list_searchable<CHMHMapNode::TNodeID> TNodeIDList;
152
153 } // End of namespace
154} // End of namespace
155
156#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map.
Definition: CHMHMapArc.h:30
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:38
void getArcs(TArcList &out) const
Returns a list with the arcs from/to this node.
Definition: CHMHMapNode.h:125
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:49
void getArcs(TArcList &out, const THypothesisID &hyp_id) const
Returns a list with the arcs from/to this node existing in a given hypothesis ID.
TNodeID getID() const
Reads the ID of the node (read-only property)
unsigned int getLevelInTheHierarchy()
Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the groun...
std::string m_label
The label of the node, only for display it to the user.
Definition: CHMHMapNode.h:113
static CHMHMapNodePtr Create(CHierarchicalMHMap *parent=NULL, const THypothesisIDSet &hyps=THypothesisIDSet())
Class factory.
void onArcDestruction(CHMHMapArc *arc)
Event handler for arc destruction: It should be only called for arcs from/to this node,...
void getArcs(TArcList &out, const char *arcType, const THypothesisID &hyp_id) const
Returns a list with the arcs from/to this node existing in a given hypothesis ID and of a given type.
void onArcAddition(CHMHMapArcPtr &arc)
Event handler for arc addition: It should be only called for arcs from/to this node,...
virtual ~CHMHMapNode()
Destructor.
CHMHMapNode(CHierarchicalMHMap *parent=NULL, const THypothesisIDSet &hyps=THypothesisIDSet())
Private constructor (see ::Create class factory)
TNodeID m_ID
An unique identifier for the node: it is randomly generated at construction or read from stream when ...
Definition: CHMHMapNode.h:58
TArcList m_arcs
The list of all arcs from/to this node:
Definition: CHMHMapNode.h:62
mrpt::utils::safe_ptr< CHierarchicalMHMap > m_parent
The hierarchical graph in which this object is into.
Definition: CHMHMapNode.h:75
utils::CTypeSelector m_nodeType
The type of the node, the possibilities are:
Definition: CHMHMapNode.h:105
unsigned int getRelatedArcsCount()
Returns the number of arcs starting from/ending into this node.
THypothesisIDSet m_hypotheses
The hypothesis IDs under which this node exists.
Definition: CHMHMapNode.h:53
utils::CMHPropertiesValuesList m_annotations
The annotations of the node, see the general description of the class for possible properties and val...
Definition: CHMHMapNode.h:97
bool isNeighbor(const TNodeID &otherArea, const THypothesisID &hyp_id) const
Check whether an arc exists towards the given area.
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model.
A class for storing a sequence of arcs (a path).
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps.
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:40
This class represents a std::string derived class which is also CSerializable.
Definition: CTypeSelector.h:26
uint64_t TNodeID
The type for node IDs in graphs of different types.
Definition: types_simple.h:45
#define HMTSLAM_IMPEXP
class HMTSLAM_IMPEXP CHierarchicalMHMap
Definition: CHMHMapArc.h:20
std::map< CHMHMapNode::TNodeID, CHMHMapNodePtr > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:148
std::pair< CHMHMapNode::TNodeID, CHMHMapNode::TNodeID > TPairNodeIDs
Definition: CHMHMapNode.h:151
std::set< CHMHMapNode::TNodeID > TNodeIDSet
Definition: CHMHMapNode.h:150
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:65



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:21:41 UTC 2021