9 #ifndef CMHPropertiesValuesList_H 10 #define CMHPropertiesValuesList_H 72 CSerializablePtr
get(
const char *propertyName,
const int64_t & hypothesis_ID )
const;
77 typename T::Ptr
getAs(
const char *propertyName,
const int64_t & hypothesis_ID,
bool allowNullPointer =
true)
const 80 CSerializablePtr
obj =
get(propertyName,hypothesis_ID);
84 return typename T::Ptr();
89 return typename T::Ptr(
obj );
96 CSerializablePtr getAnyHypothesis(
const char *propertyName)
const;
101 void set(
const char *propertyName,
const CSerializablePtr &
obj,
const int64_t & hypothesis_ID);
106 void setMemoryReference(
const char *propertyName,
const CSerializablePtr&
obj,
const int64_t & hypothesis_ID);
110 void remove(
const char *propertyName,
const int64_t & hypothesis_ID);
114 void removeAll(
const int64_t & hypothesis_ID);
123 CMemoryChunkPtr memChunk = CMemoryChunkPtr(
new CMemoryChunk() );
124 memChunk->setAllocBlockSize(10);
133 it->value = memChunk;
141 newPair.
value = memChunk;
142 newPair.
ID = hypothesis_ID;
143 m_properties.push_back(newPair);
146 printf(
"Exception while setting annotation '%s'",propertyName); \
154 bool getElemental(
const char *propertyName, T &out_data,
const int64_t & hypothesis_ID,
bool raiseExceptionIfNotFound =
false)
const 161 CMemoryChunkPtr memChunk = CMemoryChunkPtr(it->value);
163 if (memChunk->getTotalBytesCount()!=
sizeof(out_data))
THROW_EXCEPTION(
"Data sizes do not match.");
164 out_data = *
static_cast<T*
>( memChunk->getRawBufferData() );
169 if (raiseExceptionIfNotFound)
177 std::vector<std::string> getPropertyNames()
const;
188 size_t size()
const {
return m_properties.size(); }
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
TPropertyValueIDTriplet()
std::vector< TPropertyValueIDTriplet >::const_iterator const_iterator
#define MRPT_END_WITH_CLEAN_UP(stuff)
The virtual base class which provides a unified interface for all persistent objects in MRPT...
const_iterator end() const
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
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, from an elemental data type.
const Scalar * const_iterator
GLsizei GLsizei GLuint * obj
void clear()
Clear the contents of this container.
Internal triplet for each property in utils::CMHPropertiesValuesList.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
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 ...
A memory buffer (implements CStream) which can be itself serialized.
GLsizei const GLchar ** string
const_iterator begin() const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
std::vector< TPropertyValueIDTriplet >::iterator iterator
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
GLuint const GLchar * name
GLsizei const GLfloat * value
A structure that holds runtime class type information.
std::vector< TPropertyValueIDTriplet > m_properties
bool BASE_IMPEXP strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
GLsizei GLsizei GLenum GLenum const GLvoid * data
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...