Public Member Functions
rtc::BinaryInputHandler Class Reference

#include <rtcBinaryInputHandler.h>

Inheritance diagram for rtc::BinaryInputHandler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool binary () const
 returns if the data format is binary or ascii
 BinaryInputHandler ()
 default constructor
 BinaryInputHandler (std::istream &is)
 construct from istream
 BinaryInputHandler (const char *filename)
 construct from filename
virtual bool readName (const std::string &name)
 read the name of a name-data pair
virtual bool readSeparator ()
 read the separator of a name-data pair
virtual ~BinaryInputHandler ()
 destructor
virtual bool read (std::string &data)
virtual bool read (double &data)
virtual bool read (float &data)
virtual bool read (int &data)
virtual bool read (unsigned int &data)
virtual bool read (char &data)
virtual bool read (unsigned char &data)
virtual bool read (bool &data)
virtual bool read (long &data)
virtual bool read (unsigned long &data)
virtual bool read (short &data)
virtual bool read (unsigned short &data)
virtual bool read (char *data, long n)

Detailed Description

Binary input handler.

The BinaryInputHandler class offers an interface for the functor parameters and other classes to read() them in a binary format.

The advantage of the binary format is that the produced files are smaller, which at the same time implies shorter times to read or write the data.

The disadvange is that the produced files cannot be easily edited. If you need this, you should still use the rtc::XmlOutputHandler.

Warning:
Do not forget to open your streams in binary mode. If you create them as ASCII streams, the data can be corrupted.

Example:

 // the binary stream formatting object
 rtc::BinaryInputHandler bsh;

 // Read example

 // Open a stream in binary mode
 std::ifstream in("testfile.bin",std::ios_base::binary);

 bsh.use(in);
 int i;
 rtc::read(bsh,i);

 std::string str;
 rtc::read(bsh,str);

 in.close();

Definition at line 64 of file rtcBinaryInputHandler.h.


Constructor & Destructor Documentation

default constructor

Definition at line 30 of file rtcBinaryInputHandler.cpp.

construct from istream

Definition at line 36 of file rtcBinaryInputHandler.cpp.

rtc::BinaryInputHandler::BinaryInputHandler ( const char *  filename)

construct from filename

destructor

Definition at line 42 of file rtcBinaryInputHandler.cpp.


Member Function Documentation

bool rtc::BinaryInputHandler::binary ( ) const [virtual]

returns if the data format is binary or ascii

Implements rtc::InputHandler.

Definition at line 47 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( std::string &  data) [virtual]

read members for symbol-data pairs

Implements rtc::InputHandler.

Definition at line 64 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( double &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 76 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( float &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 82 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( int &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 88 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( unsigned int &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 94 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( char &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 100 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( unsigned char &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 106 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( bool &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 112 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( long &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 124 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( unsigned long &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 130 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( short &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 136 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( unsigned short &  data) [virtual]

Implements rtc::InputHandler.

Definition at line 142 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::read ( char *  data,
long  n 
) [virtual]

Implements rtc::InputHandler.

Definition at line 148 of file rtcBinaryInputHandler.cpp.

bool rtc::BinaryInputHandler::readName ( const std::string &  name) [virtual]

read the name of a name-data pair

Implements rtc::InputHandler.

Definition at line 53 of file rtcBinaryInputHandler.cpp.

read the separator of a name-data pair

read the seperator of a name-data pair

Implements rtc::InputHandler.

Definition at line 59 of file rtcBinaryInputHandler.cpp.


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


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:35