template class mrpt::serialization::CSchemeArchive

Base template class for schema-capable “archives”, e.g.

JSON, YAML, from which to (de)serialize objects.

See [mrpt-serialization] for examples of use.

Original version by https://github.com/rachit173 for GSoC 2018.

#include <mrpt/serialization/CSchemeArchive.h>

template <typename SCHEME_CAPABLE>
class CSchemeArchive: public mrpt::serialization::CSchemeArchiveBase_impl
{
public:
    // construction

    CSchemeArchive();
    CSchemeArchive(SCHEME_CAPABLE& val);

    //
methods

    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const int32_t val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const uint32_t val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const int64_t val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const uint64_t val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const float val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const double val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const std::string val);
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const bool val);
    virtual operator int32_t () const;
    virtual operator uint32_t () const;
    virtual operator int64_t () const;
    virtual operator uint64_t () const;
    virtual operator float () const;
    virtual operator double () const;
    virtual operator bool () const;
    virtual operator std::string () const;
    virtual mrpt::serialization::CSchemeArchiveBase& operator = (const mrpt::serialization::CSerializable&);
    virtual void readTo(mrpt::serialization::CSerializable& obj);
    virtual mrpt::serialization::CSchemeArchiveBase operator [] (size_t idx);
    virtual mrpt::serialization::CSchemeArchiveBase operator [] (std::string str);
    virtual std::ostream& writeToStream(std::ostream& out) const;
    virtual std::istream& readFromStream(std::istream& in);
};

Inherited Members

public:
    //
methods

    virtual CSchemeArchiveBase& operator = (const int32_t) = 0;
    virtual CSchemeArchiveBase& operator = (const uint32_t) = 0;
    virtual CSchemeArchiveBase& operator = (const int64_t) = 0;
    virtual CSchemeArchiveBase& operator = (const uint64_t) = 0;
    virtual CSchemeArchiveBase& operator = (const float) = 0;
    virtual CSchemeArchiveBase& operator = (const double) = 0;
    virtual CSchemeArchiveBase& operator = (const std::string) = 0;
    virtual CSchemeArchiveBase& operator = (bool) = 0;
    virtual operator int32_t () const = 0;
    virtual operator uint32_t () const = 0;
    virtual operator int64_t () const = 0;
    virtual operator uint64_t () const = 0;
    virtual operator float () const = 0;
    virtual operator double () const = 0;
    virtual operator bool () const = 0;
    virtual operator std::string () const = 0;
    virtual void readTo(CSerializable& obj) = 0;
    virtual CSchemeArchiveBase& operator = (const mrpt::serialization::CSerializable&) = 0;
    virtual std::ostream& writeToStream(std::ostream& out) const = 0;
    virtual std::istream& readFromStream(std::istream& in) = 0;
    virtual CSchemeArchiveBase operator [] (size_t) = 0;
    virtual CSchemeArchiveBase operator [] (std::string) = 0;
    void setParent(CSchemeArchiveBase* parent);

Construction

CSchemeArchive()

Ctor that creates an own SCHEME_CAPABLE object.

CSchemeArchive(SCHEME_CAPABLE& val)

Ctor that uses user-providen SCHEME_CAPABLE object.

Methods

virtual mrpt::serialization::CSchemeArchiveBase& operator = (const mrpt::serialization::CSerializable&)

Writes object to archive, with synxtax out["name"] = obj;

virtual void readTo(mrpt::serialization::CSerializable& obj)

Reads object from the archive.

virtual std::ostream& writeToStream(std::ostream& out) const

Writes the scheme to a plain-text output.

virtual std::istream& readFromStream(std::istream& in)

Reads the scheme from a plain-text input.