Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
utils
CPropertiesValuesList.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef CPropertiesValuesList_H
29
#define CPropertiesValuesList_H
30
31
#include <
mrpt/utils/CSerializable.h
>
32
33
/*---------------------------------------------------------------
34
Class
35
---------------------------------------------------------------*/
36
namespace
mrpt
37
{
38
namespace
utils
39
{
40
// This must be added to any CSerializable derived class:
41
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE
(
CPropertiesValuesList
,
mrpt::utils::CSerializable
)
42
43
/** An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable object.
44
* A multi-hypotheses version exists in CMHPropertiesValuesList.
45
* \sa CSerializable, CMHPropertiesValuesList, mrpt::utils::TParameters
46
* \ingroup mrpt_base_grp
47
*/
48
class
BASE_IMPEXP
CPropertiesValuesList
: public mrpt::utils::
CSerializable
49
{
50
// This must be added to any CSerializable derived class:
51
DEFINE_SERIALIZABLE
(
CPropertiesValuesList
)
52
protected:
53
struct
BASE_IMPEXP
TPropertyValuePair
54
{
55
std::string
name
;
56
CSerializablePtr
value
;
57
};
58
/** The properties list: a map between strings and objects
59
*/
60
std::vector<TPropertyValuePair>
m_properties
;
61
62
public
:
63
/** Default constructor
64
*/
65
CPropertiesValuesList
();
66
67
/** Copy constructor
68
*/
69
CPropertiesValuesList
(
const
CPropertiesValuesList
&o);
70
71
/** Copy operator
72
*/
73
CPropertiesValuesList
& operator = (
const
CPropertiesValuesList
&o);
74
75
/** Destructor
76
*/
77
virtual
~
CPropertiesValuesList
();
78
79
/** Clears the list.
80
*/
81
void
clear();
82
83
/** Returns the value of the property (case insensitive), or NULL if it does not exist.
84
*/
85
CSerializablePtr
get
(
const
std::string &propertyName)
const
;
86
87
/** 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)
88
*/
89
void
set
(
const
std::string &propertyName,
const
CSerializablePtr
&obj);
90
91
/** Returns the number of properties in the list
92
*/
93
size_t
size
()
const
;
94
95
/** Returns the name of all properties in the list
96
*/
97
std::vector<std::string> getPropertyNames()
const
;
98
99
};
// End of class def.
100
101
102
}
// End of namespace
103
}
// End of namespace
104
105
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013