9 #ifndef CMHPropertiesValuesList_H
10 #define CMHPropertiesValuesList_H
70 const char* propertyName,
const int64_t& hypothesis_ID)
const;
78 const char* propertyName,
const int64_t& hypothesis_ID,
79 bool allowNullPointer =
true)
const
86 return typename T::Ptr();
92 return std::dynamic_pointer_cast<T>(
obj);
121 void remove(
const char* propertyName,
const int64_t& hypothesis_ID);
132 const char* propertyName,
const T&
data,
const int64_t& hypothesis_ID)
137 memChunk->setAllocBlockSize(10);
144 if (it->ID == hypothesis_ID &&
149 it->value = memChunk;
157 newPair.
value = memChunk;
158 newPair.
ID = hypothesis_ID;
162 printf(
"Exception while setting annotation '%s'", propertyName););
172 const char* propertyName, T& out_data,
const int64_t& hypothesis_ID,
173 bool raiseExceptionIfNotFound =
false)
const
181 it->ID == hypothesis_ID)
184 std::dynamic_pointer_cast<CMemoryChunk>(it->value);
186 if (memChunk->getTotalBytesCount() !=
sizeof(out_data))
188 out_data = *
static_cast<T*
>(memChunk->getRawBufferData());
193 if (raiseExceptionIfNotFound)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
CMHPropertiesValuesList()
Default constructor.
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,...
virtual ~CMHPropertiesValuesList()
Destructor.
void remove(const char *propertyName, const int64_t &hypothesis_ID)
Remove a given property, if it exists.
T::Ptr 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 ...
CMHPropertiesValuesList & operator=(const CMHPropertiesValuesList &o)
Copy operator.
const_iterator end() const
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
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,...
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,...
CSerializable::Ptr getAnyHypothesis(const char *propertyName) const
Returns the value of the property (case insensitive) for the first hypothesis ID found,...
std::vector< TPropertyValueIDTriplet > m_properties
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,...
void removeAll(const int64_t &hypothesis_ID)
Remove all the properties for the given hypothesis.
std::vector< TPropertyValueIDTriplet >::iterator 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...
void clear()
Clears the list and frees all object's memory.
std::vector< TPropertyValueIDTriplet >::const_iterator const_iterator
const_iterator begin() const
std::shared_ptr< CMemoryChunk > Ptr
The virtual base class which provides a unified interface for all persistent objects in MRPT.
std::shared_ptr< CSerializable > Ptr
const Scalar * const_iterator
GLsizei GLsizei GLuint * obj
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLuint const GLchar * name
GLsizei const GLfloat * value
GLsizei const GLchar ** string
bool strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
#define MRPT_END_WITH_CLEAN_UP(stuff)
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Internal triplet for each property in utils::CMHPropertiesValuesList.
TPropertyValueIDTriplet()
A structure that holds runtime class type information.