open-dis-cpp
Public Member Functions | List of all members
DIS::PacketFactory Class Reference

responsible for mapping an ID value to a Pdu type. More...

#include <PacketFactory.h>

Public Member Functions

PduCreatePacket (unsigned char id)
 Create a Pdu. More...
 
void DestroyPacket (Pdu *pdu)
 Clean up the memory for the Pdu. More...
 
template<class T >
bool RegisterPacket (unsigned char id)
 Add support for creating the Pdu. More...
 
bool UnRegisterPacket (char id)
 Remove support for creating the Pdu. More...
 
bool IsRegistered (unsigned char id) const
 Check to know if the Pdu type is supported. More...
 

Detailed Description

responsible for mapping an ID value to a Pdu type.

Member Function Documentation

◆ CreatePacket()

Pdu * PacketFactory::CreatePacket ( unsigned char  id)

Create a Pdu.

Parameters
idthe value representing the "type" of the Pdu. The value will be stored in the 3rd position of the buffer, as defined by the DIS specification.
Returns
a dynamically allocated instance of a concrete Pdu. The value will be 'NULL' if no support for creating the concrete Pdu was registered.

◆ DestroyPacket()

void PacketFactory::DestroyPacket ( Pdu pdu)

Clean up the memory for the Pdu.

Parameters
pduThe packet to be deleted.

◆ IsRegistered()

bool PacketFactory::IsRegistered ( unsigned char  id) const

Check to know if the Pdu type is supported.

Parameters
idThe value representing the Pdu type.
Returns
'true' if support for creating a Pdu was found, 'false' if not found.

◆ RegisterPacket()

template<class T >
bool DIS::PacketFactory::RegisterPacket ( unsigned char  id)
inline

Add support for creating the Pdu.

Parameters
idThe value identifying the type of the Pdu.
Returns
'false' if a packet id was already registered for the Pdu type. 'true' if support was added.

◆ UnRegisterPacket()

bool DIS::PacketFactory::UnRegisterPacket ( char  id)
inline

Remove support for creating the Pdu.

Parameters
idThe value identifying the type of the Pdu.
Returns
'false' if no support previously existed. 'true' if support was removed.

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