FemtoScan Online SDK Documentation
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
Entity | Type | Scope | Short Description |
~MessageType | destructor | public | Destructor.
|
MessageType | constructor | public | Default constructor.
|
MessageType | constructor | public | Copy constructor.
|
AddParameters | method | public | Adds parameters to message
|
FreeSendBuffer | static method | public | Free send buffer
|
GetData | method | public | Get additional data.
|
GetDataSize | method | public | Get additional data size.
|
GetMsg | method | public | Get message id.
|
GetParameter | method | public | Retrieve parameter.
|
GetParametersNumber | method | public | Get number of message parameters.
|
GetSendBuffer | method | public | Get string representation of message.
|
IsOk | method | public | Check message for validity.
|
operator = | operator | public | Copy assignment operator.
|
ReadFromString | method | public | Reads message contents from string.
|
Reuse | method | public | Clears current contents and prepares structure for new message
|
SetData | method | public | Set additional data.
|
destructor ~MessageType | ? ^
> |
Destructor.
- Source:
- ../fsio/MessageType.h:63
- Code:
-
constructor MessageType | ? ^
< > |
Default constructor.
- Source:
- ../fsio/MessageType.h:38
- Param:
- Code:
public MessageType ( | unsigned _msg = 0 ) |
constructor MessageType | ? ^
< > |
Copy constructor.
- Source:
- ../fsio/MessageType.h:44
- Param:
- 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 ) |
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 |
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 |
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 |
Copy assignment operator.
- Source:
- ../fsio/MessageType.h:58
- Param:
- 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 ) |
Clears current contents and prepares structure for new message
- Source:
- ../fsio/MessageType.h:69
- Param:
- Code:
public void Reuse ( | unsigned _msg ) |
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