9 #ifndef CMHPropertiesValuesList_H
10 #define CMHPropertiesValuesList_H
67 CSerializable::Ptr
get(
68 const char* propertyName,
const int64_t& hypothesis_ID)
const;
76 const char* propertyName,
const int64_t& hypothesis_ID,
77 bool allowNullPointer =
true)
const
80 CSerializable::Ptr
obj =
get(propertyName, hypothesis_ID);
84 return typename T::Ptr();
89 &T::GetRuntimeClassIdStatic();
91 return std::dynamic_pointer_cast<T>(
obj);
106 const char* propertyName,
const CSerializable::Ptr&
obj,
115 const char* propertyName,
const CSerializable::Ptr&
obj,
120 void remove(
const char* propertyName,
const int64_t& hypothesis_ID);
131 const char* propertyName,
const T&
data,
const int64_t& hypothesis_ID)
136 basic_value.resize(
sizeof(T));
141 if (it->ID == hypothesis_ID &&
146 it->basic_value = basic_value;
155 newPair.
ID = hypothesis_ID;
159 printf(
"Exception while setting annotation '%s'", propertyName););
169 const char* propertyName, T& out_data,
const int64_t& hypothesis_ID,
170 bool raiseExceptionIfNotFound =
false)
const
176 it->ID == hypothesis_ID)
178 if (it->basic_value.size() !=
sizeof(out_data))
180 out_data = *
reinterpret_cast<const T*
>(&it->basic_value[0]);
185 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.
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,...
CMHPropertiesValuesList & operator=(const CMHPropertiesValuesList &o)
Copy operator.
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 ...
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,...
std::vector< TPropertyValueIDTriplet > m_properties
const_iterator begin() const
const_iterator end() const
CSerializable::Ptr getAnyHypothesis(const char *propertyName) const
Returns the value of the property (case insensitive) for the first hypothesis ID found,...
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.
void clear()
Clears the list and frees all object's memory.
std::vector< TPropertyValueIDTriplet >::const_iterator const_iterator
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...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
std::shared_ptr< CSerializable > Ptr
const Scalar * const_iterator
#define ASSERT_(f)
Defines an assertion mechanism.
#define MRPT_END_WITH_CLEAN_UP(stuff)
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
GLsizei GLsizei GLuint * obj
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLuint const GLchar * name
GLsizei const GLfloat * value
GLsizei const GLchar ** string
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
bool strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
Internal triplet for each property in utils::CMHPropertiesValuesList.
TPropertyValueIDTriplet()
mrpt::serialization::CSerializable::Ptr value
A structure that holds runtime class type information.