tobicore
7.0.0
|
Utility class to handle data streams. More...
#include <tobiplatform/TPStreamer.hpp>
Public Member Functions | |
TPStreamer (void) | |
Constructor. | |
virtual | ~TPStreamer (void) |
Destructor. | |
virtual void | Append (std::string buffer) |
Appends a string to the streamer. | |
virtual void | Append (const char *buffer, size_t bsize) |
Appends a char array to the streamer. | |
virtual bool | Extract (std::string *buffer, std::string hdr, std::string trl, TPStreamerDirection direction=TPStreamer::Forward) |
Extracts a message from the streamer. | |
virtual bool | Has (std::string hdr, std::string trl, TPStreamerDirection direction=TPStreamer::Forward) |
Searches the streamer for a message. | |
virtual int | Count (std::string hdr) |
Count the number of messages given one header. | |
virtual void | Dump (void) |
Prints contents. | |
virtual int | Size (void) |
Returns size in bytes. | |
virtual void | Clear (void) |
Clears the streamer. |
Static Public Attributes | |
static const TPStreamerDirection | Forward = 0 |
Search forward (FIFO) | |
static const TPStreamerDirection | Reverse = 1 |
Search reverse (LIFO) |
Utility class to handle data streams.
This class is designed to allow an easy handling of the data streams received from a TCP connection (but not only). It allows to verify whether a certain message is present and to extract it automatically.
Definition at line 38 of file TPStreamer.hpp.
|
virtual |
Appends a string to the streamer.
Definition at line 33 of file TPStreamer.cpp.
|
virtual |
Appends a char array to the streamer.
Definition at line 39 of file TPStreamer.cpp.
|
virtual |
Count the number of messages given one header.
Definition at line 102 of file TPStreamer.cpp.
|
virtual |
Extracts a message from the streamer.
Searches for a message (given a direction, i.e. FIFO or LIFO) contained between an header and a trailer and extracts it.
Definition at line 45 of file TPStreamer.cpp.
|
virtual |
Searches the streamer for a message.
Searches for a message (given a direction, i.e. FIFO or LIFO) contained between an header and a trailer and extracts it.
Definition at line 93 of file TPStreamer.cpp.
|
virtual |