|
WSF
|
#include <WsfMessageTable.hpp>
Classes | |
| struct | MsgProp |
Public Member Functions | |
| WsfMessageTable () | |
| bool | ProcessInput (UtInput &aInput) |
| bool | Initialize () |
| void | Add (WsfStringId aCommType, WsfStringId aMessageType, WsfStringId aMessageSubType, int aMessageSize, int aMessagePriority) |
| void | Remove (WsfStringId aCommType, WsfStringId aMessageType, WsfStringId aMessageSubType) |
| MsgProp | Find (WsfStringId aCommType, WsfStringId aMessageType, WsfStringId aMessageSubType=nullptr) const |
| MsgProp | DefaultProp () const |
| MsgProp | RandomProp (ut::Random &aRandom) const |
| void | SetMessageProp (WsfStringId aCommType, WsfMessage &aMessage) const |
WsfMessageTable is a singleton class that maintains default properties of a message type relative to a specific comm type. For example, we can make an entry for a comm device named RADIO_TRANSCEIVER and configure the default size of various message types that it will send.
message_table comm_type RADIO_TRANSCEIVER type MY_MESSAGE_1 128 kb priority 5 subtype MY_SUBTYPE_A 256 kb priority 6 subtype MY_SUBTYPE_B 1024 kb type MY_MESSAGE_2 1024 bits default 1 byte
default_comm_type default 128 bits end_message_table
To configure default message properties for multiple comm types, simply repeat the comm_type statement. In addition, there is a default_comm_type statement that allows you to configure default message properties without specifying a comm type (see default_comm_type above).
| WsfMessageTable::WsfMessageTable | ( | ) |
| void WsfMessageTable::Add | ( | WsfStringId | aCommType, |
| WsfStringId | aMessageType, | ||
| WsfStringId | aMessageSubType, | ||
| int | aMessageSize, | ||
| int | aMessagePriority ) |
Adds an entry to the message table.
| aCommType | The string id of the comm type (0 represents the default comm type). |
| aMessageType | The string id of the message type (0 represents the default message type). |
| aMessageSubType | The string id of the message sub type (0 represents the default message sub type). |
| aMessageSize | The message size in bits. |
| aMessagePriority | The message priority. |
| WsfMessageTable::MsgProp WsfMessageTable::DefaultProp | ( | ) | const |
Referenced by Find(), and RandomProp().
| WsfMessageTable::MsgProp WsfMessageTable::Find | ( | WsfStringId | aCommType, |
| WsfStringId | aMessageType, | ||
| WsfStringId | aMessageSubType = nullptr ) const |
Finds the message property for the specified comm type/message type/message sub-type.
| aCommType | The string id of the comm type (0 represents the default comm type). |
| aMessageType | The string id of the message type (0 represents the default message type). |
| aMessageSubType | The string id of the message sub type (0 represents the default message sub type). |
For example,
If you want the global default message size you would call: int size = Find(0, 0, 0);
If you want the default message size for a specific message type you would call: int size = Find(0, "WSF_COMM_MESSAGE", 0);
If you want the default message size for a specific message type relative to a specific comm type, you would call:
int size = Find("COMM_TYPE", "WSF_COMM_MESSAGE", 0);
References DefaultProp().
Referenced by SetMessageProp().
| bool WsfMessageTable::Initialize | ( | ) |
| bool WsfMessageTable::ProcessInput | ( | UtInput & | aInput | ) |
Parses the message_table ... end_message_table syntax to build up a message table from an input stream.
| aInput | The input stream. |
| WsfMessageTable::MsgProp WsfMessageTable::RandomProp | ( | ut::Random & | aRandom | ) | const |
References DefaultProp().
| void WsfMessageTable::Remove | ( | WsfStringId | aCommType, |
| WsfStringId | aMessageType, | ||
| WsfStringId | aMessageSubType ) |
Removes an entry from the message table.
| aCommType | The string id of the comm type (0 represents the default comm type). |
| aMessageType | The string id of the message type (0 represents the default message type). |
| aMessageSubType | The string id of the message sub type (0 represents the default message sub type). |
| void WsfMessageTable::SetMessageProp | ( | WsfStringId | aCommType, |
| WsfMessage & | aMessage ) const |
A static convenience method that sets a message's properties based on entries made in the message table. The message's properties are only set if they are currently 0.
| aCommType | The specific comm type. |
| aMessage | The message whose properties will be set. |
References Find(), WsfMessage::GetPriority(), WsfMessage::GetSizeBits(), WsfMessage::GetSubType(), WsfMessage::GetType(), WsfMessageTable::MsgProp::mPriority, WsfMessageTable::MsgProp::mSize, WsfMessage::SetPriority(), and WsfMessage::SetSizeBits().
Referenced by wsf::comm::Comm::SendSetup().