WSF
WsfMessageTable Class Reference

#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

Detailed Description

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).

Constructor & Destructor Documentation

◆ WsfMessageTable()

WsfMessageTable::WsfMessageTable ( )

Member Function Documentation

◆ Add()

void WsfMessageTable::Add ( WsfStringId aCommType,
WsfStringId aMessageType,
WsfStringId aMessageSubType,
int aMessageSize,
int aMessagePriority )

Adds an entry to the message table.

Parameters
aCommTypeThe string id of the comm type (0 represents the default comm type).
aMessageTypeThe string id of the message type (0 represents the default message type).
aMessageSubTypeThe string id of the message sub type (0 represents the default message sub type).
aMessageSizeThe message size in bits.
aMessagePriorityThe message priority.

◆ DefaultProp()

WsfMessageTable::MsgProp WsfMessageTable::DefaultProp ( ) const

Referenced by Find(), and RandomProp().

◆ Find()

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.

Parameters
aCommTypeThe string id of the comm type (0 represents the default comm type).
aMessageTypeThe string id of the message type (0 represents the default message type).
aMessageSubTypeThe string id of the message sub type (0 represents the default message sub type).
Returns
Returns the message property.

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().

◆ Initialize()

bool WsfMessageTable::Initialize ( )

◆ ProcessInput()

bool WsfMessageTable::ProcessInput ( UtInput & aInput)

Parses the message_table ... end_message_table syntax to build up a message table from an input stream.

Parameters
aInputThe input stream.
Returns
Returns true if the command was handled.

◆ RandomProp()

WsfMessageTable::MsgProp WsfMessageTable::RandomProp ( ut::Random & aRandom) const

References DefaultProp().

◆ Remove()

void WsfMessageTable::Remove ( WsfStringId aCommType,
WsfStringId aMessageType,
WsfStringId aMessageSubType )

Removes an entry from the message table.

Parameters
aCommTypeThe string id of the comm type (0 represents the default comm type).
aMessageTypeThe string id of the message type (0 represents the default message type).
aMessageSubTypeThe string id of the message sub type (0 represents the default message sub type).

◆ SetMessageProp()

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.

Parameters
aCommTypeThe specific comm type.
aMessageThe 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().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved