WriterInterface< R > Class Template Referenceabstract

#include <RobotAPI/libraries/aron/core/data/rw/Writer.h>

Public Types

using ReturnType = R
 
using ReturnTypeConst = typename std::add_const<ReturnType>::type
 

Public Member Functions

virtual data::Descriptor getDescriptor (ReturnTypeConst &input)=0
 
virtual ReturnType writeBool (const bool i, const Path &p)=0
 
virtual ReturnType writeDict (const std::map< std::string, ReturnType > &elements, const std::optional< ReturnType > &extends, const Path &p)=0
 
virtual ReturnType writeDict (std::map< std::string, ReturnType > &&elements, const std::optional< ReturnType > &extends, const Path &p)
 Overload for callers that no longer need elements afterwards - which is the case for all generated write() code, since it builds the element map purely to hand it over.
 
virtual ReturnType writeDouble (const double i, const Path &p)=0
 
virtual ReturnType writeFloat (const float i, const Path &p)=0
 
virtual void writeImportance (ReturnType &, const std::optional< float > &)
 
virtual ReturnType writeInt (const int i, const Path &p)=0
 
virtual ReturnType writeList (const std::vector< ReturnType > &elements, const Path &p)=0
 
virtual ReturnType writeList (std::vector< ReturnType > &&elements, const Path &p)
 Same bargain as the writeDict overload below, for lists.
 
virtual ReturnType writeLong (const long i, const Path &p)=0
 
virtual ReturnType writeNDArray (const std::vector< int > &shape, const std::string &typeAsString, const unsigned char *data, const Path &p)=0
 
virtual ReturnType writeNull ()
 
ReturnType writePrimitive (const bool i, const Path &p=Path())
 
ReturnType writePrimitive (const double i, const Path &p=Path())
 
ReturnType writePrimitive (const float i, const Path &p=Path())
 
ReturnType writePrimitive (const int i, const Path &p=Path())
 
ReturnType writePrimitive (const long i, const Path &p=Path())
 
ReturnType writePrimitive (const std::string &i, const Path &p=Path())
 
virtual ReturnType writeString (const std::string &i, const Path &p)=0
 
virtual ~WriterInterface ()=default
 

Member Typedef Documentation

◆ ReturnType

template<class R>
using ReturnType = R

◆ ReturnTypeConst

template<class R>
using ReturnTypeConst = typename std::add_const<ReturnType>::type

Constructor & Destructor Documentation

◆ ~WriterInterface()

template<class R>
virtual ~WriterInterface ( )
virtualdefault

Member Function Documentation

◆ getDescriptor()

template<class R>
virtual data::Descriptor getDescriptor ( ReturnTypeConst & input)
pure virtual

◆ writeBool()

template<class R>
virtual ReturnType writeBool ( const bool i,
const Path & p )
pure virtual

◆ writeDict() [1/2]

template<class R>
virtual ReturnType writeDict ( const std::map< std::string, ReturnType > & elements,
const std::optional< ReturnType > & extends,
const Path & p )
pure virtual

Implemented in AronDTOWriter, and NlohmannJSONWriter.

◆ writeDict() [2/2]

template<class R>
virtual ReturnType writeDict ( std::map< std::string, ReturnType > && elements,
const std::optional< ReturnType > & extends,
const Path & p )
inlinevirtual

Overload for callers that no longer need elements afterwards - which is the case for all generated write() code, since it builds the element map purely to hand it over.

The default implementation forwards to the copying overload, so writers that cannot take ownership need not implement anything. Writers that can (see VariantWriter) override this to avoid rebuilding the map element by element.

Reimplemented in AronDTOWriter, and NlohmannJSONWriter.

◆ writeDouble()

template<class R>
virtual ReturnType writeDouble ( const double i,
const Path & p )
pure virtual

◆ writeFloat()

template<class R>
virtual ReturnType writeFloat ( const float i,
const Path & p )
pure virtual

◆ writeImportance()

template<class R>
virtual void writeImportance ( ReturnType & ,
const std::optional< float > &  )
inlinevirtual

Reimplemented in AronDTOWriter, and NlohmannJSONWriter.

◆ writeInt()

template<class R>
virtual ReturnType writeInt ( const int i,
const Path & p )
pure virtual

◆ writeList() [1/2]

template<class R>
virtual ReturnType writeList ( const std::vector< ReturnType > & elements,
const Path & p )
pure virtual

◆ writeList() [2/2]

template<class R>
virtual ReturnType writeList ( std::vector< ReturnType > && elements,
const Path & p )
inlinevirtual

Same bargain as the writeDict overload below, for lists.

The JSON writer assigns the vector straight into a json array, which deep-copies every descendant unless it can take ownership.

Reimplemented in NlohmannJSONWriter.

◆ writeLong()

template<class R>
virtual ReturnType writeLong ( const long i,
const Path & p )
pure virtual

◆ writeNDArray()

template<class R>
virtual ReturnType writeNDArray ( const std::vector< int > & shape,
const std::string & typeAsString,
const unsigned char * data,
const Path & p )
pure virtual

◆ writeNull()

template<class R>
virtual ReturnType writeNull ( )
inlinevirtual

◆ writePrimitive() [1/6]

template<class R>
ReturnType writePrimitive ( const bool i,
const Path & p = Path() )
inline

◆ writePrimitive() [2/6]

template<class R>
ReturnType writePrimitive ( const double i,
const Path & p = Path() )
inline

◆ writePrimitive() [3/6]

template<class R>
ReturnType writePrimitive ( const float i,
const Path & p = Path() )
inline

◆ writePrimitive() [4/6]

template<class R>
ReturnType writePrimitive ( const int i,
const Path & p = Path() )
inline

◆ writePrimitive() [5/6]

template<class R>
ReturnType writePrimitive ( const long i,
const Path & p = Path() )
inline

◆ writePrimitive() [6/6]

template<class R>
ReturnType writePrimitive ( const std::string & i,
const Path & p = Path() )
inline

◆ writeString()

template<class R>
virtual ReturnType writeString ( const std::string & i,
const Path & p )
pure virtual

The documentation for this class was generated from the following file: