31 for (i = 0; i <
n; i++)
34 out << m_properties[i].name.c_str();
37 isNull = !m_properties[i].value;
40 if (!isNull) out << *m_properties[i].value;
43 out << m_properties[i].ID;
62 m_properties.resize(
n);
63 for (i = 0; i <
n; i++)
68 m_properties[i].name = nameBuf;
74 m_properties[i].value.reset();
76 in >> m_properties[i].value;
79 in >> m_properties[i].ID;
102 m_properties.clear();
110 const char* propertyName,
const int64_t& hypothesis_ID)
const 113 for (it = m_properties.begin(); it != m_properties.end(); ++it)
115 it->ID == hypothesis_ID)
118 for (it = m_properties.begin(); it != m_properties.end(); ++it)
119 if (!
os::_strcmpi(propertyName, it->name.c_str()) && it->ID == 0)
130 const char* propertyName)
const 133 m_properties.begin();
134 it != m_properties.end(); ++it)
136 if (!
os::_strcmpi(propertyName, it->name.c_str()))
return it->value;
152 m_properties.begin();
153 it != m_properties.end(); ++it)
155 if (it->ID == hypothesis_ID &&
160 it->value.reset(dynamic_cast<CSerializable*>(
obj->clone()));
172 newPair.
ID = hypothesis_ID;
173 m_properties.push_back(newPair);
176 printf(
"Exception while setting annotation '%s'", propertyName););
189 m_properties.begin();
190 it != m_properties.end(); ++it)
192 if (it->ID == hypothesis_ID &&
205 newPair.
ID = hypothesis_ID;
206 m_properties.push_back(newPair);
209 printf(
"Exception while setting annotation '%s'", propertyName););
217 std::vector<std::string> ret;
220 m_properties.begin();
221 it != m_properties.end(); ++it)
225 itS != ret.end(); ++itS)
227 if ((*itS) == it->name)
233 if (isNew) ret.push_back(it->name);
243 const char* propertyName,
const int64_t& hypothesis_ID)
246 m_properties.begin();
247 it != m_properties.end();)
249 it->ID == hypothesis_ID)
250 it = m_properties.erase(it);
261 m_properties.begin();
262 it != m_properties.end();)
263 if (it->ID == hypothesis_ID)
264 it = m_properties.erase(it);
274 : m_properties(o.m_properties)
279 it->value.reset(dynamic_cast<CSerializable*>(it->value->clone()));
288 if (
this == &o)
return *
this;
295 it->value.reset(dynamic_cast<CSerializable*>(it->value->clone()));
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 serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
virtual ~CMHPropertiesValuesList()
Destructor.
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
#define MRPT_END_WITH_CLEAN_UP(stuff)
GLsizei GLsizei GLuint * obj
void removeAll(const int64_t &hypothesis_ID)
Remove all the properties for the given hypothesis.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CMHPropertiesValuesList()
Default constructor.
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.
void clear()
Clears the list and frees all object's memory.
void remove(const char *propertyName, const int64_t &hypothesis_ID)
Remove a given property, if it exists.
GLsizei const GLchar ** string
Virtual base class for "archives": classes abstracting I/O streams.
CMHPropertiesValuesList & operator=(const CMHPropertiesValuesList &o)
Copy operator.
Internal triplet for each property in utils::CMHPropertiesValuesList.
mrpt::serialization::CSerializable::Ptr value
The virtual base class which provides a unified interface for all persistent objects in MRPT...
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
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...
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, or a nullptr smart pointer if it does not exist.
unsigned __int32 uint32_t
void clear()
Clear the contents of this container.
const Scalar * const_iterator
std::vector< TPropertyValueIDTriplet > m_properties
int _strcmpi(const char *str1, const char *str2) noexcept
An OS-independent version of strcmpi.