VR-Engage  2.2
Loading...
Searching...
No Matches
makRadarFx::DtBaseMessage Class Referenceabstract

Detailed Description

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>

Inheritance diagram for makRadarFx::DtBaseMessage:
[legend]

Public Member Functions

 DtBaseMessage ()
 
virtual ~DtBaseMessage ()
 
virtual unsigned int messageType () const
 
virtual unsigned char * encode ()
 
virtual int messageSize ()
 
virtual DtBaseMessageclone ()=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
 

Constructor & Destructor Documentation

◆ DtBaseMessage()

◆ ~DtBaseMessage()

virtual makRadarFx::DtBaseMessage::~DtBaseMessage ( )
virtual

Virtual destructor.

Ensures proper cleanup of derived message classes

Member Function Documentation

◆ messageType()

virtual unsigned int makRadarFx::DtBaseMessage::messageType ( ) const
virtual

Gets the message type identifier.

Returns
Numeric identifier for the message type

Returns the type identifier for this message, which is used for message routing and handling

◆ encode()

virtual unsigned char * makRadarFx::DtBaseMessage::encode ( )
virtual

Encodes the message into a byte array.

Returns
Pointer to the encoded 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.

◆ messageSize()

virtual int makRadarFx::DtBaseMessage::messageSize ( )
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

Returns
Size of the message in bytes when encoded

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.

◆ clone()

virtual DtBaseMessage * makRadarFx::DtBaseMessage::clone ( )
pure virtual

Creates a deep copy of this message.

Returns
Pointer to a new instance that is a 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().

◆ setRequestorId()

virtual void makRadarFx::DtBaseMessage::setRequestorId ( const std::string & requestor)
virtual

Sets the requester identifier for this message.

Parameters
requestorString 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.

◆ requestorId()

virtual std::string makRadarFx::DtBaseMessage::requestorId ( )
virtual

Gets the requester identifier for this message.

Returns
String identifier of the requester

Returns the identifier of the entity that sent this message

◆ setRequestId()

virtual void makRadarFx::DtBaseMessage::setRequestId ( int id)
virtual

Sets the request identifier for this message.

Parameters
idNumeric 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.

◆ requestId()

virtual int makRadarFx::DtBaseMessage::requestId ( )
virtual

Gets the request identifier for this message.

Returns
Numeric identifier of the request

Returns the unique identifier for this message request

◆ serialize()

virtual void makRadarFx::DtBaseMessage::serialize ( DtStreamWriter & writer)
protectedvirtual

◆ deserialize()

virtual void makRadarFx::DtBaseMessage::deserialize ( DtStreamReader & reader)
protectedvirtual

Member Data Documentation

◆ myMessageType

unsigned int makRadarFx::DtBaseMessage::myMessageType
protected

Message type identifier.

◆ myRequestorId

std::string makRadarFx::DtBaseMessage::myRequestorId
protected

Identifier of the message sender.

◆ myRequestId

int makRadarFx::DtBaseMessage::myRequestId
protected

Unique identifier for this request.


The documentation for this class was generated from the following file: