open-dis-cpp
IncomingMessage.h
1 
5 #ifndef _dcl_dis_incoming_message_
6 #define _dcl_dis_incoming_message_
7 
8 #include <dis6/utils/IBufferProcessor.h> // for base class
9 #include <dis6/utils/IPduBank.h>
10 #include <map> // for member
11 #include <dis6/utils/Endian.h> // for internal type
12 #include <dis6/opendis6_export.h> // for library symbols
13 #include <dis6/utils/PDUType.h>
14 
15 namespace DIS
16 {
17  class Pdu;
18  class IPacketProcessor;
19  class DataStream;
20 
22  class OPENDIS6_EXPORT IncomingMessage : public IBufferProcessor
23  {
24  public:
26  typedef std::multimap<unsigned char,IPacketProcessor*> PacketProcessorContainer;
27 
29  typedef std::multimap<unsigned char,IPduBank*> PduBankContainer;
30 
32  ~IncomingMessage();
33 
34  void Process(const char* buf, unsigned int size, Endian e);
35 
38  bool AddProcessor(unsigned char id, IPacketProcessor* pp);
39 
42  bool RemoveProcessor(unsigned char id, const IPacketProcessor* pp);
43 
46  bool AddPduBank(unsigned char pdu_type, IPduBank* pduBank);
47 
50  bool RemovePduBank(unsigned char pdu_type, const IPduBank* pduBank);
51 
52  PacketProcessorContainer& GetProcessors();
53  const PacketProcessorContainer& GetProcessors() const;
54 
55  PduBankContainer& GetPduBanks();
56  const PduBankContainer& GetPduBanks() const;
57 
58  private:
59  typedef std::pair<PacketProcessorContainer::iterator, PacketProcessorContainer::iterator> PacketProcessIteratorPair;
60  PacketProcessorContainer _processors;
61 
62  typedef std::pair<PduBankContainer::iterator, PduBankContainer::iterator> PduBankIteratorPair;
63  PduBankContainer _pduBanks;
64 
65  void SwitchOnType(DIS::PDUType pdu_type, DataStream& ds);
66 
68  bool FindProccessorContainer(unsigned char id, const IPacketProcessor* pp, PacketProcessorContainer::iterator &containerIter);
69 
71  bool FindPduBankContainer(unsigned char pdu_type, const IPduBank* pduBank, PduBankContainer::iterator &containerIter);
72  };
73 
74 }
75 
76 #endif // _dcl_dis_incoming_message_
77 
Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
houses instances for the set of known PDU classes to be returned when provided with the PDU type&#39;s id...
Definition: IPduBank.h:10
a class to support managing a network buffer.
Definition: DataStream.h:28
it is the responsibility of the processor to use the packet because it will be deleted after this cal...
Definition: IPacketProcessor.h:14
the interface class for handling read operations.
Definition: IBufferProcessor.h:13
std::multimap< unsigned char, IPduBank * > PduBankContainer
the container type for supporting PDU banks.
Definition: IncomingMessage.h:29
std::multimap< unsigned char, IPacketProcessor * > PacketProcessorContainer
the container type for supporting processors.
Definition: IncomingMessage.h:26
A framework for routing the packet to the correct processor.
Definition: IncomingMessage.h:22