Main MRPT website > C++ reference for MRPT 1.5.7
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 any class registered by the mechanism of CSerializable classes.
21  * \ingroup mrpt_base_grp
22  */
24  {
25  private:
26  typedef std::set<const mrpt::utils::TRuntimeClassId*> TSet;
27 
29 
30  public:
33 
34  inline iterator begin() {return m_data.begin(); }
35  inline const_iterator begin() const {return m_data.begin(); }
36 
37  inline iterator end() {return m_data.end(); }
38  inline const_iterator end() const {return m_data.end(); }
39 
40  /** Insert a class in the list. Example of usage:
41  * \code
42  * myList.insert(CLASS_ID(CObservationImage));
43  * \endcode
44  */
45  inline void insert( const mrpt::utils::TRuntimeClassId* id ) { m_data.insert(id); }
46 
47  /** Does the list contains this class? */
48  inline bool contains( const mrpt::utils::TRuntimeClassId* id ) const { return m_data.find(id)!=m_data.end(); }
49 
50  /** Does the list contains a class derived from...? */
51  bool containsDerivedFrom( const mrpt::utils::TRuntimeClassId* id ) const;
52 
53  /** Empty the list */
54  inline void clear() { m_data.clear(); }
55 
56  /** Is the list empty? */
57  inline bool empty() const { return m_data.empty(); }
58 
59  /** Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
60  */
61  std::string toString() const;
62 
63  /** Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
64  * \exception std::exception On unregistered class name found.
65  */
66  void fromString(const std::string &s);
67 
68  }; // end of class
69 
70  } // End of namespace
71 } // end of namespace
72 #endif
void insert(const mrpt::utils::TRuntimeClassId *id)
Insert a class in the list.
bool contains(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains this class?
Scalar * iterator
Definition: eigen_plugins.h:23
const Scalar * const_iterator
Definition: eigen_plugins.h:24
const_iterator begin() const
bool empty() const
Is the list empty?
void clear()
Empty the list.
GLdouble s
Definition: glext.h:3602
TSet::const_iterator const_iterator
const_iterator end() const
GLsizei const GLchar ** string
Definition: glext.h:3919
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:36



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019