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

A framework for routing the packet to the correct processor. More...

#include <IncomingMessage.h>

Inheritance diagram for DIS::IncomingMessage:
Inheritance graph
[legend]
Collaboration diagram for DIS::IncomingMessage:
Collaboration graph
[legend]

Public Types

typedef std::multimap< unsigned char, IPacketProcessor * > PacketProcessorContainer
 the container type for supporting processors.
 
typedef std::multimap< unsigned char, IPduBank * > PduBankContainer
 the container type for supporting PDU banks.
 

Public Member Functions

void Process (const char *buf, unsigned int size, Endian e)
 
bool AddProcessor (unsigned char id, IPacketProcessor *pp)
 registers the ipp instance to process packets with the id More...
 
bool RemoveProcessor (unsigned char id, const IPacketProcessor *pp)
 unregisters the ipp instance for packets with the id. More...
 
bool AddPduBank (unsigned char pdu_type, IPduBank *pduBank)
 registers the PDU bank instance to provide the PDU object More...
 
bool RemovePduBank (unsigned char pdu_type, const IPduBank *pduBank)
 unregisters the PDU bank instance More...
 
PacketProcessorContainerGetProcessors ()
 
const PacketProcessorContainerGetProcessors () const
 
PduBankContainerGetPduBanks ()
 
const PduBankContainerGetPduBanks () const
 

Detailed Description

A framework for routing the packet to the correct processor.

Member Function Documentation

◆ AddPduBank()

bool IncomingMessage::AddPduBank ( unsigned char  pdu_type,
IPduBank pduBank 
)

registers the PDU bank instance to provide the PDU object

Returns
'true' if the pair of parameters were not found in the container and were addded. 'false' if the pair was found.

◆ AddProcessor()

bool IncomingMessage::AddProcessor ( unsigned char  id,
IPacketProcessor pp 
)

registers the ipp instance to process packets with the id

Returns
'true' if the pair of parameters were not found in the container and were addded. 'false' if the pair was found.

◆ RemovePduBank()

bool IncomingMessage::RemovePduBank ( unsigned char  id,
const IPduBank pduBank 
)

unregisters the PDU bank instance

Returns
'true' if the pair of parameters were found in the container and removed. 'false' if the pair was not found.
Todo:
add proper support for erasing from a multimap.
Warning
erases any PDU bank registered PDU type

◆ RemoveProcessor()

bool IncomingMessage::RemoveProcessor ( unsigned char  id,
const IPacketProcessor pp 
)

unregisters the ipp instance for packets with the id.

it does not clean up the delete the ipp.

Returns
'true' if the pair of parameters were found in the container and removed. 'false' if the pair was not found.
Todo:
add proper support for erasing from a multimap.
Warning
erases any processor registered for the id

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