Main MRPT website > C++ reference for MRPT 1.5.7
TMRSlamNodeAnnotations.h
Go to the documentation of this file.
1 #ifndef TMRSLAMNODEANNOTATIONS_H
2 #define TMRSLAMNODEANNOTATIONS_H
3 
6 #include <sstream>
7 #include <string>
8 
9 namespace mrpt { namespace graphs { namespace detail {
10 
11 /**\brief Struct to be used as the NODE_ANNOTATIONS template argument in
12  * CNetworkOfPoses class instances for use in multiple-robot SLAM applications
13  *
14  * \ingroup mrpt_graphs_grp
15  */
19 
20 
22  agent_ID_str(""),
24 
26  parent_t(other)
27  {
28  this->setAnnots(other);
29  }
30 
32  self_t* annots = new self_t(*this);
33  return annots;
34  }
35  bool setAnnots(const parent_t& other) {
36  parent_t::setAnnots(other);
37 
38  bool res;
39  const self_t* mr_slam_annots = dynamic_cast<const self_t*>(&other);
40  if (mr_slam_annots) {
41  this->agent_ID_str = mr_slam_annots->agent_ID_str;
42  this->nodeID_loc = mr_slam_annots->nodeID_loc;
43  res = true;
44  }
45  else {
46  res = false;
47  }
48 
49  return res;
50  }
51 
52  bool operator==(const TNodeAnnotations& other) const {
53  const TMRSlamNodeAnnotations* mr_slam_annots =
54  dynamic_cast<const TMRSlamNodeAnnotations*>(&other);
55 
56  bool res = false;
57  if (mr_slam_annots) {
58  res = (
59  this->agent_ID_str == mr_slam_annots->agent_ID_str &&
60  this->nodeID_loc == mr_slam_annots->nodeID_loc);
61  }
62 
63  return res;
64  }
65 
68 
69  std::stringstream ss;
70  ss << "agent_ID_str: " << agent_ID_str << "| "
71  << "nodeID_loc: " << nodeID_loc;
72 
73  s->clear();
74  *s = ss.str();
75  }
76 
77  /**\brief string identifier of the SLAM Agent that initially registered this node. */
79  /**\brief ID of node in the graph of the SLAM Agent that initially registered
80  * this node.
81  *
82  * \note Field is handy especially in cases where one SLAM agent communicates
83  * its local graph to another agent and we still want to keep track of the
84  * node ID in the former's graph.
85  */
87 
88 
89 };
90 
91 } } } // end of namespaces
92 
93 // declare as ttypename - in mrpt::utils namespace
94 namespace mrpt { namespace utils {
95 
97 
98 } } // end of namespaces
99 
100 #endif /* end of include guard: TMRSLAMNODEANNOTATIONS_H */
Abstract class from which NodeAnnotations related classes can be implemented.
#define INVALID_NODEID
GLdouble s
Definition: glext.h:3602
bool operator==(const TNodeAnnotations &other) const
uint64_t TNodeID
The type for node IDs in graphs of different types.
GLsizei const GLchar ** string
Definition: glext.h:3919
bool setAnnots(const self_t &other)
Set the properties of the current TNodeAnnotations object.
mrpt::utils::TNodeID nodeID_loc
ID of node in the graph of the SLAM Agent that initially registered this node.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TMRSlamNodeAnnotations(const TMRSlamNodeAnnotations &other)
std::string agent_ID_str
string identifier of the SLAM Agent that initially registered this node.
virtual void getAnnotsAsString(std::string *s) const
GLuint res
Definition: glext.h:6298
Struct to be used as the NODE_ANNOTATIONS template argument in CNetworkOfPoses class instances for us...
#define MRPT_DECLARE_TTYPENAME(_TYPE)
Definition: TTypeName.h:60



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019