class mrpt::hmtslam::CMHPropertiesValuesList

An arbitrary list of “annotations”, or named attributes, each being an instance of any CSerializable object (Multi-hypotheses version).

For each named annotation (or attribute), several values may exist, each associated to a given hypothesis ID. A non multi-hypotheses version exists in CPropertiesValuesList.

See also:

CSerializable, CPropertiesValuesList

#include <mrpt/hmtslam/CMHPropertiesValuesList.h>

class CMHPropertiesValuesList: public mrpt::serialization::CSerializable
{
public:
    // typedefs

    typedef std::vector<TPropertyValueIDTriplet>::iterator iterator;
    typedef std::vector<TPropertyValueIDTriplet>::const_iterator const_iterator;

    // construction

    CMHPropertiesValuesList();
    CMHPropertiesValuesList(const CMHPropertiesValuesList& o);

    //
methods

    CMHPropertiesValuesList& operator = (const CMHPropertiesValuesList& o);
    void clear();
    CSerializable::Ptr get(const char* propertyName, const int64_t& hypothesis_ID) const;

    template <typename T>
    T::Ptr getAs(
        const char* propertyName,
        const int64_t& hypothesis_ID,
        bool allowNullPointer = true
        ) const;

    CSerializable::Ptr getAnyHypothesis(const char* propertyName) const;

    void set(
        const char* propertyName,
        const CSerializable::Ptr& obj,
        const int64_t& hypothesis_ID
        );

    void setMemoryReference(
        const char* propertyName,
        const CSerializable::Ptr& obj,
        const int64_t& hypothesis_ID
        );

    void remove(const char* propertyName, const int64_t& hypothesis_ID);
    void removeAll(const int64_t& hypothesis_ID);

    template <class T>
    void setElemental(
        const char* propertyName,
        const T& data,
        const int64_t& hypothesis_ID
        );

    template <class T>
    bool getElemental(
        const char* propertyName,
        T& out_data,
        const int64_t& hypothesis_ID,
        bool raiseExceptionIfNotFound = false
        ) const;

    std::vector<std::string> getPropertyNames() const;
    iterator begin();
    const_iterator begin() const;
    iterator end();
    const_iterator end() const;
    size_t size() const;
};

Construction

CMHPropertiesValuesList()

Default constructor.

CMHPropertiesValuesList(const CMHPropertiesValuesList& o)

Copy constructor.

Methods

CMHPropertiesValuesList& operator = (const CMHPropertiesValuesList& o)

Copy operator.

void clear()

Clears the list and frees all object’s memory.

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.

template <typename T>
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 in runtime, or a nullptr smart pointer if it does not exist.

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 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, making a copy of the object (or setting it to nullptr if it is the passed value)

See also:

setMemoryReference

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, directly replacing the pointer instead of making a copy of the object.

See also:

set

void remove(const char* propertyName, const int64_t& hypothesis_ID)

Remove a given property, if it exists.

void removeAll(const int64_t& hypothesis_ID)

Remove all the properties for the given hypothesis.

template <class T>
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.

template <class T>
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 elemental data type (types must coincide, basic size check is performed).

Returns:

false if the property does not exist for the given hypothesis.

std::vector<std::string> getPropertyNames() const

Returns the name of all properties in the list.