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-2017, 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 #ifndef CListOfClasses_H
10 #define CListOfClasses_H
11 
14 #include <set>
15 
16 namespace mrpt
17 {
18 namespace utils
19 {
20 /** A list (actually based on a std::set) of MRPT classes, capable of keeping
21  * any class registered by the mechanism of CSerializable classes.
22  * \ingroup mrpt_base_grp
23  */
25 {
26  private:
27  typedef std::set<const mrpt::utils::TRuntimeClassId*> TSet;
28 
30 
31  public:
34 
35  inline iterator begin() { return m_data.begin(); }
36  inline const_iterator begin() const { return m_data.begin(); }
37  inline iterator end() { return m_data.end(); }
38  inline const_iterator end() const { return m_data.end(); }
39  /** Insert a class in the list. Example of usage:
40  * \code
41  * myList.insert(CLASS_ID(CObservationImage));
42  * \endcode
43  */
44  inline void insert(const mrpt::utils::TRuntimeClassId* id)
45  {
46  m_data.insert(id);
47  }
48 
49  /** Does the list contains this class? */
50  inline bool contains(const mrpt::utils::TRuntimeClassId* id) const
51  {
52  return m_data.find(id) != m_data.end();
53  }
54 
55  /** Does the list contains a class derived from...? */
57 
58  /** Empty the list */
59  inline void clear() { m_data.clear(); }
60  /** Is the list empty? */
61  inline bool empty() const { return m_data.empty(); }
62  /** Return a string representation of the list, for example: "CPose2D,
63  * CObservation, CPose3D".
64  */
65  std::string toString() const;
66 
67  /** Return a string representation of the list, for example: "CPose2D,
68  * CObservation, CPose3D".
69  * \exception std::exception On unregistered class name found.
70  */
71  void fromString(const std::string& s);
72 
73 }; // end of class
74 
75 } // End of namespace
76 } // end of namespace
77 #endif
void insert(const mrpt::utils::TRuntimeClassId *id)
Insert a class in the list.
bool containsDerivedFrom(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains a class derived from...?
bool contains(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains this class?
Scalar * iterator
Definition: eigen_plugins.h:26
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
const Scalar * const_iterator
Definition: eigen_plugins.h:27
const_iterator begin() const
bool empty() const
Is the list empty?
void clear()
Empty the list.
GLdouble s
Definition: glext.h:3676
TSet::const_iterator const_iterator
const_iterator end() const
GLsizei const GLchar ** string
Definition: glext.h:4101
void fromString(const std::string &s)
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the...
std::set< const mrpt::utils::TRuntimeClassId * > TSet
A structure that holds runtime class type information.
Definition: CObject.h:31



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019