Go to the documentation of this file.
9 #ifndef CMHPropertiesValuesList_H
10 #define CMHPropertiesValuesList_H
75 CSerializablePtr
get(
const char *propertyName,
const int64_t & hypothesis_ID )
const;
80 typename T::SmartPtr
getAs(
const char *propertyName,
const int64_t & hypothesis_ID,
bool allowNullPointer =
true)
const
83 CSerializablePtr obj = get(propertyName,hypothesis_ID);
87 return typename T::SmartPtr();
91 ASSERT_( class_ID == obj->GetRuntimeClass() );
92 return typename T::SmartPtr( obj );
104 void set(
const char *propertyName,
const CSerializablePtr &obj,
const int64_t & hypothesis_ID);
109 void setMemoryReference(
const char *propertyName,
const CSerializablePtr& obj,
const int64_t & hypothesis_ID);
113 void remove(
const char *propertyName,
const int64_t & hypothesis_ID);
122 void setElemental(
const char *propertyName,
const T &data,
const int64_t & hypothesis_ID)
126 CMemoryChunkPtr memChunk = CMemoryChunkPtr(
new CMemoryChunk() );
127 memChunk->setAllocBlockSize(10);
136 it->value = memChunk;
143 newPair.
name = std::string(propertyName);
144 newPair.
value = memChunk;
145 newPair.
ID = hypothesis_ID;
146 m_properties.push_back(newPair);
149 printf(
"Exception while setting annotation '%s'",propertyName); \
157 bool getElemental(
const char *propertyName, T &out_data,
const int64_t & hypothesis_ID,
bool raiseExceptionIfNotFound =
false)
const
164 CMemoryChunkPtr memChunk = CMemoryChunkPtr(it->value);
166 if (memChunk->getTotalBytesCount()!=
sizeof(out_data))
THROW_EXCEPTION(
"Data sizes do not match.");
167 out_data = *
static_cast<T*
>( memChunk->getRawBufferData() );
172 if (raiseExceptionIfNotFound)
191 size_t size()
const {
return m_properties.size(); }
#define THROW_EXCEPTION(msg)
Internal triplet for each property in utils::CMHPropertiesValuesList.
std::vector< TPropertyValueIDTriplet >::iterator iterator
const Scalar * const_iterator
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
const_iterator end() const
CSerializablePtr getAnyHypothesis(const char *propertyName) const
Returns the value of the property (case insensitive) for the first hypothesis ID found,...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
void setMemoryReference(const char *propertyName, const CSerializablePtr &obj, const int64_t &hypothesis_ID)
Sets/change the value of the property (case insensitive) for the given hypothesis ID,...
void removeAll(const int64_t &hypothesis_ID)
Remove all the properties for the given hypothesis.
#define MRPT_END_WITH_CLEAN_UP(stuff)
T::SmartPtr getAs(const char *propertyName, const int64_t &hypothesis_ID, bool allowNullPointer=true) const
Returns the value of the property (case insensitive) for some given hypothesis ID checking its class ...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CMHPropertiesValuesList()
Default constructor.
void remove(const char *propertyName, const int64_t &hypothesis_ID)
Remove a given property, if it exists.
CMHPropertiesValuesList(const CMHPropertiesValuesList &o)
Copy constructor.
A memory buffer (implements CStream) which can be itself serialized.
void setElemental(const char *propertyName, const T &data, const int64_t &hypothesis_ID)
Sets/change the value of a property (case insensitive) for the given hypothesis ID,...
bool BASE_IMPEXP strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
void clear()
Clears the list and frees all object's memory.
virtual ~CMHPropertiesValuesList()
Destructor.
The virtual base class which provides a unified interface for all persistent objects in MRPT.
const_iterator begin() const
void set(const char *propertyName, const CSerializablePtr &obj, const int64_t &hypothesis_ID)
Sets/change the value of the property (case insensitive) for the given hypothesis ID,...
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
std::vector< TPropertyValueIDTriplet >::const_iterator const_iterator
bool getElemental(const char *propertyName, T &out_data, const int64_t &hypothesis_ID, bool raiseExceptionIfNotFound=false) const
Gets the value of a property (case insensitive) for the given hypothesis ID, retrieves it as an eleme...
std::vector< TPropertyValueIDTriplet > m_properties
TPropertyValueIDTriplet()
A structure that holds runtime class type information.
CSerializablePtr get(const char *propertyName, const int64_t &hypothesis_ID) const
Returns the value of the property (case insensitive) for some given hypothesis ID,...
#define THROW_EXCEPTION_CUSTOM_MSG1(msg, param1)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |