FemtoScan Online SDK Documentation

Home :: FsOnlineSDK :: fsio classes

class MessageType

? ^ 
Message storage implementation.

Provides storage for message parameters. Provides interface for message manipulation.

The message itself has id, optional parameters and optional additional data. Each parameter is a 32-bit integer number. Additional data is a raw chunk of bytes.

Message in it's text representation has the following form:
 SPM 0x<msg>,<size>[[;<parameter>] ...]\n<additional data>
 
where SPM is the message signature, 0x<msg> is message code in hexadecimal form, <size> is additional data size, following after newline character (\n) in raw binary format, <parameter> are optional 32-bit integer values in signed decimal form, delimited with ";"
Source:
../fsio/MessageType.h:23
Author:
ATC
Version:
1.0

Contents

^ 
EntityTypeScopeShort Description
~MessageTypedestructor public Destructor.
MessageTypeconstructor public Default constructor.
MessageTypeconstructor public Copy constructor.
AddParametersmethod public Adds parameters to message
FreeSendBufferstatic method public Free send buffer
GetDatamethod public Get additional data.
GetDataSizemethod public Get additional data size.
GetMsgmethod public Get message id.
GetParametermethod public Retrieve parameter.
GetParametersNumbermethod public Get number of message parameters.
GetSendBuffermethod public Get string representation of message.
IsOkmethod public Check message for validity.
operator =operator public Copy assignment operator.
ReadFromStringmethod public Reads message contents from string.
Reusemethod public Clears current contents and prepares structure for new message
SetDatamethod public Set additional data.

destructor ~MessageType

? ^  > 
Destructor.
Source:
../fsio/MessageType.h:63
Code:
public ~ MessageType ( )

constructor MessageType

? ^  < > 
Default constructor.
Source:
../fsio/MessageType.h:38
Param:
_msg message id.
Code:
public MessageType ( unsigned _msg = 0 )

constructor MessageType

? ^  < > 
Copy constructor.
Source:
../fsio/MessageType.h:44
Param:
M message to copy.
Code:
public MessageType ( const MessageType & M )

method AddParameters

? ^  < > 
Adds parameters to message
Source:
../fsio/MessageType.h:88
Params:
n_lp number of parameters to add
... parameters itself
Code:
public void AddParameters ( unsigned n_lp ,
... )

static method FreeSendBuffer

? ^  < > 
Free send buffer
Source:
../fsio/MessageType.h:146
Param:
buffer pointer to the memory previously returned by GetSendBuffer .
Code:
public static void FreeSendBuffer ( char * buffer )

method GetData

? ^  < > 
Get additional data.
Source:
../fsio/MessageType.h:117
Params:
_data_size size of buffer
_data data buffer
Returns:
if _data is NULL, additional data size returned. If _data is not NULL, number of bytes copyed returned.
Code:
public size_t GetData ( size_t _data_size ,
void * _data ) const

method GetDataSize

? ^  < > 
Get additional data size.
Source:
../fsio/MessageType.h:123
Returns:
additional size.
Code:
public size_t GetDataSize ( ) const

method GetMsg

? ^  < > 
Get message id.
Source:
../fsio/MessageType.h:108
Returns:
message id
Code:
public unsigned GetMsg ( ) const

method GetParameter

? ^  < > 
Retrieve parameter.
Source:
../fsio/MessageType.h:102
Param:
n_lp one-based parameter number
Returns:
parameter value or 0 if n_lp is out of range
Code:
public int GetParameter ( unsigned n_lp ) const

method GetParametersNumber

? ^  < > 
Get number of message parameters.
Source:
../fsio/MessageType.h:129
Returns:
number of message parameters.
Code:
public unsigned GetParametersNumber ( ) const

method GetSendBuffer

? ^  < > 
Get string representation of message.

This function in conjunction with ReadFromString intended for use in serial data exchange.

Source:
../fsio/MessageType.h:139
Param:
bufsize pointer to the variable, in wich string length will be stored
Returns:
pointer to the memory location, containig the string representation of message. This memory should be freed with FreeSendBuffer when no more needed.
Code:
public char * GetSendBuffer ( size_t * bufsize ) const

method IsOk

? ^  < > 
Check message for validity.

Used generally after calling ReadFromString

Source:
../fsio/MessageType.h:51
Returns:
true if the message has all it's components filled properly.
Code:
public bool IsOk ( ) const

operator =

? ^  < > 
Copy assignment operator.
Source:
../fsio/MessageType.h:58
Param:
M the message to copy.
Returns:
this.
Code:
public MessageType & operator = ( const MessageType & M )

method ReadFromString

? ^  < > 
Reads message contents from string.

This function in conjunction with GetSendBuffer intended for use in serial data exchange. When new line arrives, it should be parsed with it. The result of operation should be checked with IsOk function.

Source:
../fsio/MessageType.h:81
Param:
strmsg the string to parse.
Returns:
number of successfully parsed characters.
Code:
public size_t ReadFromString ( const char * strmsg )

method Reuse

? ^  < > 
Clears current contents and prepares structure for new message
Source:
../fsio/MessageType.h:69
Param:
_msg new message id.
Code:
public void Reuse ( unsigned _msg )

method SetData

? ^  < > 
Set additional data.
Source:
../fsio/MessageType.h:95
Params:
_data_size size of data
_data the data to set
Code:
public void SetData ( size_t _data_size ,
const void * _data )

(C) Advanced Technologies Center, 2002-2006
For support contact us at fsdev@nanoscopy.net