Main MRPT website > C++ reference
MRPT logo
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-2014, 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 
21 namespace mrpt
22 {
23  namespace hmtslam
24  {
25  using namespace mrpt::slam;
26 
29 
31 
32  /** A class for representing a node in a hierarchical, multi-hypothesis map.
33  * The node itself will be considered only if some given hypothesisID matchs its own ID.
34  * \note Create objects by invoking the class factory "::Create"
35  *
36  * \sa CHierarchicalMHMap,CHMHMapArc
37  * \ingroup mrpt_hmtslam_grp
38  */
40  {
42  friend class HMTSLAM_IMPEXP CHierarchicalMHMapPartition;
43  friend class HMTSLAM_IMPEXP CHMHMapArc;
44 
45  // This must be added to any CSerializable derived class:
47 
48  public:
49  /** The type of the IDs of nodes.
50  */
51  typedef mrpt::utils::TNodeID TNodeID;
52 
53  /** The hypothesis IDs under which this node exists.
54  */
55  THypothesisIDSet m_hypotheses;
56 
57  protected:
58  /** An unique identifier for the node: it is randomly generated at construction or read from stream when loaded.
59  */
60  TNodeID m_ID;
61 
62  /** The list of all arcs from/to this node:
63  */
64  TArcList m_arcs;
65 
66  /** Event handler for arc destruction: It should be only called for arcs from/to this node, altought other case must be handled without effects.
67  * \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.
68  */
69  void onArcDestruction(CHMHMapArc *arc);
70 
71  /** Event handler for arc addition: It should be only called for arcs from/to this node, altought other cases have no effects.
72  */
73  void onArcAddition(CHMHMapArcPtr &arc);
74 
75  /** The hierarchical graph in which this object is into.
76  */
78 
79  private:
80  /** Private constructor (see ::Create class factory)
81  */
83  CHierarchicalMHMap *parent = NULL,
84  const THypothesisIDSet &hyps = THypothesisIDSet() );
85 
86  public:
87  /** Class factory
88  */
89  static CHMHMapNodePtr Create(
90  CHierarchicalMHMap *parent = NULL,
91  const THypothesisIDSet &hyps = THypothesisIDSet() );
92 
93  /** Destructor
94  */
95  virtual ~CHMHMapNode();
96 
97  /** The annotations of the node, see the general description of the class for possible properties and values.
98  */
99  utils::CMHPropertiesValuesList m_annotations;
100 
101  /** The type of the node, the possibilities are:
102  * - Place
103  * - Area
104  * - TopologicalMap
105  * - Object
106  */
107  utils::CTypeSelector m_nodeType;
108 
109  /** Reads the ID of the node (read-only property)
110  */
111  TNodeID getID() const;
112 
113  /** The label of the node, only for display it to the user.
114  */
115  std::string m_label;
116 
117  /** Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.
118  */
119  unsigned int getLevelInTheHierarchy();
120 
121  /** Returns the number of arcs starting from/ending into this node.
122  */
123  unsigned int getRelatedArcsCount();
124 
125  /** Returns a list with the arcs from/to this node.
126  */
127  void getArcs( TArcList &out ) const
128  {
129  out = m_arcs;
130  }
131 
132  /** Returns a list with the arcs from/to this node existing in a given hypothesis ID.
133  */
134  void getArcs( TArcList &out, const THypothesisID &hyp_id ) const;
135 
136  /** Returns a list with the arcs from/to this node existing in a given hypothesis ID and of a given type.
137  */
138  void getArcs( TArcList &out, const char *arcType, const THypothesisID &hyp_id ) const;
139 
140  /** Check whether an arc exists towards the given area */
141  bool isNeighbor(const TNodeID &otherArea, const THypothesisID &hyp_id ) const;
142 
143  }; // End of class def.
145 
146 
147  /** A map between node IDs and nodes (used in HMT-SLAM).
148  * \sa CHMTSLAM
149  */
150  typedef std::map<CHMHMapNode::TNodeID,CHMHMapNodePtr> TNodeList;
152  typedef std::set<CHMHMapNode::TNodeID> TNodeIDSet;
153  typedef std::pair<CHMHMapNode::TNodeID,CHMHMapNode::TNodeID> TPairNodeIDs;
154 
155  } // End of namespace
156 } // End of namespace
157 
158 #endif
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
#define HMTSLAM_IMPEXP
This class implements a STL container with features of both, a std::set and a std::list.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:35
std::map< CHMHMapNode::TNodeID, CHMHMapNodePtr > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:150
uint64_t TNodeID
The type for node IDs in graphs of different types.
Definition: types_simple.h:39
STL namespace.
This namespace contains algorithms for SLAM, localization, map building, representation of robot's ac...
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
#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 set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps. ...
class HMTSLAM_IMPEXP CHierarchicalMHMap
Definition: CHMHMapArc.h:21
std::pair< TNodeID, TNodeID > TPairNodeIDs
A pair of node IDs.
Definition: types_simple.h:40
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:25
std::set< CHMHMapNode::TNodeID > TNodeIDSet
Definition: CHMHMapNode.h:152
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model...
class HMTSLAM_IMPEXP CHMHMapNode
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map...
Definition: CHMHMapArc.h:30
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
A class for storing a sequence of arcs (a path).
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:39
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:67
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:51



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014