MRPT  2.0.4
TNodeProps.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 
13 #include <string>
14 
16 {
17 template <class GRAPH_T>
18 struct TNodeProps
19 {
20  typename GRAPH_T::global_pose_t pose;
22 
23  TNodeProps() = default;
24  TNodeProps(const TNodeProps& o) { *this = o; }
25 
27  {
28  this->pose = other.pose;
29  this->scan = other.scan;
30  return *this;
31  }
32 
33  void getAsString(std::string* str) const
34  {
35  ASSERTDEB_(str);
36  str->clear();
37  *str += mrpt::format("Pose: %s|\t", this->pose.asString().c_str());
38  if (this->scan)
39  {
40  *str += mrpt::format("Scan #%lu", this->scan->getScanSize());
41  }
42  else
43  {
44  *str += "Scan: NONE";
45  }
46  *str += "\n";
47  }
48  std::string getAsString() const
49  {
50  std::string str;
51  this->getAsString(&str);
52  return str;
53  }
54 
55  friend std::ostream& operator<<(std::ostream& o, const TNodeProps& obj)
56  {
57  o << obj.getAsString() << std::endl;
58  return o;
59  }
60 };
61 } // namespace mrpt::graphslam::detail
mrpt::obs::CObservation2DRangeScan::Ptr scan
Definition: TNodeProps.h:21
GRAPH_T::global_pose_t pose
Definition: TNodeProps.h:20
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
TNodeProps(const TNodeProps &o)
Definition: TNodeProps.h:24
void getAsString(std::string *str) const
Definition: TNodeProps.h:33
friend std::ostream & operator<<(std::ostream &o, const TNodeProps &obj)
Definition: TNodeProps.h:55
std::string getAsString() const
Definition: TNodeProps.h:48
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: exceptions.h:190
TNodeProps operator=(const TNodeProps &other)
Definition: TNodeProps.h:26
Internal auxiliary classes.
Definition: levmarq_impl.h:19



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020