Main MRPT website > C++ reference for MRPT 1.9.9
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-2017, 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 
13 #include <mrpt/obs/CSensoryFrame.h>
15 
19 #include <map>
20 
21 namespace mrpt
22 {
23 namespace hmtslam
24 {
25 class CHierarchicalMHMap;
26 class CHMHMapArc;
27 
28 /** A class for representing a node in a hierarchical, multi-hypothesis map.
29  * The node itself will be considered only if some given hypothesisID matchs
30  * its own ID.
31  * \note Create objects by invoking the class factory "::Create"
32  *
33  * \sa CHierarchicalMHMap,CHMHMapArc
34  * \ingroup mrpt_hmtslam_grp
35  */
37 {
38  friend class CHierarchicalMHMap;
40  friend class CHMHMapArc;
41 
43 
44  public:
45  /** The type of the IDs of nodes.
46  */
48 
49  /** The hypothesis IDs under which this node exists.
50  */
52 
53  protected:
54  /** An unique identifier for the node: it is randomly generated at
55  * construction or read from stream when loaded.
56  */
58 
59  /** The list of all arcs from/to this node:
60  */
62 
63  /** Event handler for arc destruction: It should be only called for arcs
64  * 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
66  * use the same smrt. pnt., but at destructors the objects don't know
67  * anything but "this", thus the usage of plain pointers.
68  */
69  void onArcDestruction(CHMHMapArc* arc);
70 
71  /** Event handler for arc addition: It should be only called for arcs
72  * from/to this node, although other cases have no effects.
73  */
74  void onArcAddition(const std::shared_ptr<CHMHMapArc>& arc);
75 
76  /** The hierarchical graph in which this object is into.
77  */
79 
80  public:
81  /** Constructor
82  */
84  CHierarchicalMHMap* parent = nullptr,
85  const THypothesisIDSet& hyps = THypothesisIDSet());
86 
87  /** Destructor
88  */
89  virtual ~CHMHMapNode();
90 
91  /** The annotations of the node, see the general description of the class
92  * for possible properties and values.
93  */
95 
96  /** The type of the node, the possibilities are:
97  * - Place
98  * - Area
99  * - TopologicalMap
100  * - Object
101  */
103 
104  /** Reads the ID of the node (read-only property)
105  */
106  TNodeID getID() const;
107 
108  /** The label of the node, only for display it to the user.
109  */
111 
112  /** Returns the level of this node in the hierarchy of arcs
113  * "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.
114  */
115  unsigned int getLevelInTheHierarchy();
116 
117  /** Returns the number of arcs starting from/ending into this node.
118  */
119  unsigned int getRelatedArcsCount();
120 
121  /** Returns a list with the arcs from/to this node.
122  */
123  void getArcs(TArcList& out) const { out = m_arcs; }
124  /** Returns a list with the arcs from/to this node existing in a given
125  * hypothesis ID.
126  */
127  void getArcs(TArcList& out, const THypothesisID& hyp_id) const;
128 
129  /** Returns a list with the arcs from/to this node existing in a given
130  * hypothesis ID and of a given type.
131  */
132  void getArcs(
133  TArcList& out, const char* arcType, const THypothesisID& hyp_id) const;
134 
135  /** Check whether an arc exists towards the given area */
136  bool isNeighbor(
137  const TNodeID& otherArea, const THypothesisID& hyp_id) const;
138 
139 }; // End of class def.
140 
141 /** A map between node IDs and nodes (used in HMT-SLAM).
142  * \sa CHMTSLAM
143  */
144 typedef std::map<CHMHMapNode::TNodeID, std::shared_ptr<CHMHMapNode>> TNodeList;
146 typedef std::set<CHMHMapNode::TNodeID> TNodeIDSet;
147 typedef std::pair<CHMHMapNode::TNodeID, CHMHMapNode::TNodeID> TPairNodeIDs;
148 
149 } // End of namespace
150 } // End of namespace
151 
152 #endif
void getArcs(TArcList &out) const
Returns a list with the arcs from/to this node.
Definition: CHMHMapNode.h:123
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:44
utils::CMHPropertiesValuesList m_annotations
The annotations of the node, see the general description of the class for possible properties and val...
Definition: CHMHMapNode.h:94
mrpt::utils::safe_ptr< CHierarchicalMHMap > m_parent
The hierarchical graph in which this object is into.
Definition: CHMHMapNode.h:78
void onArcAddition(const std::shared_ptr< CHMHMapArc > &arc)
Event handler for arc addition: It should be only called for arcs from/to this node, although other cases have no effects.
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
std::pair< CHMHMapNode::TNodeID, CHMHMapNode::TNodeID > TPairNodeIDs
Definition: CHMHMapNode.h:147
mrpt::utils::list_searchable< CHMHMapNode::TNodeID > TNodeIDList
Definition: CHMHMapNode.h:145
uint64_t TNodeID
The type for node IDs in graphs of different types.
utils::CTypeSelector m_nodeType
The type of the node, the possibilities are:
Definition: CHMHMapNode.h:102
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps. ...
TArcList m_arcs
The list of all arcs from/to this node:
Definition: CHMHMapNode.h:61
unsigned int getLevelInTheHierarchy()
Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the groun...
GLsizei const GLchar ** string
Definition: glext.h:4101
bool isNeighbor(const TNodeID &otherArea, const THypothesisID &hyp_id) const
Check whether an arc exists towards the given area.
virtual ~CHMHMapNode()
Destructor.
Definition: CHMHMapNode.cpp:53
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
This class represents a std::string derived class which is also CSerializable.
Definition: CTypeSelector.h:23
std::set< CHMHMapNode::TNodeID > TNodeIDSet
Definition: CHMHMapNode.h:146
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model...
TNodeID getID() const
Reads the ID of the node (read-only property)
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map...
Definition: CHMHMapArc.h:31
CHMHMapNode(CHierarchicalMHMap *parent=nullptr, const THypothesisIDSet &hyps=THypothesisIDSet())
Constructor.
Definition: CHMHMapNode.cpp:23
std::map< CHMHMapNode::TNodeID, std::shared_ptr< CHMHMapNode > > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:144
unsigned int getRelatedArcsCount()
Returns the number of arcs starting from/ending into this node.
friend class CHierarchicalMHMapPartition
Definition: CHMHMapNode.h:39
THypothesisIDSet m_hypotheses
The hypothesis IDs under which this node exists.
Definition: CHMHMapNode.h:51
A class for storing a sequence of arcs (a path).
TNodeID m_ID
An unique identifier for the node: it is randomly generated at construction or read from stream when ...
Definition: CHMHMapNode.h:57
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:36
std::string m_label
The label of the node, only for display it to the user.
Definition: CHMHMapNode.h:110
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:75
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:47
void onArcDestruction(CHMHMapArc *arc)
Event handler for arc destruction: It should be only called for arcs from/to this node...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019