#include <TransOutput.hh>
Public Member Functions | |
| TransOutput (Buffer &b) | |
| Constructor. | |
| TransOutput (void) | |
| Default constructor. | |
| void | align (size_type N) |
| Align output pointer. | |
| bool | available (size_type N) const |
| Test available buffer space. | |
| bool | full (void) const |
| Test full buffer. | |
| void | setBuffer (Buffer &b) |
| Set buffer pointer. | |
| template<class T> | |
| size_type | write (const T x[], size_type N=1) |
| Write data array to buffer. | |
| template<class T> | |
| TransOutput & | operator<< (const T &x) throw (std::runtime_error) |
| Copy a data item to the buffer. | |
| TransOutput & | operator<< (const char *x) throw (std::runtime_error) |
| Write a character array. | |
| size_type | getNBytes (void) const throw () |
| template<> | |
| size_type | write (const char x[], size_type N) |
| template<> | |
| size_type | write (const MsgAddr x[], size_type N) |
| template<> | |
| size_type | write (const std::string x[], size_type N) |
| template<> | |
| size_type | write (const Time x[], size_type N) |
| lmsg::TransOutput::TransOutput | ( | Buffer & | b | ) |
Constructor.
Construct an output translator for a specified output buffer.
| b | Output buffer reference. |
| lmsg::TransOutput::TransOutput | ( | void | ) |
Default constructor.
Construct a null output translator. A buffer must be specified before it is used. Any use withh a null buffer pointer or a full buffer will result in a std::runtime_error exception.
| void lmsg::TransOutput::align | ( | size_type | N | ) |
Align output pointer.
Increment the output pointer until it is aligned on a N-byte boundary.
| N | Alignment multiple. |
| bool lmsg::TransOutput::available | ( | size_type | N | ) | const [inline] |
Test available buffer space.
Test whether the specified number of bytes can be fit into the buffer.
| N | Number of bytes required. |
| bool lmsg::TransOutput::full | ( | void | ) | const [inline] |
Test full buffer.
Test whether buffer is full.
| void lmsg::TransOutput::setBuffer | ( | Buffer & | b | ) |
Set buffer pointer.
Set the output pointer and data length for the specified buffer.
| b | Reference to output buffer. |
| size_type lmsg::TransOutput::write | ( | const T | x[], | |
| size_type | N = 1 | |||
| ) | [inline] |
Write data array to buffer.
Template method to write a data array of arbitrary type to the output buffer. Note that although this will generate code for an arbitrary data class, the word ordering will be wrong for many data classes. Classes for which the write method is explicitly defined correctly include MsgAddr, string and Time.
| x | Data array to be written to buffer. | |
| N | Number of data items in array. |
| TransOutput & lmsg::TransOutput::operator<< | ( | const T & | x | ) | throw (std::runtime_error) [inline] |
Copy a data item to the buffer.
Template class to translate and copy a single data item to the output buffer. This operator has the same limitations as the write() method.
| x | Reference to data item to be copied. |
| runtime_error | if the buffer is full or undefined. |
| TransOutput & lmsg::TransOutput::operator<< | ( | const char * | x | ) | throw (std::runtime_error) [inline] |
Write a character array.
Class to copy a null-terminated character array (string) to the output buffer. The string is stored as a 2-byte count field followed by the data characters.
| x | Constant pointer to null-terminated string. |
| runtime_error | if the buffer is full or undefined. |
| size_type lmsg::TransOutput::getNBytes | ( | void | ) | const throw () [inline] |
Get the number of bytes written to the buffer. This includes any alignment padding.
| size_type lmsg::TransOutput::write | ( | const char | x[], | |
| size_type | N | |||
| ) | [inline] |
Specialize write template for char array.
| size_type lmsg::TransOutput::write | ( | const MsgAddr | x[], | |
| size_type | N | |||
| ) | [inline] |
Specialize write template for MsgAddr array.
| size_type lmsg::TransOutput::write | ( | const std::string | x[], | |
| size_type | N | |||
| ) | [inline] |
Specialize write template for string array.
| size_type lmsg::TransOutput::write | ( | const Time | x[], | |
| size_type | N | |||
| ) | [inline] |
Specialize write template for Time array.
1.5.4