RobWorkProject
Public Member Functions | Protected Member Functions | List of all members
OutputArchive Class Referenceabstract

serializable objects can be written to an output archive. More...

#include <OutputArchive.hpp>

Inherits Archive.

Inherited by BINArchive [virtual], and INIArchive [virtual].

Public Member Functions

virtual ~OutputArchive ()
 destructor
 
void writeEnterScope (const std::string &id, const std::string &idDefault="")
 create a serialized scope in which objects can be written More...
 
void writeLeaveScope (const std::string &id, const std::string &idDefault="")
 leave the current scope More...
 
template<class T >
void write (const T &object, const std::string &id)
 generic write method. This method will write any objects that are either derived from the rw::common::Serializable class or where overloaded read() write() methods exists. More...
 
template<class T >
void write (const T &object, const std::string &id, const std::string &id_default)
 Same as write(object,id) however an additional parameter is given which is the default identifier to use in case id is empty. More...
 
template<class T >
OutputArchiveoperator<< (T &dst)
 Output stream operator.
 
- Public Member Functions inherited from Archive
virtual ~Archive ()
 destructor
 
void open (const std::string &filename)
 open file for reading and writing More...
 
void open (std::iostream &stream)
 initialize archive for reading and/or writing to a stream More...
 
void open (std::ostream &ofs)
 open an output stream for writing
 
void open (std::istream &ifs)
 open an inputstream for reading
 
virtual bool isOpen ()=0
 test if this archive is openned for manipulation. If this is false then no storage will be performed. More...
 
virtual void close ()=0
 close the archive.
 
virtual void flush ()=0
 flush the archive. Anything stored in buffers will be flushed to the actual media that has been openned.
 

Protected Member Functions

