lmsg::Translator Class Reference
[DMT message facility]

Message data translator. More...

#include <Translator.hh>

List of all members.

Public Member Functions

 Translator (const char *fmt=0)
 Constructor.
 ~Translator (void)
 Destructor.
error_type Define (const char *fmt)
 Define the message format.
error_type Export (const void *in, size_type length, Buffer &b)
 Export structure to message.
error_type Import (const Buffer &b, void *out, size_type maxlen, size_type *len)
 Export structure to message.
void Reset (void)
 reset translator.
bool isHeaderOK (void) const
 test header OK.
bool isMultiBuffer (void) const
void setHeaderOK (bool yesno=true)
void setMultiBuffer (bool yesno=true)
void setKeepNames (bool yesno=true)
 Set keep name flag.


Detailed Description

Message data translator.

Translator is a table driven translator for the Ligo DMT message facility. The translation table is defined by a format string. Structures are translated to or from message buffers using the import and export methods. A single extended structure may be translated to/from multiple message by setting the multibuffer flag before translation.

Author:
John Zweizig
Version:
1.1; last modified March 4, 2008

Constructor & Destructor Documentation

lmsg::Translator::Translator ( const char *  fmt = 0  ) 

Constructor.

Construct a translator and optionally set the translation table from the format argument. The format is specified as described for the Define() method.

Parameters:
fmt Message data descriptor.

lmsg::Translator::~Translator ( void   ) 

Destructor.

Destroy a translator object.


Member Function Documentation

error_type lmsg::Translator::Define ( const char *  fmt  ) 

Define the message format.

Parse a description of the structure to be translated to or from a message. The structure is described by a null-terminated character string. The format characters are:
CodeData Type
A char
B char
D double
F float
I int
NI network int
NS network short
R MsgAddr
S short
UB unswapped byte
UI unswapped int
US unswapped short

Parameters:
fmt Structure format description.

error_type lmsg::Translator::Export ( const void *  in,
size_type  length,
Buffer b 
)

Export structure to message.

Copy and translate a structure to the specified message buffer.

Parameters:
in Pointer to structure to be translated
length Length of structure.
b Reference to output buffer.
Returns:
lmsg status return

error_type lmsg::Translator::Import ( const Buffer b,
void *  out,
size_type  maxlen,
size_type *  len 
)

Export structure to message.

Copy and translate a structure from the specified message buffer.

Parameters:
b Reference to constant input buffer.
out Pointer to structure to receive data.
maxlen Length of structure.
len Pointer to variable to receive length of copied data.
Returns:
lmsg stats return

void lmsg::Translator::Reset ( void   ) 

reset translator.

Reset status flags.

bool lmsg::Translator::isHeaderOK ( void   )  const [inline]

test header OK.

Test the Header OK flag.

bool lmsg::Translator::isMultiBuffer ( void   )  const [inline]

Test the multi-buffer flag.

void lmsg::Translator::setHeaderOK ( bool  yesno = true  )  [inline]

Set the header OK flag.

void lmsg::Translator::setMultiBuffer ( bool  yesno = true  )  [inline]

Set the multibuffer flag.

void lmsg::Translator::setKeepNames ( bool  yesno = true  )  [inline]

Set keep name flag.

Set the "keep variable names" flag. This uses more space, but allows formatted message dumps.

Parameters:
yesno New flag value.


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