|
VR-Engage
2.2
|
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 DtBaseMessage * | create (unsigned char *bytes, int length) |
| virtual DtBaseMessage * | create (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, Decoder > | DecoderMap |
Protected Attributes | |
| DecoderMap | myCreatorMap |
| bool | myIsBigEndian |
|
protected |
Type definition for the map of message types to decoder functions.
| makRadarFx::DtVreMessageFactory::DtVreMessageFactory | ( | bool | initializeDefaults = true, |
| bool | isBigEndian = false ) |
Constructor with initialization options.
| initializeDefaults | Whether to automatically register default message decoders |
| isBigEndian | Whether 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.
|
virtual |
Virtual destructor.
Cleans up factory resources
|
virtual |
Creates a message from encoded bytes.
| bytes | Pointer to the encoded byte array |
| length | Length of the encoded byte array |
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.
|
virtual |
Creates a message from encoded bytes with known message type.
| msgType | The type of message to create |
| bytes | Pointer to the encoded byte array |
| length | Length of the encoded byte array |
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.
|
virtual |
Registers a message decoder function.
| type | Message type identifier |
| decoder | Function 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.
|
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.
|
virtual |
Clears all registered decoders.
Removes all decoder registrations from the factory, effectively resetting it to an empty state.
|
protected |
Map of message types to their corresponding decoder functions.
|
protected |
Flag indicating if the encoded data is in big-endian format.