Main MRPT website > C++ reference for MRPT 1.5.7
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  {
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;
41  friend class HMTSLAM_IMPEXP CHMHMapArc;
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  */
67  void onArcDestruction(CHMHMapArc *arc);
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  */
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  */
117  unsigned int getLevelInTheHierarchy();
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
void getArcs(TArcList &out) const
Returns a list with the arcs from/to this node.
Definition: CHMHMapNode.h:125
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:39
std::map< CHMHMapNode::TNodeID, CHMHMapNodePtr > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:148
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
STL namespace.
mrpt::utils::safe_ptr< CHierarchicalMHMap > m_parent
The hierarchical graph in which this object is into.
Definition: CHMHMapNode.h:75
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...
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:105
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:62
class HMTSLAM_IMPEXP CHierarchicalMHMap
Definition: CHMHMapArc.h:20
std::pair< CHMHMapNode::TNodeID, CHMHMapNode::TNodeID > TPairNodeIDs
Definition: CHMHMapNode.h:151
uint64_t TNodeID
The type for node IDs in graphs of different types.
Definition: types_simple.h:45
GLsizei const GLchar ** string
Definition: glext.h:3919
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:150
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:29
THypothesisIDSet m_hypotheses
The hypothesis IDs under which this node exists.
Definition: CHMHMapNode.h:53
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
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:58
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:37
std::string m_label
The label of the node, only for display it to the user.
Definition: CHMHMapNode.h:113
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:64
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:49



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019