Main MRPT website > C++ reference for MRPT 1.9.9
TMRSlamNodeAnnotations.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 TMRSLAMNODEANNOTATIONS_H
10 #define TMRSLAMNODEANNOTATIONS_H
11 
14 #include <sstream>
15 #include <string>
16 
17 namespace mrpt
18 {
19 namespace graphs
20 {
21 namespace detail
22 {
23 /**\brief Struct to be used as the NODE_ANNOTATIONS template argument in
24  * CNetworkOfPoses class instances for use in multiple-robot SLAM applications
25  *
26  * \ingroup mrpt_graphs_grp
27  */
29 {
32 
35  : parent_t(other)
36  {
37  this->setAnnots(other);
38  }
39 
41  {
42  self_t* annots = new self_t(*this);
43  return annots;
44  }
45  bool setAnnots(const parent_t& other)
46  {
47  parent_t::setAnnots(other);
48 
49  bool res;
50  const self_t* mr_slam_annots = dynamic_cast<const self_t*>(&other);
51  if (mr_slam_annots)
52  {
53  this->agent_ID_str = mr_slam_annots->agent_ID_str;
54  this->nodeID_loc = mr_slam_annots->nodeID_loc;
55  res = true;
56  }
57  else
58  {
59  res = false;
60  }
61 
62  return res;
63  }
64 
65  bool operator==(const TNodeAnnotations& other) const
66  {
67  const TMRSlamNodeAnnotations* mr_slam_annots =
68  dynamic_cast<const TMRSlamNodeAnnotations*>(&other);
69 
70  bool res = false;
71  if (mr_slam_annots)
72  {
73  res =
74  (this->agent_ID_str == mr_slam_annots->agent_ID_str &&
75  this->nodeID_loc == mr_slam_annots->nodeID_loc);
76  }
77 
78  return res;
79  }
80 
82  {
84 
85  std::stringstream ss;
86  ss << "agent_ID_str: " << agent_ID_str << "| "
87  << "nodeID_loc: " << nodeID_loc;
88 
89  s->clear();
90  *s = ss.str();
91  }
92 
93  /**\brief string identifier of the SLAM Agent that initially registered this
94  * node. */
96  /**\brief ID of node in the graph of the SLAM Agent that initially
97  * registered
98  * this node.
99  *
100  * \note Field is handy especially in cases where one SLAM agent
101  * communicates
102  * its local graph to another agent and we still want to keep track of the
103  * node ID in the former's graph.
104  */
106 };
107 }
108 }
109 } // end of namespaces
110 
111 // declare as ttypename - in mrpt::utils namespace
112 namespace mrpt
113 {
114 namespace utils
115 {
117 }
118 } // end of namespaces
119 
120 #endif /* end of include guard: TMRSLAMNODEANNOTATIONS_H */
#define MRPT_DECLARE_TTYPENAME(_TYPE)
Definition: TTypeName.h:72
GLuint res
Definition: glext.h:7268
GLdouble s
Definition: glext.h:3676
GLsizei const GLchar ** string
Definition: glext.h:4101
uint64_t TNodeID
The type for node IDs in graphs of different types.
Definition: types_simple.h:49
#define INVALID_NODEID
Definition: types_simple.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Struct to be used as the NODE_ANNOTATIONS template argument in CNetworkOfPoses class instances for us...
std::string agent_ID_str
string identifier of the SLAM Agent that initially registered this node.
TMRSlamNodeAnnotations(const TMRSlamNodeAnnotations &other)
mrpt::utils::TNodeID nodeID_loc
ID of node in the graph of the SLAM Agent that initially registered this node.
bool operator==(const TNodeAnnotations &other) const
Abstract class from which NodeAnnotations related classes can be implemented.
bool setAnnots(const self_t &other)
Set the properties of the current TNodeAnnotations object.
virtual void getAnnotsAsString(std::string *s) const



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 63ea9d1f1 Thu Nov 23 00:06:53 2017 +0100 at mar 26 may 2026 12:19:29 CEST