VR-Engage  2.2
Loading...
Searching...
No Matches
makRadarFx::DtVreMessageFactory Class Reference

Detailed Description

This class manages the creation of message objects from encoded byte arrays. It maintains a registry of message types and their corresponding decoder functions, allowing the system to dynamically create the appropriate message object based on the message type found in the encoded data.

#include <rfxMessageFactory.h>

Public Member Functions

 DtVreMessageFactory (bool initializeDefaults=true, bool isBigEndian=false)
 
virtual ~DtVreMessageFactory ()
 
virtual DtBaseMessagecreate (unsigned char *bytes, int length)
 
virtual DtBaseMessagecreate (int msgType, unsigned char *bytes, int length)
 
virtual void registerCreator (unsigned int type, Decoder decoder)
 
virtual void initializeDefaultMessages ()
 
virtual void clear ()
 

Protected Types

typedef std::map< unsigned int, DecoderDecoderMap
 

Protected Attributes

DecoderMap myCreatorMap
 
bool myIsBigEndian
 

Member Typedef Documentation

◆ DecoderMap

typedef std::map<unsigned int, Decoder> makRadarFx::DtVreMessageFactory::DecoderMap
protected

Type definition for the map of message types to decoder functions.

Constructor & Destructor Documentation

◆ DtVreMessageFactory()

makRadarFx::DtVreMessageFactory::DtVreMessageFactory ( bool initializeDefaults = true,
bool isBigEndian = false )

Constructor with initialization options.

Parameters
initializeDefaultsWhether to automatically register default message decoders
isBigEndianWhether the encoded data is in big-endian format

Creates a new message factory. If initializeDefaults is true, the factory will be automatically populated with decoders for all standard RadarFX messages.

◆ ~DtVreMessageFactory()

virtual makRadarFx::DtVreMessageFactory::~DtVreMessageFactory ( )
virtual

Virtual destructor.

Cleans up factory resources

Member Function Documentation

◆ create() [1/2]

virtual DtBaseMessage * makRadarFx::DtVreMessageFactory::create ( unsigned char * bytes,
int length )
virtual

Creates a message from encoded bytes.

Parameters
bytesPointer to the encoded byte array
lengthLength of the encoded byte array
Returns
Pointer to the newly created message instance, or nullptr on error

Decodes the message type from the byte array and creates the appropriate message object. Returns nullptr if there is no decoder registered for the message type or if decoding fails.

◆ create() [2/2]

virtual DtBaseMessage * makRadarFx::DtVreMessageFactory::create ( int msgType,
unsigned char * bytes,
int length )
virtual

Creates a message from encoded bytes with known message type.

Parameters
msgTypeThe type of message to create
bytesPointer to the encoded byte array
lengthLength of the encoded byte array
Returns
Pointer to the newly created message instance, or nullptr on error

Creates a message object for the specified message type. Returns nullptr if there is no decoder registered for the message type or if decoding fails.

◆ registerCreator()

virtual void makRadarFx::DtVreMessageFactory::registerCreator ( unsigned int type,
Decoder decoder )
virtual

Registers a message decoder function.

Parameters
typeMessage type identifier
decoderFunction pointer to the decoder function

Associates a message decoder function with a specific message type. The decoder will be used to create message objects of that type when decoding encoded data.

◆ initializeDefaultMessages()

virtual void makRadarFx::DtVreMessageFactory::initializeDefaultMessages ( )
virtual

Initializes the factory with decoders for standard message types.

Registers decoder functions for all the standard RadarFX message types. This is automatically called by the constructor if initializeDefaults is true.

◆ clear()

virtual void makRadarFx::DtVreMessageFactory::clear ( )
virtual

Clears all registered decoders.

Removes all decoder registrations from the factory, effectively resetting it to an empty state.

Member Data Documentation

◆ myCreatorMap

DecoderMap makRadarFx::DtVreMessageFactory::myCreatorMap
protected

Map of message types to their corresponding decoder functions.

◆ myIsBigEndian

bool makRadarFx::DtVreMessageFactory::myIsBigEndian
protected

Flag indicating if the encoded data is in big-endian format.


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