Main MRPT website > C++ reference for 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
16 {
17 namespace rtti
18 {
19 /** A list (actually based on a std::set) of MRPT classes, capable of keeping
20  * any class registered by the mechanism of CObject classes. Access to "data"
21  * for the actual content, or use any of the helper methods in this class.
22  * \ingroup mrpt_rtti_grp
23  */
25 {
26  public:
27  using TSet = std::set<const mrpt::rtti::TRuntimeClassId*>;
29 
30  /** Insert a class in the list. Example of usage:
31  * \code
32  * myList.insert(CLASS_ID(CObservationImage));
33  * \endcode
34  */
35  inline void insert(const mrpt::rtti::TRuntimeClassId* id)
36  {
37  data.insert(id);
38  }
39 
40  /** Does the list contains this class? */
41  inline bool contains(const mrpt::rtti::TRuntimeClassId* id) const
42  {
43  return data.find(id) != data.end();
44  }
45 
46  /** Does the list contains a class derived from...? */
48 
49  /** Return a string representation of the list, for example: "CPose2D,
50  * CObservation, CPose3D".
51  */
52  std::string toString() const;
53 
54  /** Builds from a string representation of the list, for example: "CPose2D,
55  * CObservation, CPose3D".
56  * \exception std::exception On unregistered class name found.
57  */
58  void fromString(const std::string& s);
59 
60 }; // end of class
61 
62 } // namespace rtti
63 } // namespace mrpt
CObject.h
mrpt::rtti::CListOfClasses::contains
bool contains(const mrpt::rtti::TRuntimeClassId *id) const
Does the list contains this class?
Definition: CListOfClasses.h:41
mrpt::rtti::TRuntimeClassId
A structure that holds runtime class type information.
Definition: CObject.h:30
s
GLdouble s
Definition: glext.h:3676
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::rtti::CListOfClasses::TSet
std::set< const mrpt::rtti::TRuntimeClassId * > TSet
Definition: CListOfClasses.h:27
mrpt::rtti::CListOfClasses::insert
void insert(const mrpt::rtti::TRuntimeClassId *id)
Insert a class in the list.
Definition: CListOfClasses.h:35
mrpt::rtti::CListOfClasses::toString
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
Definition: CListOfClasses.cpp:28
data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3547
mrpt::rtti::CListOfClasses::fromString
void fromString(const std::string &s)
Builds from a string representation of the list, for example: "CPose2D, CObservation,...
Definition: CListOfClasses.cpp:62
mrpt::rtti::CListOfClasses
A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the...
Definition: CListOfClasses.h:24
mrpt::rtti::CListOfClasses::data
TSet data
Definition: CListOfClasses.h:28
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::rtti::CListOfClasses::containsDerivedFrom
bool containsDerivedFrom(const mrpt::rtti::TRuntimeClassId *id) const
Does the list contains a class derived from...?
Definition: CListOfClasses.cpp:20



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST