MRPT  1.9.9
CListOfClasses.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-2018, 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 #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 }
61 
A structure that holds runtime class type information.
Definition: CObject.h:30
GLdouble s
Definition: glext.h:3676
void insert(const mrpt::rtti::TRuntimeClassId *id)
Insert a class in the list.
std::set< const mrpt::rtti::TRuntimeClassId * > TSet
GLsizei const GLchar ** string
Definition: glext.h:4101
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...?
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3546
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 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020