26 void CPropertiesValuesList::serializeTo(
29 uint32_t i, n = (uint32_t)
size();
33 for (i = 0; i < n; i++)
36 out << m_properties[i].name.c_str();
39 isNull = m_properties[i].value ? 1 : 0;
42 if (m_properties[i].value)
out << *m_properties[i].value;
46 void CPropertiesValuesList::serializeFrom(
61 m_properties.resize(n);
62 for (i = 0; i < n; i++)
65 in >> m_properties[i].name;
71 m_properties[i].value.reset(
72 static_cast<CSerializable*>(
nullptr));
74 in >> m_properties[i].value;
86 CPropertiesValuesList::CPropertiesValuesList() =
default;
90 CPropertiesValuesList::~CPropertiesValuesList() {
clear(); }
95 : m_properties(o.m_properties)
98 m_propertie.value.reset(
99 dynamic_cast<CSerializable*>(m_propertie.value->clone()));
108 if (
this != &o)
return *
this;
112 m_propertie.value.reset(
113 dynamic_cast<CSerializable*>(m_propertie.value->clone()));
131 const std::string& propertyName)
const 135 if (!
os::_strcmpi(propertyName.c_str(), m_propertie.name.c_str()))
136 return m_propertie.value;
152 if (!
os::_strcmpi(propertyName.c_str(), m_propertie.name.c_str()))
157 m_propertie.value.reset();
159 m_propertie.value = obj;
166 newPair.
name = std::string(propertyName);
172 "Exception while setting annotation '%s'", propertyName.c_str()););
184 std::vector<std::string> ret;
187 ret.push_back(m_propertie.name);
std::vector< std::string > getPropertyNames() const
Returns the name of all properties in the list.
size_t size(const MATRIXLIKE &m, const int dim)
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 set(const std::string &propertyName, const CSerializable::Ptr &obj)
Sets/change the value of the property (case insensitive), making a copy of the object (or setting it ...
#define MRPT_END_WITH_CLEAN_UP(stuff)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CSerializable::Ptr get(const std::string &propertyName) const
Returns the value of the property (case insensitive), or nullptr if it does not exist.
std::vector< TPropertyValuePair > m_properties
The properties list: a map between strings and objects.
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
size_t size() const
Returns the number of properties in the list.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
CPropertiesValuesList & operator=(const CPropertiesValuesList &o)
Copy operator.
void clear()
Clear the contents of this container.
void clear()
Clears the list.
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
int _strcmpi(const char *str1, const char *str2) noexcept
An OS-independent version of strcmpi.