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_None = 0x7FFFFFF0
79  };
80 
82  {
85  Dropped
86  };
87 
89  static DtPacket* create(DtSmartBuffer data, DtAbsoluteTime time,int type, int id=-1);
90 
92  static DtPacket* create(size_t size, DtAbsoluteTime time, int type, int id=-1);
93 
95  ~DtPacket();
96 
98  void operator delete(void* v,size_t t);
99 
101  bool operator <( const DtPacket& ) const;
102 
104 
105  char* data();
106  const char* data() const;
108 
110  FilterType filter() const;
111 
113  size_t size() const;
114 
116  const DtAbsoluteTime& time() const;
117 
119  int type() const;
120 
122  DtLgrEntityTracker::EntryHandle entityId() const;
123 
125  void setEntityId(DtLgrEntityTracker::EntryHandle id);
126 
128 
129  DtSmartBuffer& buffer();
130  const DtSmartBuffer& buffer() const;
132 
133  void setFilter(FilterType filter);
134  void setTime(DtAbsoluteTime time);
135  void setType(int type);
136 
139  void addAttribute(DtPacketAttributeSP);
140 
144  bool removeAttribute(int);
145 
148  DtPacketAttributeSP lookupAttribute(int);
149 
150  void convertTime(DtAbsoluteTime inputCurrentTime,
151  DtAbsoluteTime outputCurrentTime);
152 
155  static DtAbsoluteTime convertTime(
156  DtAbsoluteTime inputCurrentTime,
157  DtAbsoluteTime outputCurrentTime,
158  DtAbsoluteTime arrivalTime);
159 
160  protected:
161 
162  DtPacket(DtSmartBuffer data, DtAbsoluteTime time, int type, int id);
163 
165  DtPacket(size_t size, DtAbsoluteTime time, int type, int id);
166 
167  void* operator new(size_t t);
168 
171 
173 
175  int myType;
176 
180 
183 
185  std::list<DtPacketAttributeSP> myAttributes;
186 
187  private:
188 
190  //Internal memory allocation.
191 
193  static void deleteChunks();
194 
196  static DtMutex thePacketListMutex;
197  static std::vector<char*> theMemoryChunks;
198  static char* currentMemory;
199  static char* endMemory;
202  };
203 
204 }
205 
206 #endif

Document ID: Generated on Thu Apr 11 12:13:00 EDT 2013 from SVN revision 126011
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)