MAK Data Logger API Documentation for HLA
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.h"
13 #include <list>
14 #include <vector>
15 
16 #include "smartBuffer.h"
17 #include "absoluteTime.h"
18 #include "lgrEntityTracker.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_None = 0x7FFFFFF0
81  };
82 
84  {
87  Dropped
88  };
89 
91  static DtPacket* create(DtSmartBuffer data, DtAbsoluteTime time,int type, int id=-1);
92 
94  static DtPacket* create(size_t size, DtAbsoluteTime time, int type, int id=-1);
95 
97  ~DtPacket();
98 
100  void operator delete(void* v,size_t t);
101 
103  bool operator <( const DtPacket& ) const;
104 
106 
107  char* data();
108  const char* data() const;
110 
112  FilterType filter() const;
113 
115  size_t size() const;
116 
118  const DtAbsoluteTime& time() const;
119 
121  int type() const;
122 
124  DtLgrEntityTracker::EntryHandle entityTrackingId() const;
125 
127  void setEntityTrackingId(DtLgrEntityTracker::EntryHandle id);
128 
130 
131  DtSmartBuffer& buffer();
132  const DtSmartBuffer& buffer() const;
134 
135  void setFilter(FilterType filter);
136  void setTime(DtAbsoluteTime time);
137  void setType(int type);
138 
141  void addAttribute(DtPacketAttributeSP);
142 
146  bool removeAttribute(int);
147 
150  DtPacketAttributeSP lookupAttribute(int);
151 
152  void convertTime(DtAbsoluteTime inputCurrentTime,
153  DtAbsoluteTime outputCurrentTime);
154 
157  static DtAbsoluteTime convertTime(
158  DtAbsoluteTime inputCurrentTime,
159  DtAbsoluteTime outputCurrentTime,
160  DtAbsoluteTime arrivalTime);
161 
162  protected:
163 
164  DtPacket(DtSmartBuffer data, DtAbsoluteTime time, int type, int id);
165 
167  DtPacket(size_t size, DtAbsoluteTime time, int type, int id);
168 
169  void* operator new(size_t t);
170 
173 
175 
177  int myType;
178 
182 
185 
187  std::list<DtPacketAttributeSP> myAttributes;
188 
189  private:
190 
192  //Internal memory allocation.
193 
195  static void deleteChunks();
196 
198  static DtMutex thePacketListMutex;
199  static std::vector<char*> theMemoryChunks;
200  static char* currentMemory;
201  static char* endMemory;
204  };
205 
206 }
207 
208 #endif

Document ID: Generated on Thu Apr 10 18:53:01 EDT 2014 from SVN revision 138105
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)