|
VR-Engage
2.2
|
This abstract base class defines the interface and common functionality for all messages exchanged between RadarFX clients and servers. It provides serialization/deserialization capabilities and handles message identification through types, request IDs, and requester identification.
All derived message classes must implement the clone() method and may override the serialize() and deserialize() methods to add custom data fields.
#include <rfxMessage.h>
Public Member Functions | |
| DtBaseMessage () | |
| virtual | ~DtBaseMessage () |
| virtual unsigned int | messageType () const |
| virtual unsigned char * | encode () |
| virtual int | messageSize () |
| virtual DtBaseMessage * | clone ()=0 |
| virtual void | setRequestorId (const std::string &requestor) |
| virtual std::string | requestorId () |
| virtual void | setRequestId (int id) |
| virtual int | requestId () |
Protected Member Functions | |
| virtual void | serialize (DtStreamWriter &writer) |
| virtual void | deserialize (DtStreamReader &reader) |
Protected Attributes | |
| unsigned int | myMessageType |
| std::string | myRequestorId |
| int | myRequestId |
| makRadarFx::DtBaseMessage::DtBaseMessage | ( | ) |
Default constructor.
Initializes a new message with default values for message type, requester ID, and request ID
Referenced by clone(), makRadarFx::DtElevationRequest::clone(), makRadarFx::DtElevationResponse::clone(), makRadarFx::DtEntityListRequest::clone(), makRadarFx::DtEntityListResponse::clone(), makRadarFx::DtEntityLocationRequest::clone(), makRadarFx::DtEntityLocationResponse::clone(), makRadarFx::DtHeartbeatMessage::clone(), makRadarFx::DtOcclusionRequest::clone(), makRadarFx::DtOcclusionResponse::clone(), makRadarFx::DtSensorListRequest::clone(), makRadarFx::DtSensorListResponse::clone(), makRadarFx::DtElevationRequest::decode(), makRadarFx::DtElevationResponse::decode(), makRadarFx::DtEntityListRequest::decode(), makRadarFx::DtEntityListResponse::decode(), makRadarFx::DtEntityLocationRequest::decode(), makRadarFx::DtEntityLocationResponse::decode(), makRadarFx::DtHeartbeatMessage::decode(), makRadarFx::DtOcclusionRequest::decode(), makRadarFx::DtOcclusionResponse::decode(), makRadarFx::DtSensorListRequest::decode(), and makRadarFx::DtSensorListResponse::decode().
|
virtual |
Virtual destructor.
Ensures proper cleanup of derived message classes
|
virtual |
Gets the message type identifier.
Returns the type identifier for this message, which is used for message routing and handling
|
virtual |
Encodes the message into a byte array.
Converts the message into a byte array suitable for network transmission. The caller is responsible for calling delete[] on the returned byte array when it is no longer needed.
|
virtual |
Decoding function prototype for derived classes.
Each derived message class should implement a static decode function: static DtDerivedMessage* decode(unsigned char* buffer, int length);
This function creates a new message instance from the encoded byte array
Gets the size of the encoded message in bytes
Calculates the total size required to encode this message
Reimplemented in makRadarFx::DtElevationRequest, makRadarFx::DtElevationResponse, makRadarFx::DtEntityListRequest, makRadarFx::DtEntityListResponse, makRadarFx::DtEntityLocationRequest, makRadarFx::DtEntityLocationResponse, makRadarFx::DtHeartbeatMessage, makRadarFx::DtIsarRequest, makRadarFx::DtIsarResponse, makRadarFx::DtMmwRequest, makRadarFx::DtMmwResponse, makRadarFx::DtOcclusionRequest, makRadarFx::DtOcclusionResponse, makRadarFx::DtSarRequest, makRadarFx::DtSarResponse, makRadarFx::DtSensorListRequest, and makRadarFx::DtSensorListResponse.
|
pure virtual |
Creates a deep copy of this message.
Creates a new message instance that is an exact copy of this message. The caller is responsible for managing the memory of the returned object. This is a pure virtual method that must be implemented by all derived classes.
Implemented in makRadarFx::DtElevationRequest, makRadarFx::DtElevationResponse, makRadarFx::DtEntityListRequest, makRadarFx::DtEntityListResponse, makRadarFx::DtEntityLocationRequest, makRadarFx::DtEntityLocationResponse, makRadarFx::DtHeartbeatMessage, makRadarFx::DtIsarRequest, makRadarFx::DtIsarResponse, makRadarFx::DtMmwRequest, makRadarFx::DtMmwResponse, makRadarFx::DtOcclusionRequest, makRadarFx::DtOcclusionResponse, makRadarFx::DtSarRequest, makRadarFx::DtSarResponse, makRadarFx::DtSensorListRequest, and makRadarFx::DtSensorListResponse.
References DtBaseMessage().
|
virtual |
Sets the requester identifier for this message.
| requestor | String identifier for the requester |
Sets the identifier of the entity sending this message. If left empty, the DtRadarFxConnector will automatically assign a requester ID when the message is sent using its requesterName() method.
|
virtual |
Gets the requester identifier for this message.
Returns the identifier of the entity that sent this message
|
virtual |
Sets the request identifier for this message.
| id | Numeric identifier for the request |
Sets a unique identifier for this message request. If left at 0 (default), the DtRadarFxConnector will automatically assign a request ID when the message is sent using its nextId() method.
|
virtual |
Gets the request identifier for this message.
Returns the unique identifier for this message request
|
protectedvirtual |
Serializes the message data to a stream writer.
| writer | Reference to the stream writer to write the data to |
Writes the message data to the provided stream writer. Derived classes should call the base class implementation before adding their own fields.
Reimplemented in makRadarFx::DtElevationRequest, makRadarFx::DtElevationResponse, makRadarFx::DtEntityListRequest, makRadarFx::DtEntityListResponse, makRadarFx::DtEntityLocationRequest, makRadarFx::DtEntityLocationResponse, makRadarFx::DtHeartbeatMessage, makRadarFx::DtIsarRequest, makRadarFx::DtIsarResponse, makRadarFx::DtMmwRequest, makRadarFx::DtMmwResponse, makRadarFx::DtOcclusionRequest, makRadarFx::DtOcclusionResponse, makRadarFx::DtSarRequest, makRadarFx::DtSarResponse, makRadarFx::DtSensorListRequest, and makRadarFx::DtSensorListResponse.
|
protectedvirtual |
Deserializes message data from a stream reader.
| reader | Reference to the stream reader to read the data from |
Reads the message data from the provided stream reader. Derived classes should call the base class implementation before reading their own fields.
Reimplemented in makRadarFx::DtElevationRequest, makRadarFx::DtElevationResponse, makRadarFx::DtEntityListRequest, makRadarFx::DtEntityListResponse, makRadarFx::DtEntityLocationRequest, makRadarFx::DtEntityLocationResponse, makRadarFx::DtHeartbeatMessage, makRadarFx::DtIsarRequest, makRadarFx::DtIsarResponse, makRadarFx::DtMmwRequest, makRadarFx::DtMmwResponse, makRadarFx::DtOcclusionRequest, makRadarFx::DtOcclusionResponse, makRadarFx::DtSarRequest, makRadarFx::DtSarResponse, makRadarFx::DtSensorListRequest, and makRadarFx::DtSensorListResponse.
|
protected |
Message type identifier.
|
protected |
Identifier of the message sender.
|
protected |
Unique identifier for this request.