VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
events.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
9 #include <vl/detonationInteraction.h>
10 #include <vl/fireInteraction.h>
11 #include <vl/dataInteraction.h>
13 #include <vl/signalInteraction.h>
16 #include <vrfmsgs/reportMessage.h>
17 #include <vl/commentInteraction.h>
18 #include <vl/acknowledgeInteraction.h>
19 #include <vl/startResumeInteraction.h>
20 #include <vl/stopFreezeInteraction.h>
21 #include <vl/serviceRequestInteraction.h>
22 #include <vl/resupplyCancelInteraction.h>
23 
24 #if DtHLA
28 #endif
29 
30 #if DtDIS
31 #include <vl/diGuyCustomPdu.h>
32 #endif
33 
34 #if DtHLA
36 {
37 public:
38 
44 
45  bool mySendReliable;
46 };
47 #endif
48 
50 {
51 public:
52  enum EventType
53  {
54  Unknown = 0,
55  DetonationEvent = 1,
56  FireEvent = 2,
57  SimInterfaceContentMessageEvent = 3,
58  DataInteractionEvent = 4,
59  SignalInteractionEvent = 5,
60 #if DtHLA
61  InfluenceInteractionEvent = 6,
62 #endif
63  SensorFieldOfViewControlEvent = 7,
64  CommentInteractionEvent = 8,
65  AcknowledgeInteractionEvent = 9,
66  StartResumeInteractionEvent = 10,
67  StopFreezeInteractionEvent = 11,
68  DIGuyActionEvent = 12,
69 #if DtHLA
70  DIGuyEndActionEvent = 13,
71 #endif
72  ServiceRequestEvent = 14,
73  ResupplyOfferEvent = 15,
74  ResupplyReceivedEvent = 16,
75  ResupplyCancelEvent = 17,
76  UserEvent = 1024
77  };
78 
79 public:
80  DtEvent() : myEventType(Unknown) {};
81  DtEvent(EventType t) : myEventType(t) {};
82  DtEvent(const DtEvent& orig) : myEventType(orig.myEventType) {};
83  virtual~ DtEvent() {};
84 
85  EventType eventType() const { return myEventType; };
86 
87  virtual void* contents() const = 0;
88  virtual DtEvent* clone() const = 0;
89 
90  virtual bool isNetworkEvent() const = 0;
91 
94  virtual bool processLocally() const { return true; };
95 
96 protected:
97  EventType myEventType;
98 };
99 
100 template <typename T>
101 class DtTypedEvent : public DtEvent
102 {
103 public:
106  DtTypedEvent(EventType t, const T& e) : DtEvent(t), myEvent(new T(e)) {};
107  DtTypedEvent(const DtTypedEvent& orig) : DtEvent(orig), myEvent(new T(*orig.myEvent)) {};
108  virtual ~DtTypedEvent()
109  {
110  delete myEvent;
111  }
112 
113  void* contents() const { return myEvent; };
114  bool isNetworkEvent() const { return true; };
115 
116  void setEvent(const T& ev) { delete myEvent; myEvent = new T(ev); };
117 
118  virtual DtEvent* clone() const { return new DtTypedEvent<T>(*this); };
119 
120 protected:
121  T* myEvent;
122 };
123 
124 #if DtHLA
125 class DT_DLL_vrfMsgTransport DtDataInteractionWithTransportEvent : public DtTypedEvent<DtDataInteractionWithTransportType>
126 {
127 public:
128  DtDataInteractionWithTransportEvent() : DtTypedEvent(DataInteractionEvent), myOverrideTimestampOrder(true) {};
129  DtDataInteractionWithTransportEvent(const DtDataInteractionWithTransportType& interaction, bool myOverrideTimestampOrder = true) : DtTypedEvent(DataInteractionEvent, interaction),
130  myOverrideTimestampOrder(myOverrideTimestampOrder) {};
132  DtTypedEvent<DtDataInteractionWithTransportType>(orig), myOverrideTimestampOrder(orig.myOverrideTimestampOrder) {};
133 
134  virtual DtEvent* clone() const { return new DtDataInteractionWithTransportEvent(*this); };
135 
136  bool myOverrideTimestampOrder;
137 };
138 #endif
140 {
141 public:
142  DtDataInteractionEvent() : DtTypedEvent(DataInteractionEvent) {};
143  DtDataInteractionEvent(const DtDataInteraction& interaction) : DtTypedEvent(DataInteractionEvent, interaction) {};
144 };
145 
146 
148 {
149 public:
150  DtSignalInteractionEvent() : DtTypedEvent(SignalInteractionEvent) {};
151  DtSignalInteractionEvent(const DtSignalInteraction& interaction) : DtTypedEvent(SignalInteractionEvent, interaction) {};
152 };
153 
154 
155 class DT_DLL_vrfMsgTransport DtDetonationEvent : public DtTypedEvent<DtDetonationInteraction>
156 {
157 public:
158  DtDetonationEvent() : DtTypedEvent(DetonationEvent) {};
159  DtDetonationEvent(const DtDetonationInteraction& interaction) : DtTypedEvent(DetonationEvent, interaction) {};
160 };
161 
162 class DT_DLL_vrfMsgTransport DtSensorFieldOfViewControlEvent : public DtTypedEvent<DtSensorFieldOfViewControlInter>
163 {
164 public:
165  DtSensorFieldOfViewControlEvent() : DtTypedEvent(SensorFieldOfViewControlEvent) {};
166  DtSensorFieldOfViewControlEvent(const DtSensorFieldOfViewControlInter& interaction) : DtTypedEvent(SensorFieldOfViewControlEvent, interaction) {};
167 };
168 
170 {
171 public:
172  DtCommentInteractionEvent() : DtTypedEvent(CommentInteractionEvent) {};
173  DtCommentInteractionEvent(const DtCommentInteraction& interaction) : DtTypedEvent(CommentInteractionEvent, interaction) {};
174 };
175 
176 #if DtHLA
178 {
179 public:
180  DtInfluenceInteractionEvent() : DtTypedEvent(InfluenceInteractionEvent) {};
181  DtInfluenceInteractionEvent(const DtInfluenceInteraction& interaction) : DtTypedEvent(InfluenceInteractionEvent, interaction) {};
182 };
183 
185 {
186 public:
187  DtDIGuyEndActionEvent() : DtTypedEvent(DIGuyEndActionEvent) {};
188  DtDIGuyEndActionEvent(const DtEndGestureInter& interaction) : DtTypedEvent(DIGuyEndActionEvent, interaction) {};
189 };
190 
191 class DT_DLL_vrfMsgTransport DtDIGuyActionEvent : public DtTypedEvent<DtExecuteGestureInter>
192 {
193 public:
194  DtDIGuyActionEvent() : DtTypedEvent(DIGuyEndActionEvent) {};
195  DtDIGuyActionEvent(const DtExecuteGestureInter& interaction) : DtTypedEvent(DIGuyEndActionEvent, interaction) {};
196 };
197 #else
198 
199 class DT_DLL_vrfMsgTransport DtDIGuyActionEvent : public DtTypedEvent<DtDIGuyCustomPdu>
200 {
201 public:
202  DtDIGuyActionEvent() : DtTypedEvent(DIGuyActionEvent) {};
203  DtDIGuyActionEvent(const DtDIGuyCustomPdu& interaction) : DtTypedEvent(DIGuyActionEvent, interaction) {};
204 };
205 #endif
206 
207 class DT_DLL_vrfMsgTransport DtFireEvent : public DtTypedEvent<DtFireInteraction>
208 {
209 public:
210  DtFireEvent() : DtTypedEvent(FireEvent) {};
211  DtFireEvent(const DtFireInteraction& interaction) : DtTypedEvent(FireEvent, interaction) {};
212 };
213 
214 class DT_DLL_vrfMsgTransport DtServiceRequestEvent : public DtTypedEvent<DtServiceRequestInteraction>
215 {
216 public:
217  DtServiceRequestEvent() : DtTypedEvent(ServiceRequestEvent) {};
218  DtServiceRequestEvent(const DtServiceRequestInteraction& interaction) : DtTypedEvent(ServiceRequestEvent, interaction) {};
219 };
220 
221 class DT_DLL_vrfMsgTransport DtResupplyOfferEvent : public DtTypedEvent<DtResupplyOfferInteraction>
222 {
223 public:
224  DtResupplyOfferEvent() : DtTypedEvent(ResupplyOfferEvent) {};
225  DtResupplyOfferEvent(const DtResupplyOfferInteraction& interaction) : DtTypedEvent(ResupplyOfferEvent, interaction) {};
226 };
227 
228 class DT_DLL_vrfMsgTransport DtResupplyReceivedEvent : public DtTypedEvent<DtResupplyRecInteraction>
229 {
230 public:
231  DtResupplyReceivedEvent() : DtTypedEvent(ResupplyReceivedEvent) {};
232  DtResupplyReceivedEvent(const DtResupplyRecInteraction& interaction) : DtTypedEvent(ResupplyReceivedEvent, interaction) {};
233 };
234 
235 class DT_DLL_vrfMsgTransport DtResupplyCancelEvent : public DtTypedEvent<DtResupplyCancelInteraction>
236 {
237 public:
238  DtResupplyCancelEvent() : DtTypedEvent(ResupplyCancelEvent) {};
239  DtResupplyCancelEvent(const DtResupplyCancelInteraction& interaction) : DtTypedEvent(ResupplyCancelEvent, interaction) {};
240 };
241 
242 class DT_DLL_vrfMsgTransport DtAcknowledgeInteractionEvent : public DtTypedEvent<DtAcknowledgeInteraction>
243 {
244 public:
245  DtAcknowledgeInteractionEvent() : DtTypedEvent(AcknowledgeInteractionEvent) {};
246  DtAcknowledgeInteractionEvent(const DtAcknowledgeInteraction& interaction) : DtTypedEvent(AcknowledgeInteractionEvent, interaction) {};
247  virtual bool processLocally() const { return false; };
248 };
249 
250 class DT_DLL_vrfMsgTransport DtStopFreezeInteractionEvent : public DtTypedEvent<DtStopFreezeInteraction>
251 {
252 public:
253  DtStopFreezeInteractionEvent() : DtTypedEvent(StopFreezeInteractionEvent) {};
254  DtStopFreezeInteractionEvent(const DtStopFreezeInteraction& interaction) : DtTypedEvent(StopFreezeInteractionEvent, interaction) {};
255 };
256 
257 class DT_DLL_vrfMsgTransport DtStartResumeInteractionEvent : public DtTypedEvent<DtStartResumeInteraction>
258 {
259 public:
260  DtStartResumeInteractionEvent() : DtTypedEvent(StartResumeInteractionEvent) {};
261  DtStartResumeInteractionEvent(const DtStartResumeInteraction& interaction) : DtTypedEvent(StartResumeInteractionEvent, interaction) {};
262 };
263 
264 template <typename T>
266 {
267 public:
270  DtTypedVrfMessageEvent(EventType t, const T& interaction) : DtEvent(t), myEvent(static_cast<T*>(interaction.clone())) {};
271  DtTypedVrfMessageEvent(const DtTypedVrfMessageEvent& orig) : DtEvent(orig), myEvent(static_cast<T*>(orig.myEvent->clone())) {};
273  {
274  delete myEvent;
275  }
276 
277  void* contents() const { return myEvent; };
278  bool isNetworkEvent() const { return true; };
279 
280  void setEvent(const T& ev) { delete myEvent; myEvent = static_cast<T*>(ev.clone()); };
281 
282  DtEvent* clone() const { return new DtTypedVrfMessageEvent<T>(*this); };
283 
284 protected:
285  T* myEvent;
286 };
287 
289 {
290 public:
291  DtSimInterfaceContentMessageEvent() : DtTypedVrfMessageEvent(SimInterfaceContentMessageEvent) {};
292  DtSimInterfaceContentMessageEvent(const DtSimInterfaceContent& interaction) : DtTypedVrfMessageEvent(SimInterfaceContentMessageEvent, interaction) {};
293 };
DtTypedEvent(EventType t, const T &e)
Definition: events.h:106
DtEvent(EventType t)
Definition: events.h:81
virtual DtEvent * clone() const
Definition: events.h:118
DtAcknowledgeInteractionEvent()
Definition: events.h:245
EventType eventType() const
Definition: events.h:85
Definition: events.h:35
DtInfluenceInteractionEvent(const DtInfluenceInteraction &interaction)
Definition: events.h:181
DtDataInteractionWithTransportType()
default constructor
Definition: events.h:40
DtFireEvent()
Definition: events.h:210
Definition: events.h:250
void setEvent(const T &ev)
Definition: events.h:280
DtFireEvent(const DtFireInteraction &interaction)
Definition: events.h:211
DtResupplyOfferEvent()
Definition: events.h:224
Instances of DtEndGestureInter are used to store state data for DIGuyInteraction.EndGesture interacti...
Definition: endGestureInterHLA.h:27
void * contents() const
Definition: events.h:277
DtInfluenceInteractionEvent()
Definition: events.h:180
DtTypedVrfMessageEvent(const DtTypedVrfMessageEvent &orig)
Definition: events.h:271
Definition: events.h:257
void setEvent(const T &ev)
Definition: events.h:116
bool isNetworkEvent() const
Definition: events.h:114
DtCommentInteractionEvent()
Definition: events.h:172
DtAcknowledgeInteractionEvent(const DtAcknowledgeInteraction &interaction)
Definition: events.h:246
Definition: events.h:139
DtTypedEvent()
Definition: events.h:104
Definition: events.h:288
DtDataInteractionWithTransportType(const DtDataInteractionWithTransportType &orig)
Definition: events.h:41
DtEvent(const DtEvent &orig)
Definition: events.h:82
DtStartResumeInteractionEvent()
Definition: events.h:260
DtStopFreezeInteractionEvent(const DtStopFreezeInteraction &interaction)
Definition: events.h:254
DtResupplyCancelEvent(const DtResupplyCancelInteraction &interaction)
Definition: events.h:239
DtDataInteractionWithTransportEvent()
Definition: events.h:128
DtDataInteractionWithTransportEvent(const DtDataInteractionWithTransportEvent &orig)
Definition: events.h:131
DtResupplyOfferEvent(const DtResupplyOfferInteraction &interaction)
Definition: events.h:225
DtResupplyReceivedEvent(const DtResupplyRecInteraction &interaction)
Definition: events.h:232
Contains the DtExecuteGestureInter class declaration.
DtTypedEvent(const DtTypedEvent &orig)
Definition: events.h:107
Definition: events.h:169
Definition: events.h:49
Definition: events.h:214
DtTypedVrfMessageEvent(EventType t)
Definition: events.h:269
Definition: events.h:101
DtDIGuyEndActionEvent()
Definition: events.h:187
DtDataInteractionWithTransportEvent(const DtDataInteractionWithTransportType &interaction, bool myOverrideTimestampOrder=true)
Definition: events.h:129
Definition: events.h:54
bool isNetworkEvent() const
Definition: events.h:278
Definition: events.h:191
DtResupplyReceivedEvent()
Definition: events.h:231
Contains the DtEndGestureInter class declaration.
DtStopFreezeInteractionEvent()
Definition: events.h:253
virtual bool processLocally() const
There are some events that, if sent over the network, don&#39;t want to be processed locally.
Definition: events.h:247
DtDIGuyActionEvent()
Definition: events.h:194
DtDataInteractionEvent(const DtDataInteraction &interaction)
Definition: events.h:143
DtTypedVrfMessageEvent(EventType t, const T &interaction)
Definition: events.h:270
EventType
Definition: events.h:52
DtDetonationPdu DtDetonationInteraction
Definition: DistributedSimulationDriver3A.h:14
virtual bool processLocally() const
There are some events that, if sent over the network, don&#39;t want to be processed locally.
Definition: events.h:94
DtDIGuyEndActionEvent(const DtEndGestureInter &interaction)
Definition: events.h:188
Definition: events.h:235
DtDIGuyActionEvent(const DtExecuteGestureInter &interaction)
Definition: events.h:195
DtResupplyCancelEvent()
Definition: events.h:238
Definition: events.h:242
Definition: events.h:147
DtServiceRequestEvent(const DtServiceRequestInteraction &interaction)
Definition: events.h:218
T * myEvent
Definition: events.h:282
Definition: events.h:155
Definition: events.h:184
DtServiceRequestEvent()
Definition: events.h:217
DtEvent()
Definition: events.h:80
Definition: events.h:228
DtEvent * clone() const
Definition: events.h:282
Definition: events.h:207
Instances of DtSensorFieldOfViewControlInter are used to store state data for SensorFieldOfViewContro...
Definition: sensorFieldOfViewControlInterDIS.h:51
Instances of DtExecuteGestureInter are used to store state data for DIGuyInteraction.ExecuteGesture interactions.
Definition: executeGestureInterHLA.h:27
Instances of DtInfluenceInter are used to store state data for Influence interactions.
Definition: influenceInteractionHLA.h:27
DtSignalInteractionEvent(const DtSignalInteraction &interaction)
Definition: events.h:151
DtSensorFieldOfViewControlEvent(const DtSensorFieldOfViewControlInter &interaction)
Definition: events.h:166
Contains Extended DI-Guy Object net types.
#define DT_DLL_vrfMsgTransport
This file is used to determine how to build.
Definition: vrfMsgTransportDefines.h:28
virtual ~DtTypedVrfMessageEvent()
Definition: events.h:272
Definition: events.h:221
DtSensorFieldOfViewControlEvent()
Definition: events.h:165
void * contents() const
Definition: events.h:113
virtual ~DtDataInteractionWithTransportType()
destructor
Definition: events.h:43
virtual ~DtTypedEvent()
Definition: events.h:108
Definition: simInterfaceContent.h:45
DtSimInterfaceContentMessageEvent()
Definition: events.h:291
Definition: events.h:125
DtDetonationEvent(const DtDetonationInteraction &interaction)
Definition: events.h:159
This file provides a protocol independant include file for the class DtSensorFieldOfViewControlInterI...
Definition: events.h:265
DtDataInteractionEvent()
Definition: events.h:142
DtCommentInteractionEvent(const DtCommentInteraction &interaction)
Definition: events.h:173
bool mySendReliable
Definition: events.h:43
DtDetonationEvent()
Definition: events.h:158
T * myEvent
Definition: events.h:118
Definition: events.h:177
DtSimInterfaceContentMessageEvent(const DtSimInterfaceContent &interaction)
Definition: events.h:292
DtStartResumeInteractionEvent(const DtStartResumeInteraction &interaction)
Definition: events.h:261
DtSignalInteractionEvent()
Definition: events.h:150
DtTypedEvent(EventType t)
Definition: events.h:105
DtTypedVrfMessageEvent()
Definition: events.h:268
Definition: events.h:162

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)