36 for (i = 0; i <
n; i++)
39 out << m_properties[i].name.c_str();
42 isNull = !m_properties[i].value;
45 if (!isNull) out << *m_properties[i].value;
48 out << m_properties[i].ID;
71 m_properties.resize(
n);
72 for (i = 0; i <
n; i++)
77 m_properties[i].name = nameBuf;
83 m_properties[i].value.reset();
85 in >> m_properties[i].value;
88 in >> m_properties[i].ID;
111 m_properties.clear();
119 const char* propertyName,
const int64_t& hypothesis_ID)
const 122 for (it = m_properties.begin(); it != m_properties.end(); ++it)
124 it->ID == hypothesis_ID)
127 for (it = m_properties.begin(); it != m_properties.end(); ++it)
128 if (!
os::_strcmpi(propertyName, it->name.c_str()) && it->ID == 0)
139 const char* propertyName)
const 142 m_properties.begin();
143 it != m_properties.end(); ++it)
145 if (!
os::_strcmpi(propertyName, it->name.c_str()))
return it->value;
161 m_properties.begin();
162 it != m_properties.end(); ++it)
164 if (it->ID == hypothesis_ID &&
169 it->value.reset(dynamic_cast<CSerializable*>(
obj->clone()));
181 newPair.
ID = hypothesis_ID;
182 m_properties.push_back(newPair);
185 printf(
"Exception while setting annotation '%s'", propertyName););
198 m_properties.begin();
199 it != m_properties.end(); ++it)
201 if (it->ID == hypothesis_ID &&
214 newPair.
ID = hypothesis_ID;
215 m_properties.push_back(newPair);
218 printf(
"Exception while setting annotation '%s'", propertyName););
226 std::vector<std::string> ret;
229 m_properties.begin();
230 it != m_properties.end(); ++it)
234 itS != ret.end(); ++itS)
236 if ((*itS) == it->name)
242 if (isNew) ret.push_back(it->name);
252 const char* propertyName,
const int64_t& hypothesis_ID)
255 m_properties.begin();
256 it != m_properties.end();)
258 it->ID == hypothesis_ID)
259 it = m_properties.erase(it);
270 m_properties.begin();
271 it != m_properties.end();)
272 if (it->ID == hypothesis_ID)
273 it = m_properties.erase(it);
283 : m_properties(o.m_properties)
288 it->value.reset(dynamic_cast<CSerializable*>(it->value->clone()));
297 if (
this == &o)
return *
this;
304 it->value.reset(dynamic_cast<CSerializable*>(it->value->clone()));
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define MRPT_END_WITH_CLEAN_UP(stuff)
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void remove(const char *propertyName, const int64_t &hypothesis_ID)
Remove a given property, if it exists.
CMHPropertiesValuesList()
Default constructor.
const Scalar * const_iterator
GLsizei GLsizei GLuint * obj
void clear()
Clear the contents of this container.
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Internal triplet for each property in utils::CMHPropertiesValuesList.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
CMHPropertiesValuesList & operator=(const CMHPropertiesValuesList &o)
Copy operator.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void removeAll(const int64_t &hypothesis_ID)
Remove all the properties for the given hypothesis.
GLsizei const GLchar ** string
std::shared_ptr< CSerializable > Ptr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual ~CMHPropertiesValuesList()
Destructor.
void clear()
Clears the list and frees all object's memory.
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
void setMemoryReference(const char *propertyName, const CSerializable::Ptr &obj, const int64_t &hypothesis_ID)
Sets/change the value of the property (case insensitive) for the given hypothesis ID...
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
std::vector< TPropertyValueIDTriplet > m_properties
unsigned __int32 uint32_t
void set(const char *propertyName, const CSerializable::Ptr &obj, const int64_t &hypothesis_ID)
Sets/change the value of the property (case insensitive) for the given hypothesis ID...
CSerializable::Ptr get(const char *propertyName, const int64_t &hypothesis_ID) const
Returns the value of the property (case insensitive) for some given hypothesis ID, or a nullptr smart pointer if it does not exist.
CSerializable::Ptr getAnyHypothesis(const char *propertyName) const
Returns the value of the property (case insensitive) for the first hypothesis ID found, or nullptr if it does not exist.
int _strcmpi(const char *str1, const char *str2) noexcept
An OS-independent version of strcmpi.