#include <Translator.hh>
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. | |
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.
| lmsg::Translator::Translator | ( | const char * | fmt = 0 |
) |
| lmsg::Translator::~Translator | ( | void | ) |
Destructor.
Destroy a translator object.
| 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:
| Code | Data 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 |
| 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.
| in | Pointer to structure to be translated | |
| length | Length of structure. | |
| b | Reference to output buffer. |
| 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.
| 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. |
| 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.
| yesno | New flag value. |
1.5.4