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++)
66 in >> m_properties[i].name;
72 m_properties[i].value.reset();
74 in >> m_properties[i].value;
77 in >> m_properties[i].ID;
100 m_properties.clear();
108 const char* propertyName,
const int64_t& hypothesis_ID)
const 110 std::vector<TPropertyValueIDTriplet>::const_iterator it;
111 for (it = m_properties.begin(); it != m_properties.end(); ++it)
113 it->ID == hypothesis_ID)
116 for (it = m_properties.begin(); it != m_properties.end(); ++it)
117 if (!
os::_strcmpi(propertyName, it->name.c_str()) && it->ID == 0)
128 const char* propertyName)
const 130 for (
const auto& m_propertie : m_properties)
132 if (!
os::_strcmpi(propertyName, m_propertie.name.c_str()))
133 return m_propertie.value;
148 for (
auto& m_propertie : m_properties)
150 if (m_propertie.ID == hypothesis_ID &&
155 m_propertie.value.reset(dynamic_cast<CSerializable*>(
obj->clone()));
167 newPair.
ID = hypothesis_ID;
168 m_properties.push_back(newPair);
171 printf(
"Exception while setting annotation '%s'", propertyName););
183 for (
auto& m_propertie : m_properties)
185 if (m_propertie.ID == hypothesis_ID &&
189 m_propertie.value =
obj;
198 newPair.
ID = hypothesis_ID;
199 m_properties.push_back(newPair);
202 printf(
"Exception while setting annotation '%s'", propertyName););
210 std::vector<std::string> ret;
212 for (
const auto& m_propertie : m_properties)
215 for (
auto& itS : ret)
217 if (itS == m_propertie.name)
223 if (isNew) ret.push_back(m_propertie.name);
233 const char* propertyName,
const int64_t& hypothesis_ID)
235 for (
auto it = m_properties.begin(); it != m_properties.end();)
237 it->ID == hypothesis_ID)
238 it = m_properties.erase(it);
248 for (
auto it = m_properties.begin(); it != m_properties.end();)
249 if (it->ID == hypothesis_ID)
250 it = m_properties.erase(it);
260 : m_properties(o.m_properties)
263 m_propertie.value.reset(
264 dynamic_cast<CSerializable*>(m_propertie.value->clone()));
273 if (
this == &o)
return *
this;
278 m_propertie.value.reset(
279 dynamic_cast<CSerializable*>(m_propertie.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.
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to 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.
~CMHPropertiesValuesList() override
Destructor.
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.
std::vector< TPropertyValueIDTriplet > m_properties
int _strcmpi(const char *str1, const char *str2) noexcept
An OS-independent version of strcmpi.