#include <rtcBinaryOutputHandler.h>
Public Member Functions | |
virtual bool | binary () const |
returns if the data format is binary or ascii | |
BinaryOutputHandler () | |
default constructor | |
BinaryOutputHandler (std::ostream &os) | |
construct from ostream | |
virtual bool | writeEOL () |
write the EOL symbol | |
virtual bool | writeName (const std::string &name) |
write the name of a name-data pair | |
virtual bool | writeSeparator () |
write the separator of a name-data pair | |
virtual | ~BinaryOutputHandler () |
destructor | |
virtual bool | write (const std::string &data) |
virtual bool | write (const double &data) |
virtual bool | write (const float &data) |
virtual bool | write (const int &data) |
virtual bool | write (const unsigned int &data) |
virtual bool | write (const char &data) |
virtual bool | write (const unsigned char &data) |
virtual bool | write (const bool &data) |
virtual bool | write (const long &data) |
virtual bool | write (const unsigned long &data) |
virtual bool | write (const short &data) |
virtual bool | write (const unsigned short &data) |
virtual bool | write (const char *data, long n) |
Binary output handler.
The BinaryOutputHandler class offers an interface for the functor parameters and other classes to write() 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 write or write the data.
The disadvantage 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::BinaryOutputHandler bsh; // Write example: // open a stream in binary mode std::ofstream out("testfile.bin",std::ios_base::binary); // tell the binary stream handler to use the given stream bsh.use(out); rtc::write(bsh,5); rtc::write(bsh,"hello world"); out.close();
Definition at line 64 of file rtcBinaryOutputHandler.h.
default constructor
Definition at line 29 of file rtcBinaryOutputHandler.cpp.
rtc::BinaryOutputHandler::BinaryOutputHandler | ( | std::ostream & | os | ) |
construct from ostream
Definition at line 35 of file rtcBinaryOutputHandler.cpp.
rtc::BinaryOutputHandler::~BinaryOutputHandler | ( | ) | [virtual] |
destructor
Definition at line 41 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::binary | ( | ) | const [virtual] |
returns if the data format is binary or ascii
Implements rtc::OutputHandler.
Definition at line 46 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const std::string & | data | ) | [virtual] |
write members for symbol-data pairs
Implements rtc::OutputHandler.
Definition at line 68 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const double & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 82 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const float & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 88 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const int & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 94 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const unsigned int & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 100 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const char & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 106 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const unsigned char & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 112 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const bool & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 118 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const long & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 127 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const unsigned long & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 133 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const short & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 139 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const unsigned short & | data | ) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 145 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::write | ( | const char * | data, |
long | n | ||
) | [virtual] |
Implements rtc::OutputHandler.
Definition at line 151 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::writeEOL | ( | ) | [virtual] |
write the EOL symbol
Implements rtc::OutputHandler.
Definition at line 63 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::writeName | ( | const std::string & | name | ) | [virtual] |
write the name of a name-data pair
Implements rtc::OutputHandler.
Definition at line 52 of file rtcBinaryOutputHandler.cpp.
bool rtc::BinaryOutputHandler::writeSeparator | ( | ) | [virtual] |
write the separator of a name-data pair
Implements rtc::OutputHandler.
Definition at line 57 of file rtcBinaryOutputHandler.cpp.