Main MRPT website > C++ reference for MRPT 1.4.0
CPropertiesValuesList.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 CPropertiesValuesList_H
10#define CPropertiesValuesList_H
11
13
14/*---------------------------------------------------------------
15 Class
16 ---------------------------------------------------------------*/
17namespace mrpt
18{
19 namespace utils
20 {
21 // This must be added to any CSerializable derived class:
23
24 /** An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable object.
25 * A multi-hypotheses version exists in CMHPropertiesValuesList.
26 * \sa CSerializable, CMHPropertiesValuesList, mrpt::utils::TParameters
27 * \ingroup mrpt_base_grp
28 */
30 {
31 // This must be added to any CSerializable derived class:
33 protected:
35 {
36 std::string name;
37 CSerializablePtr value;
38 };
39 /** The properties list: a map between strings and objects
40 */
41 std::vector<TPropertyValuePair> m_properties;
42
43 public:
44 /** Default constructor
45 */
47
48 /** Copy constructor
49 */
51
52 /** Copy operator
53 */
55
56 /** Destructor
57 */
59
60 /** Clears the list.
61 */
62 void clear();
63
64 /** Returns the value of the property (case insensitive), or NULL if it does not exist.
65 */
66 CSerializablePtr get(const std::string &propertyName) const;
67
68 /** Sets/change the value of the property (case insensitive), making a copy of the object (or setting it to NULL if it is the passed value)
69 */
70 void set(const std::string &propertyName,const CSerializablePtr &obj);
71
72 /** Returns the number of properties in the list
73 */
74 size_t size() const;
75
76 /** Returns the name of all properties in the list
77 */
78 std::vector<std::string> getPropertyNames() const;
79
80 }; // End of class def.
82
83
84 } // End of namespace
85} // End of namespace
86
87#endif
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
void set(const std::string &propertyName, const CSerializablePtr &obj)
Sets/change the value of the property (case insensitive), making a copy of the object (or setting it ...
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
size_t size() const
Returns the number of properties in the list.
void clear()
Clears the list.
CSerializablePtr get(const std::string &propertyName) const
Returns the value of the property (case insensitive), or NULL if it does not exist.
std::vector< TPropertyValuePair > m_properties
The properties list: a map between strings and objects.
CPropertiesValuesList(const CPropertiesValuesList &o)
Copy constructor.
virtual ~CPropertiesValuesList()
Destructor.
CPropertiesValuesList()
Default constructor.
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:40
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.4 for MRPT 1.4.0 SVN: at Sun Aug 14 11:28:23 UTC 2022