MRPT  2.0.0
CListOfClasses.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 
11 #include <mrpt/rtti/CObject.h>
12 //#include <mrpt/system/string_utils.h>
13 #include <set>
14 
15 namespace mrpt::rtti
16 {
17 /** A list (actually based on a std::set) of MRPT classes, capable of keeping
18  * any class registered by the mechanism of CObject classes. Access to "data"
19  * for the actual content, or use any of the helper methods in this class.
20  * \ingroup mrpt_rtti_grp
21  */
23 {
24  public:
25  using TSet = std::set<const mrpt::rtti::TRuntimeClassId*>;
27 
28  /** Insert a class in the list. Example of usage:
29  * \code
30  * myList.insert(CLASS_ID(CObservationImage));
31  * \endcode
32  */
33  inline void insert(const mrpt::rtti::TRuntimeClassId* id)
34  {
35  data.insert(id);
36  }
37 
38  /** Does the list contains this class? */
39  inline bool contains(const mrpt::rtti::TRuntimeClassId* id) const
40  {
41  return data.find(id) != data.end();
42  }
43 
44  /** Does the list contains a class derived from...? */
46 
47  /** Return a string representation of the list, for example: "CPose2D,
48  * CObservation, CPose3D".
49  */
50  std::string toString() const;
51 
52  /** Builds from a string representation of the list, for example: "CPose2D,
53  * CObservation, CPose3D".
54  * \exception std::exception On unregistered class name found.
55  */
56  void fromString(const std::string& s);
57 
58 }; // end of class
59 
60 } // namespace mrpt::rtti
A structure that holds runtime class type information.
Definition: CObject.h:31
void insert(const mrpt::rtti::TRuntimeClassId *id)
Insert a class in the list.
std::set< const mrpt::rtti::TRuntimeClassId * > TSet
bool contains(const mrpt::rtti::TRuntimeClassId *id) const
Does the list contains this class?
bool containsDerivedFrom(const mrpt::rtti::TRuntimeClassId *id) const
Does the list contains a class derived from...?
void fromString(const std::string &s)
Builds from a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the...



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020