#include <rtcBinaryInputHandler.h>
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) |
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.
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.
default constructor
Definition at line 30 of file rtcBinaryInputHandler.cpp.
rtc::BinaryInputHandler::BinaryInputHandler | ( | std::istream & | is | ) |
construct from istream
Definition at line 36 of file rtcBinaryInputHandler.cpp.
rtc::BinaryInputHandler::BinaryInputHandler | ( | const char * | filename | ) |
construct from filename
rtc::BinaryInputHandler::~BinaryInputHandler | ( | ) | [virtual] |
destructor
Definition at line 42 of file rtcBinaryInputHandler.cpp.
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.
bool rtc::BinaryInputHandler::readSeparator | ( | ) | [virtual] |
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.