MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
packet.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #ifndef packet_H_
10 #define packet_H_
11 
12 #include <lgrCore/lgrCore.h>
13 #include <list>
14 #include <vector>
15 
16 #include <lgrUtil/smartBuffer.h>
17 #include <lgrUtil/absoluteTime.h>
19 
20 #include <vlutil/vlMutex.h>
21 
22 namespace MAKLogger
23 {
28  {
29  public:
30  DtPacketAttribute(int handle);
31  virtual ~DtPacketAttribute();
32  inline int handle() const { return myHandle; }
33 
34  protected:
35  int myHandle;
36  };
37 
38  typedef DtBoost::shared_ptr<DtPacketAttribute> DtPacketAttributeSP;
39 
43  {
44  public:
45 
49  {
50  Type_Interaction = 0,
51  Type_Update = 1,
52  Type_Removal = 2,
53  Type_Annotation = 3,
54  Type_Pdu = 4,
55  Type_Fom = 5,
56  Type_Audio = 6,
57  Type_Checkpoint = 7,
58  Type_IndexTable = 8,
59  Type_MultiTSUpdates = 9,
60 
61 
62 
63 
64  Type_RecordingData = 11,
65  Type_SimulationData = 12,
66 
67  Type_EntityTable = 13,
68  Type_ConfigData = 14,
69 
71  Type_UpdateDDM = 15,
72  Type_InteractionDDM = 16,
73 
74  Type_TapeTimeDate = 17,
75  Type_Pause = 18,
76  Type_Unpause = 19,
77 
78  Type_TapeDescription = 20,
79 
80  Type_StartEndTime = 21,
81 
82  Type_None = 0x7FFFFFF0
83  };
84 
86  {
89  Dropped
90  };
91 
93  static DtPacket* create(DtSmartBuffer data, DtAbsoluteTime time,int type, int id=-1);
94 
96  static DtPacket* create(size_t size, DtAbsoluteTime time, int type, int id=-1);
97 
99  ~DtPacket();
100 
102  void operator delete(void* v,size_t t);
103 
105  bool operator <( const DtPacket& ) const;
106 
108 
109  char* data();
110  const char* data() const;
112 
114  FilterType filter() const;
115 
117  size_t size() const;
118 
120  const DtAbsoluteTime& time() const;
121 
123  int type() const;
124 
126  DtLgrEntityTracker::EntryHandle entityTrackingId() const;
127 
129  void setEntityTrackingId(DtLgrEntityTracker::EntryHandle id);
130 
132 
133  DtSmartBuffer& buffer();
134  const DtSmartBuffer& buffer() const;
136 
137  void setFilter(FilterType filter);
138  void setTime(DtAbsoluteTime time);
139  void setType(int type);
140 
143  void addAttribute(DtPacketAttributeSP);
144 
148  bool removeAttribute(int);
149 
152  DtPacketAttributeSP lookupAttribute(int);
153 
154  void convertTime(DtAbsoluteTime inputCurrentTime,
155  DtAbsoluteTime outputCurrentTime);
156 
157  public:
158 
161  static DtAbsoluteTime convertTime(
162  DtAbsoluteTime inputCurrentTime,
163  DtAbsoluteTime outputCurrentTime,
164  DtAbsoluteTime arrivalTime);
165 
167  static const char* typeToString(DtPacketType packetType);
168 
169  protected:
170 
171  DtPacket(DtSmartBuffer data, DtAbsoluteTime time, int type, int id);
172 
174  DtPacket(size_t size, DtAbsoluteTime time, int type, int id);
175 
176  void* operator new(size_t t);
177 
180 
182 
184  int myType;
185 
189 
192 
194  std::list<DtPacketAttributeSP> myAttributes;
195 
196  private:
197 
199  //Internal memory allocation.
200 
202  static void deleteChunks();
203 
205  static DtMutex thePacketListMutex;
206  static std::vector<char*> theMemoryChunks;
207  static char* currentMemory;
208  static char* endMemory;
211  };
212 
213 }
214 
215 #endif

Document ID: Generated on Thu Apr 7 20:50:59 EDT 2016 from SVN revision 163818
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)