virtual void doWrite (bool val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::int8_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::uint8_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::int16_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::uint16_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::int32_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::uint32_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::int64_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (boost::uint64_t val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (float val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (double val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (const std::string &val, const std::string &id)=0
 Write value val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< bool > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::int8_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::uint8_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::int16_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::uint16_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::int32_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::uint32_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::int64_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< boost::uint64_t > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< float > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< double > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const std::vector< std::string > &val, const std::string &id)=0
 Write vector val to archive with identifier id. More...
 
virtual void doWrite (const Eigen::MatrixXd &val, const std::string &id)=0
 Write an Eigen matrix to output. More...
 
virtual void doWrite (const Eigen::VectorXd &val, const std::string &id)=0
 Write an Eigen vector to output. More...
 
template<class T >
void doWrite (const T &object, const std::string &id)
 handles serialization of an object. The object must either be a primitive type, inherit from Serializable or there must exist an overloaded method rw::common::serialization::write(const T& data, class OutputArchive& oarchive, const std::string& id) More...
 
virtual void doWriteEnterScope (const std::string &id)=0
 Enter a scope. More...
 
virtual void doWriteLeaveScope (const std::string &id)=0
 Leave a scope. More...
 
- Protected Member Functions inherited from Archive
virtual void doOpenArchive (const std::string &filename)=0
 open file for reading and writing More...
 
virtual void doOpenArchive (std::iostream &stream)=0
 initialize archive for reading and/or writing to a stream More...
 
virtual void doOpenInput (std::istream &ifs)=0
 open an inputstream for reading More...
 
virtual void doOpenOutput (std::ostream &ofs)=0
 open an output stream for writing More...
 

Detailed Description

serializable objects can be written to an output archive.

This class define an interface for serializing data.

Member Function Documentation

◆ doWrite() [1/27]

virtual void doWrite ( bool  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [2/27]

virtual void doWrite ( boost::int8_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [3/27]

virtual void doWrite ( boost::uint8_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [4/27]

virtual void doWrite ( boost::int16_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [5/27]

virtual void doWrite ( boost::uint16_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [6/27]

virtual void doWrite ( boost::int32_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [7/27]

virtual void doWrite ( boost::uint32_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [8/27]

virtual void doWrite ( boost::int64_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [9/27]

virtual void doWrite ( boost::uint64_t  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [10/27]

virtual void doWrite ( float  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [11/27]

virtual void doWrite ( double  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [12/27]

virtual void doWrite ( const std::string &  val,
const std::string &  id 
)
protectedpure virtual

Write value val to archive with identifier id.

Parameters
val[in] value to write.
id[in] identifier for the value.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [13/27]

virtual void doWrite ( const std::vector< bool > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [14/27]

virtual void doWrite ( const std::vector< boost::int8_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [15/27]

virtual void doWrite ( const std::vector< boost::uint8_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [16/27]

virtual void doWrite ( const std::vector< boost::int16_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [17/27]

virtual void doWrite ( const std::vector< boost::uint16_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [18/27]

virtual void doWrite ( const std::vector< boost::int32_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [19/27]

virtual void doWrite ( const std::vector< boost::uint32_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [20/27]

virtual void doWrite ( const std::vector< boost::int64_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [21/27]

virtual void doWrite ( const std::vector< boost::uint64_t > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [22/27]

virtual void doWrite ( const std::vector< float > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [23/27]

virtual void doWrite ( const std::vector< double > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [24/27]

virtual void doWrite ( const std::vector< std::string > &  val,
const std::string &  id 
)
protectedpure virtual

Write vector val to archive with identifier id.

Parameters
val[in] vector to write.
id[in] identifier for the vector.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [25/27]

virtual void doWrite ( const Eigen::MatrixXd &  val,
const std::string &  id 
)
protectedpure virtual

Write an Eigen matrix to output.

Parameters
val[in] the matrix to output.
id[in] identifier for the matrix.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [26/27]

virtual void doWrite ( const Eigen::VectorXd &  val,
const std::string &  id 
)
protectedpure virtual

Write an Eigen vector to output.

Parameters
val[in] the vector to output.
id[in] identifier for the matrix.

Implemented in INIArchive, and BINArchive.

◆ doWrite() [27/27]

void doWrite ( const T &  object,
const std::string &  id 
)
inlineprotected

handles serialization of an object. The object must either be a primitive type, inherit from Serializable or there must exist an overloaded method rw::common::serialization::write(const T& data, class OutputArchive& oarchive, const std::string& id)

Parameters
object[in] object to be serialized
id[in] potential id associated to the object

◆ doWriteEnterScope()

virtual void doWriteEnterScope ( const std::string &  id)
protectedpure virtual

Enter a scope.

Parameters
id[in] identifier for the scope.

Implemented in INIArchive, and BINArchive.

◆ doWriteLeaveScope()

virtual void doWriteLeaveScope ( const std::string &  id)
protectedpure virtual

Leave a scope.

Parameters
id[in] identifier for the scope.

Implemented in INIArchive, and BINArchive.

◆ write() [1/2]

void write ( const T &  object,
const std::string &  id 
)
inline

generic write method. This method will write any objects that are either derived from the rw::common::Serializable class or where overloaded read() write() methods exists.

Parameters
object
id

◆ write() [2/2]

void write ( const T &  object,
const std::string &  id,
const std::string &  id_default 
)
inline

Same as write(object,id) however an additional parameter is given which is the default identifier to use in case id is empty.

Parameters
object[in] object to serialize
id[in] identifier
id_default[in] default id

◆ writeEnterScope()

void writeEnterScope ( const std::string &  id,
const std::string &  idDefault = "" 
)
inline

create a serialized scope in which objects can be written

Parameters
id[in] id of the scope
idDefault[in] (optional) default id to use if id is an empty string.

◆ writeLeaveScope()

void writeLeaveScope ( const std::string &  id,
const std::string &  idDefault = "" 
)
inline

leave the current scope

Parameters
id[in] id of the scope
idDefault[in] (optional) default id to use if id is an empty string.

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