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

PduFactory turns byte buffers in IEEE-1278.1 (DIS) format into C++ language objects. More...

#include <PduFactory.h>

Public Member Functions

PducreatePdu (const char *data)
 Returns a PDU of the appropriate concrete subclass. More...
 

Detailed Description

PduFactory turns byte buffers in IEEE-1278.1 (DIS) format into C++ language objects.

For example, if you read a datagram packet and extract a payload, and that payload is in DIS format, you can hand it off to this class and get back an EntityStatePdu, FirePdu, or whatever.

Author
DMcG

Member Function Documentation

◆ createPdu()

Pdu * PduFactory::createPdu ( const char *  data)

Returns a PDU of the appropriate concrete subclass.

Converts data read from the wire–a byte array–to a DIS PDU language object.

Returns NULL for failures or unrecognized PDU types.

A new PDU is created for every data buffer. The consumer of this object is responsible for freeing it. The PDUs can be up to MTU in size; in some fairly rare instances, mostly involving multiple PDUs in a single datagram packet, PDUs may be larger than this and this will fail horribly. If the PDU type is unrecognized, or cannot be unmarshalled, the method returns NULL. The caller should check for this.


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