1 #ifndef _dcl_dis_packet_factory_h_ 5 #define _dcl_dis_packet_factory_h_ 8 #include <dis6/opendis6_export.h> 15 template<
class BaseT,
class DerivedT>
18 return new DerivedT();
29 Pdu* CreatePacket(
unsigned char id);
33 void DestroyPacket(
Pdu* pdu);
41 FunctionMap::value_type candidate(
id,&CreateImplementation<Pdu,T>);
42 std::pair<FunctionMap::iterator,bool> result = _fMap.insert( candidate );
51 return( _fMap.erase(
id )>0 );
57 bool IsRegistered(
unsigned char id)
const;
61 typedef Pdu* (*CREATE_FUNC)();
64 typedef std::map<unsigned char,CREATE_FUNC> FunctionMap;
71 #endif // _dcl_dis_packet_factory_h_ Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
responsible for mapping an ID value to a Pdu type.
Definition: PacketFactory.h:22
bool UnRegisterPacket(char id)
Remove support for creating the Pdu.
Definition: PacketFactory.h:49
bool RegisterPacket(unsigned char id)
Add support for creating the Pdu.
Definition: PacketFactory.h:39
BaseT * CreateImplementation()
a utility to make functions
Definition: PacketFactory.h:16