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  ---------------------------------------------------------------*/
17 namespace 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
mrpt::utils::CPropertiesValuesList::getPropertyNames
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
mrpt::utils::CPropertiesValuesList::size
size_t size() const
Returns the number of properties in the list.
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
Definition: CSerializable.h:182
mrpt::utils::CPropertiesValuesList::set
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 ...
mrpt::utils::CPropertiesValuesList::~CPropertiesValuesList
virtual ~CPropertiesValuesList()
Destructor.
mrpt::utils::CPropertiesValuesList::clear
void clear()
Clears the list.
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:17
mrpt::utils::CPropertiesValuesList::get
CSerializablePtr get(const std::string &propertyName) const
Returns the value of the property (case insensitive), or NULL if it does not exist.
mrpt::utils::CPropertiesValuesList::CPropertiesValuesList
CPropertiesValuesList()
Default constructor.
mrpt::utils::CPropertiesValuesList::m_properties
std::vector< TPropertyValuePair > m_properties
The properties list: a map between strings and objects.
Definition: CPropertiesValuesList.h:41
mrpt::utils::CPropertiesValuesList::TPropertyValuePair
Definition: CPropertiesValuesList.h:35
mrpt::utils::CPropertiesValuesList::TPropertyValuePair::name
std::string name
Definition: CPropertiesValuesList.h:36
mrpt::utils::CPropertiesValuesList::CPropertiesValuesList
CPropertiesValuesList(const CPropertiesValuesList &o)
Copy constructor.
mrpt::utils::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:40
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:147
mrpt::utils::CPropertiesValuesList
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
Definition: CPropertiesValuesList.h:30
mrpt::utils::CPropertiesValuesList::TPropertyValuePair::value
CSerializablePtr value
Definition: CPropertiesValuesList.h:37
CSerializable.h
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Definition: CSerializable.h:178



Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020