MAK Data Logger API Documentation for DIS
 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-2016 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <lgrCore/lgrCore.h>
12 #include <list>
13 #include <vector>
14 
15 #include <lgrUtil/smartBuffer.h>
16 #include <lgrUtil/absoluteTime.h>
18 
19 #include <vlutil/vlMutex.h>
20 
21 namespace MAKLogger
22 {
27  {
28  public:
29  DtPacketAttribute(int handle);
30  virtual ~DtPacketAttribute();
31  inline int handle() const { return myHandle; }
32 
33  protected:
34  int myHandle;
35  };
36 
37  typedef DtBoost::shared_ptr<DtPacketAttribute> DtPacketAttributeSP;
38 
42  {
43  public:
44 
48  {
49  Type_Interaction = 0,
50  Type_Update = 1,
51  Type_Removal = 2,
52  Type_Annotation = 3,
53  Type_Pdu = 4,
54  Type_Fom = 5,
55  Type_Audio = 6,
56  Type_Checkpoint = 7,
57  Type_IndexTable = 8,
58  Type_MultiTSUpdates = 9,
59 
60 
61 
62 
63  Type_RecordingData = 11,
64  Type_SimulationData = 12,
65 
66  Type_EntityTable = 13,
67  Type_ConfigData = 14,
68 
70  Type_UpdateDDM = 15,
71  Type_InteractionDDM = 16,
72 
73  Type_TapeTimeDate = 17,
74  Type_Pause = 18,
75  Type_Unpause = 19,
76 
77  Type_TapeDescription = 20,
78 
79  Type_StartEndTime = 21,
80  Type_InitialState = 22,
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 
124  bool isFromPast() const;
125  void setIsFromPast(bool val);
127 
129 
130  bool isStateUpdate() const;
131  void setIsStateUpdate(bool val);
133 
135  int type() const;
136 
138  const char* typeString() const;
139 
141  DtLgrEntityTracker::EntryHandle entityTrackingId() const;
142 
144  void setEntityTrackingId(DtLgrEntityTracker::EntryHandle id);
145 
147 
148  DtSmartBuffer& buffer();
149  const DtSmartBuffer& buffer() const;
151 
152  void setFilter(FilterType filter);
153  void setTime(DtAbsoluteTime time);
154  void setType(int type);
155 
158  void addAttribute(DtPacketAttributeSP);
159 
163  bool removeAttribute(int);
164 
167  DtPacketAttributeSP lookupAttribute(int);
168 
169  void convertTime(DtAbsoluteTime inputCurrentTime,
170  DtAbsoluteTime outputCurrentTime);
171 
172  public:
173 
176  static DtAbsoluteTime convertTime(
177  DtAbsoluteTime inputCurrentTime,
178  DtAbsoluteTime outputCurrentTime,
179  DtAbsoluteTime arrivalTime);
180 
182  static const char* typeToString(DtPacketType packetType);
183 
184  protected:
185 
186  DtPacket(DtSmartBuffer data, DtAbsoluteTime time, int type, int id);
187 
189  DtPacket(size_t size, DtAbsoluteTime time, int type, int id);
190 
191  void* operator new(size_t t);
192 
195 
198 
201 
203 
205  int myType;
206 
210 
213 
215  std::list<DtPacketAttributeSP> myAttributes;
216 
217  private:
218 
220  //Internal memory allocation.
221 
223  static void deleteChunks();
224 
226  static DtMutex thePacketListMutex;
227  static std::vector<char*> theMemoryChunks;
228  static char* currentMemory;
229  static char* endMemory;
232  };
233 
234 }
235 

Document ID: Generated on Thu Jul 23 15:05:27 EDT 2020 from SVN revision 215371
Copyright © 2020 MAK Technologies. All Rights Reserved (www.mak.com)