lmsg::TransOutput Class Reference
[DMT message facility]

#include <TransOutput.hh>

List of all members.

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>
TransOutputoperator<< (const T &x) throw (std::runtime_error)
 Copy a data item to the buffer.
TransOutputoperator<< (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)


Detailed Description

The TransOutput class is used Ligo DMT output message translation class translates output messages into the export format in a specified buffer.
Author:
John Zweizig
Version:
1.1; Last modified March 4, 2008

Constructor & Destructor Documentation

lmsg::TransOutput::TransOutput ( Buffer b  ) 

Constructor.

Construct an output translator for a specified output buffer.

Parameters:
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.


Member Function Documentation

void lmsg::TransOutput::align ( size_type  N  ) 

Align output pointer.

Increment the output pointer until it is aligned on a N-byte boundary.

Parameters:
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.

Parameters:
N Number of bytes required.
Returns:
True if at least N bytes are available in buffer.

bool lmsg::TransOutput::full ( void   )  const [inline]

Test full buffer.

Test whether buffer is full.

Returns:
True if no bytes are available in buffer.

void lmsg::TransOutput::setBuffer ( Buffer b  ) 

Set buffer pointer.

Set the output pointer and data length for the specified buffer.

Parameters:
b Reference to output buffer.

template<class T>
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.

Parameters:
x Data array to be written to buffer.
N Number of data items in array.
Returns:
Number of data items copied to buffer.

template<class T>
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.

Parameters:
x Reference to data item to be copied.
Returns:
Refernce to this output translator.
Exceptions:
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.

Parameters:
x Constant pointer to null-terminated string.
Returns:
Refernce to this output translator.
Exceptions:
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.

Returns:
Number of data bytes currently in the buffer.

template<>
size_type lmsg::TransOutput::write ( const char  x[],
size_type  N 
) [inline]

Specialize write template for char array.

template<>
size_type lmsg::TransOutput::write ( const MsgAddr  x[],
size_type  N 
) [inline]

Specialize write template for MsgAddr array.

template<>
size_type lmsg::TransOutput::write ( const std::string  x[],
size_type  N 
) [inline]

Specialize write template for string array.

template<>
size_type lmsg::TransOutput::write ( const Time  x[],
size_type  N 
) [inline]

Specialize write template for Time array.


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:36 2009 for dmt by  doxygen 1.5.4