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-2024 MAK Technologies, Inc
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 
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  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  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 
std::list< DtPacketAttributeSP > myAttributes
Attribute list, initially NULL.
Definition: packet.h:215
DtSmartBuffer myData
Pointer to packet data.
Definition: packet.h:212
int handle() const
Definition: packet.h:31
Contains MAKLogger::DtSmartBuffer class.
FilterType myFilterCondition
The filter condition of a packet Initially DtUnfiltered.
Definition: packet.h:209
DtAbsoluteTime myTime
The time of the packet (typically the arrival time)
Definition: packet.h:194
static char * endMemory
Deallocate the chunks of data used.
Definition: packet.h:229
int myHandle
Definition: packet.h:34
DtLgrEntityTracker::EntryHandle myEntityTrackingId
Definition: packet.h:202
DtPacketType
MIGRATION Info Same values as LtPacketKind in Logger 3.x versions.
Definition: packet.h:47
Abstract Attribute class that can be specialized upon for specific Attributes.
Definition: packet.h:26
static DtMutex thePacketListMutex
Deallocate the chunks of data used.
Definition: packet.h:226
static char * currentMemory
Deallocate the chunks of data used.
Definition: packet.h:228
Contains MAKLogger::DtLgrEntityTracker class.
bool myIsFromPast
Indicates whether packet is from before tape start (idle listening)
Definition: packet.h:197
Contains MAKLogger::DtAbsoluteTime and MAKLogger::DtRelativeTime classes.
A generic packed of typed binary data.
Definition: packet.h:41
A smart buffer has a shared pointer to the memory buffer and an offset and size of a &#39;smart&#39; sub buff...
Definition: smartBuffer.h:21
int myType
The type of packet.
Definition: packet.h:205
#define DT_DLL_LGRCORE
Definition: lgrCore.h:19
static DtPacket * theFirstPacket
Deallocate the chunks of data used.
Definition: packet.h:225
int EntryHandle
Definition: lgrEntityTracker.h:37
FilterType
Definition: packet.h:85
static std::vector< char * > theMemoryChunks
Deallocate the chunks of data used.
Definition: packet.h:227
DtBoost::shared_ptr< DtPacketAttribute > DtPacketAttributeSP
Definition: packet.h:37
bool myIsStateUpdate
Indicates whether packet an update from state messages.
Definition: packet.h:200
Definition: packet.h:88
Absolute Time, a particular measured instance in time, could be thought of as a set of relative times...
Definition: absoluteTime.h:82
Contains lgrCore library definitions.
DtPacket * next
Deallocate the chunks of data used.
Definition: packet.h:230
Definition: packet.h:87

Document ID: Generated on Fri May 31 15:45:35 EDT 2024 from SVN revision 266500
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)