Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
16namespace 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...? */
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
A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the...
void clear()
Empty the list.
std::set< const mrpt::utils::TRuntimeClassId * > TSet
const_iterator end() const
bool containsDerivedFrom(const mrpt::utils::TRuntimeClassId *id) const
Does the list contains a class derived from...?
const_iterator begin() const
TSet::const_iterator const_iterator
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?
void fromString(const std::string &s)
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
bool empty() const
Is the list empty?
std::string toString() const
Return a string representation of the list, for example: "CPose2D, CObservation, CPose3D".
Scalar * iterator
Definition: eigen_plugins.h:23
const Scalar * const_iterator
Definition: eigen_plugins.h:24
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A structure that holds runtime class type information.
Definition: CObject.h:47



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:36:32 UTC 2021