VR-Link API Documentation for DIS
vrlFedAmb13.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 
7 #ifndef DtVrlFederateAmbassador_H_
8 #define DtVrlFederateAmbassador_H_
9 
13 
14 #if DtHLA
15 #if !DtHLA_1516
16 
17 
18 
19 #include "callbacks.h"
20 
21 #include <RTI.hh>
22 #include "nullFedAmb13.h"
23 #include <list>
24 
25 typedef void (*DtSynchPointCb)(
26  const char* label,
27  void* usr);
28 
29 typedef void (*DtAnnounceSynchPointCb)(
30  const char* label,
31  const char* tag,
32  void* usr);
33 
34 class DT_DLL_VL DtInteractionManager;
35 class DT_DLL_VL DtHlaObjectManager;
36 
37 class DT_DLL_VL DtVrlFederateAmbassador : public DtNullFederateAmbassador
38 {
39  struct DtScopeChangeCallbackData
40  {
41  DtVrlFederateAmbassador* fedAmb;
42  RTI::ObjectHandle handle;
43  };
44 
45 public:
47  DtVrlFederateAmbassador();
48 
50  virtual ~DtVrlFederateAmbassador()
51  throw( RTI::FederateInternalError );
52 
53 protected:
55  DtVrlFederateAmbassador( const DtVrlFederateAmbassador& src );
56 
58  DtVrlFederateAmbassador& operator=(const DtVrlFederateAmbassador& src );
59 
60 public:
63  virtual void init( DtExerciseConn* exConn,
64  DtHlaObjectManager* hlaObjMgr,
65  DtInteractionManager* interMgr );
66 
67 public:
69  static DtVrlFederateAmbassador* create();
70 
71 public:
74  virtual void addReflectAttributeValuesCb( RTI::ObjectHandle id,
75  DtReflectAttributeValuesCb cb, void* usr );
76  virtual void removeReflectAttributeValuesCb( RTI::ObjectHandle id,
77  DtReflectAttributeValuesCb cb, void* usr );
78 
81  virtual void addDiscoverObjectCb( RTI::ObjectClassHandle hand,
82  DtDiscoverObjectCb cb, void* usr );
83  virtual void removeDiscoverObjectCb( RTI::ObjectClassHandle hand,
84  DtDiscoverObjectCb cb, void* usr );
85 
88  virtual void addRemoveObjectCb( RTI::ObjectHandle id,
89  DtRemoveObjectCb cb, void* usr );
90  virtual void removeRemoveObjectCb( RTI::ObjectHandle id,
91  DtRemoveObjectCb cb, void* usr );
92 
95  virtual void addStartRegCb( RTI::ObjectClassHandle hand,
96  DtStartRegCb cb, void* usr );
97  virtual void removeStartRegCb( RTI::ObjectClassHandle hand,
98  DtStartRegCb cb, void* usr );
99 
102  virtual void addStopRegCb( RTI::ObjectClassHandle hand,
103  DtStopRegCb cb, void* usr );
104  virtual void removeStopRegCb( RTI::ObjectClassHandle hand,
105  DtStopRegCb cb, void* usr );
106 
109  virtual void addUpdatesOnCb( RTI::ObjectHandle hand,
110  DtUpdatesOnCb cb, void* usr );
111  virtual void removeUpdatesOnCb( RTI::ObjectHandle hand,
112  DtUpdatesOnCb cb, void* usr );
113 
116  virtual void addUpdatesOffCb( RTI::ObjectHandle hand,
117  DtUpdatesOffCb cb, void* usr );
118  virtual void removeUpdatesOffCb( RTI::ObjectHandle hand,
119  DtUpdatesOffCb cb, void* usr );
120 
123  virtual void addStartInteractionsCb( RTI::InteractionClassHandle hand,
124  DtStartStopInterCb cb, void* usr );
125  virtual void removeStartInteractionsCb( RTI::InteractionClassHandle hand,
126  DtStartStopInterCb cb, void* usr );
127 
130  virtual void addStopInteractionsCb( RTI::InteractionClassHandle hand,
131  DtStartStopInterCb cb, void* usr );
132  virtual void removeStopInteractionsCb( RTI::InteractionClassHandle hand,
133  DtStartStopInterCb cb, void* usr );
134 
137  virtual void addReceiveInteractionCb( RTI::InteractionClassHandle hand,
138  DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
139  virtual void removeReceiveInteractionCb( RTI::InteractionClassHandle hand,
140  DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
141 
144  virtual void addTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
145  virtual void removeTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
146 
149  virtual void addTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
150  virtual void removeTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
151 
154  virtual void addTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
155  virtual void removeTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
156 
157  virtual void setRemoveObjectOnAttOutOfScope(bool remove);
158  virtual bool removeObjectOnAttOutOfScope() const;
159 
160 
161 public:
166 
168  virtual void timeAdvanceGrant( const RTI::FedTime& theTime )
169  throw( RTI::InvalidFederationTime,
170  RTI::TimeAdvanceWasNotInProgress,
171  RTI::FederateInternalError );
172 
173  virtual void timeRegulationEnabled( const RTI::FedTime& theTime )
174  throw( RTI::InvalidFederationTime,
175  RTI::EnableTimeRegulationWasNotPending,
176  RTI::FederateInternalError );
177 
178  virtual void timeConstrainedEnabled( const RTI::FedTime& theTime )
179  throw( RTI::InvalidFederationTime,
180  RTI::EnableTimeConstrainedWasNotPending,
181  RTI::FederateInternalError );
182 
183  virtual void startRegistrationForObjectClass(
184  RTI::ObjectClassHandle theClass )
185  throw( RTI::ObjectClassNotPublished,
186  RTI::FederateInternalError );
187 
188  virtual void stopRegistrationForObjectClass(
189  RTI::ObjectClassHandle theClass )
190  throw( RTI::ObjectClassNotPublished,
191  RTI::FederateInternalError );
192 
193  virtual void turnInteractionsOn(
194  RTI::InteractionClassHandle theHandle )
195  throw( RTI::InteractionClassNotPublished,
196  RTI::FederateInternalError );
197 
198  virtual void turnInteractionsOff(
199  RTI::InteractionClassHandle theHandle )
200  throw( RTI::InteractionClassNotPublished,
201  RTI::FederateInternalError );
202 
203  virtual void discoverObjectInstance(
204  RTI::ObjectHandle theObject,
205  RTI::ObjectClassHandle theObjectClass,
206  const char* theObjectName )
207  throw( RTI::CouldNotDiscover,
208  RTI::ObjectClassNotKnown,
209  RTI::FederateInternalError );
210 
211  virtual void reflectAttributeValues(
212  RTI::ObjectHandle theObject,
213  const RTI::AttributeHandleValuePairSet& theAttributes,
214  const RTI::FedTime& theTime,
215  const char* theTag,
216  RTI::EventRetractionHandle theHandle )
217  throw( RTI::ObjectNotKnown,
218  RTI::AttributeNotKnown,
219  RTI::FederateOwnsAttributes,
220  RTI::InvalidFederationTime,
221  RTI::FederateInternalError );
222 
223  virtual void reflectAttributeValues(
224  RTI::ObjectHandle theObject,
225  const RTI::AttributeHandleValuePairSet& theAttributes,
226  const char* theTag )
227  throw( RTI::ObjectNotKnown,
228  RTI::AttributeNotKnown,
229  RTI::FederateOwnsAttributes,
230  RTI::FederateInternalError);
231 
232  virtual void receiveInteraction(
233  RTI::InteractionClassHandle theInteraction,
234  const RTI::ParameterHandleValuePairSet& theParameters,
235  const RTI::FedTime& theTime,
236  const char* theTag,
237  RTI::EventRetractionHandle theHandle )
238  throw( RTI::InteractionClassNotKnown,
239  RTI::InteractionParameterNotKnown,
240  RTI::InvalidFederationTime,
241  RTI::FederateInternalError );
242 
243  virtual void receiveInteraction(
244  RTI::InteractionClassHandle theInteraction,
245  const RTI::ParameterHandleValuePairSet& theParameters,
246  const char* theTag )
247  throw( RTI::InteractionClassNotKnown,
248  RTI::InteractionParameterNotKnown,
249  RTI::FederateInternalError );
250 
251  virtual void removeObjectInstance(
252  RTI::ObjectHandle theObject,
253  const RTI::FedTime& theTime,
254  const char* theTag,
255  RTI::EventRetractionHandle theHandle )
256  throw( RTI::ObjectNotKnown,
257  RTI::InvalidFederationTime,
258  RTI::FederateInternalError );
259 
260  virtual void removeObjectInstance(
261  RTI::ObjectHandle theObject,
262  const char* theTag )
263  throw( RTI::ObjectNotKnown,
264  RTI::FederateInternalError );
265 
266  virtual void attributesInScope (
267  RTI::ObjectHandle theObject,
268  const RTI::AttributeHandleSet& theAttributes)
269  throw ( RTI::ObjectNotKnown,
270  RTI::AttributeNotKnown,
271  RTI::FederateInternalError);
272 
273  virtual void attributesOutOfScope (
274  RTI::ObjectHandle theObject,
275  const RTI::AttributeHandleSet& theAttributes)
276  throw ( RTI::ObjectNotKnown,
277  RTI::AttributeNotKnown,
278  RTI::FederateInternalError);
279 
280 
281  virtual void provideAttributeValueUpdate(
282  RTI::ObjectHandle theObject,
283  const RTI::AttributeHandleSet& theAttributes )
284  throw( RTI::ObjectNotKnown,
285  RTI::AttributeNotKnown,
286  RTI::AttributeNotOwned,
287  RTI::FederateInternalError );
288 
289  virtual void turnUpdatesOnForObjectInstance(
290  RTI::ObjectHandle theObject,
291  const RTI::AttributeHandleSet& theAttributes )
292  throw( RTI::ObjectNotKnown,
293  RTI::AttributeNotOwned,
294  RTI::FederateInternalError );
295 
296  virtual void turnUpdatesOffForObjectInstance(
297  RTI::ObjectHandle theObject,
298  const RTI::AttributeHandleSet& theAttributes )
299  throw( RTI::ObjectNotKnown,
300  RTI::AttributeNotOwned,
301  RTI::FederateInternalError );
302 
304  virtual void requestAttributeOwnershipAssumption(
305  RTI::ObjectHandle theObject,
306  const RTI::AttributeHandleSet& offeredAttributes,
307  const char* theTag )
308  throw( RTI::ObjectNotKnown,
309  RTI::AttributeNotKnown,
310  RTI::AttributeAlreadyOwned,
311  RTI::AttributeNotPublished,
312  RTI::FederateInternalError );
313 
314  virtual void attributeOwnershipDivestitureNotification(
315  RTI::ObjectHandle theObject,
316  const RTI::AttributeHandleSet& releasedAttributes )
317  throw( RTI::ObjectNotKnown,
318  RTI::AttributeNotKnown,
319  RTI::AttributeNotOwned,
320  RTI::AttributeDivestitureWasNotRequested,
321  RTI::FederateInternalError );
322 
323  virtual void attributeOwnershipAcquisitionNotification(
324  RTI::ObjectHandle theObject,
325  const RTI::AttributeHandleSet& securedAttributes )
326  throw( RTI::ObjectNotKnown,
327  RTI::AttributeNotKnown,
328  RTI::AttributeAcquisitionWasNotRequested,
329  RTI::AttributeAlreadyOwned,
330  RTI::AttributeNotPublished,
331  RTI::FederateInternalError );
332 
333  virtual void attributeOwnershipUnavailable(
334  RTI::ObjectHandle theObject,
335  const RTI::AttributeHandleSet& theAttributes )
336  throw( RTI::ObjectNotKnown,
337  RTI::AttributeNotKnown,
338  RTI::AttributeAlreadyOwned,
339  RTI::AttributeAcquisitionWasNotRequested,
340  RTI::FederateInternalError );
341 
342  virtual void requestAttributeOwnershipRelease(
343  RTI::ObjectHandle theObject,
344  const RTI::AttributeHandleSet& candidateAttributes,
345  const char* theTag )
346  throw( RTI::ObjectNotKnown,
347  RTI::AttributeNotKnown,
348  RTI::AttributeNotOwned,
349  RTI::FederateInternalError );
350 
351  virtual void confirmAttributeOwnershipAcquisitionCancellation(
352  RTI::ObjectHandle theObject,
353  const RTI::AttributeHandleSet& theAttributes )
354  throw( RTI::ObjectNotKnown,
355  RTI::AttributeNotKnown,
356  RTI::AttributeAlreadyOwned,
357  RTI::AttributeAcquisitionWasNotCanceled,
358  RTI::FederateInternalError );
359 
360  virtual void informAttributeOwnership(
361  RTI::ObjectHandle theObject,
362  RTI::AttributeHandle theAttribute,
363  RTI::FederateHandle theOwner )
364  throw( RTI::ObjectNotKnown,
365  RTI::AttributeNotKnown,
366  RTI::FederateInternalError );
367 
368  virtual void attributeIsNotOwned(
369  RTI::ObjectHandle theObject,
370  RTI::AttributeHandle theAttribute )
371  throw( RTI::ObjectNotKnown,
372  RTI::AttributeNotKnown,
373  RTI::FederateInternalError );
374 
375  virtual void attributeOwnedByRTI(
376  RTI::ObjectHandle theObject,
377  RTI::AttributeHandle theAttribute )
378  throw( RTI::ObjectNotKnown,
379  RTI::AttributeNotKnown,
380  RTI::FederateInternalError);
381 
383  virtual void synchronizationPointRegistrationSucceeded( const char* label )
384  throw( RTI::FederateInternalError );
385 
386  virtual void synchronizationPointRegistrationFailed( const char* label )
387  throw( RTI::FederateInternalError );
388 
389  virtual void federationSynchronized( const char* label )
390  throw( RTI::FederateInternalError );
391 
392  virtual void announceSynchronizationPoint(
393  const char* label, const char* tag )
394  throw( RTI::FederateInternalError );
395 
397  virtual void addSynchPointRegSucceededCb(const DtString& label,
398  DtSynchPointCb func, void* usr);
399  virtual void addSynchPointRegSucceededCb(DtSynchPointCb func,
400  void* usr);
401 
402  virtual void removeSynchPointRegSucceededCb(const DtString& label,
403  DtSynchPointCb func, void* usr);
404  virtual void removeSynchPointRegSucceededCb(DtSynchPointCb func,
405  void* usr);
406 
407  virtual void addSynchPointRegFailedCb(const DtString& label,
408  DtSynchPointCb func, void* usr);
409  virtual void addSynchPointRegFailedCb(DtSynchPointCb func,
410  void* usr);
411 
412  virtual void removeSynchPointRegFailedCb(const DtString& label,
413  DtSynchPointCb func, void* usr);
414  virtual void removeSynchPointRegFailedCb(DtSynchPointCb func,
415  void* usr);
416 
417  virtual void addFederationSynchedCb(const DtString& label,
418  DtSynchPointCb func, void* usr);
419  virtual void addFederationSynchedCb(DtSynchPointCb func,
420  void* usr);
421 
422  virtual void removeFederationSynchedCb(const DtString& label,
423  DtSynchPointCb func, void* usr);
424  virtual void removeFederationSynchedCb(DtSynchPointCb func,
425  void* usr);
426 
427  virtual void addAnnounceSynchPointCb(const DtString& label,
428  DtAnnounceSynchPointCb func, void* usr);
429  virtual void addAnnounceSynchPointCb(DtAnnounceSynchPointCb func,
430  void* usr);
431 
432  virtual void removeAnnounceSynchPointCb(const DtString& label,
433  DtAnnounceSynchPointCb func, void* usr);
434  virtual void removeAnnounceSynchPointCb(DtAnnounceSynchPointCb func,
435  void* usr);
436 
437 protected:
438 
439  virtual const RTI::Region* getRegionFromAttributes(
440  const RTI::AttributeHandleValuePairSet& theAttributes ) const;
441 
442  virtual const RTI::Region* getRegionFromParameters(
443  const RTI::ParameterHandleValuePairSet& theAttributes ) const;
444 
445 
446  struct DtGeneralSynchPointCbInfo
447  {
448  DtSynchPointCb cbFunction;
449  void* userData;
450  };
451 
452  struct DtLabelledSynchPointCbInfo
453  {
454  DtString label;
455  DtSynchPointCb cbFunction;
456  void* userData;
457  };
458 
459  struct DtGeneralAnnounceCbInfo
460  {
461  DtAnnounceSynchPointCb cbFunction;
462  void* userData;
463  };
464 
465  struct DtLabelledAnnounceCbInfo
466  {
467  DtString label;
468  DtAnnounceSynchPointCb cbFunction;
469  void* userData;
470  };
471 
472  static void attributesOutOfScopeCb(void* usr);
473 
474  virtual void processAttributesOutOfScope(RTI::ObjectHandle handle);
475 
476  DtExerciseConn* myExConn;
477  DtInteractionManager* myInteractionManager;
478  DtHlaObjectManager* myHlaObjectManager;
479 
480  DtReflectAttributeValuesCbList myRavCbList;
481  DtUpdatesOnCbList myUpdatesOnCbList;
482  DtUpdatesOffCbList myUpdatesOffCbList;
483  DtStartRegCbList myStartRegCbList;
484  DtStopRegCbList myStopRegCbList;
485  DtStartStopInterCbList myStartIntCbList;
486  DtStartStopInterCbList myStopIntCbList;
487  DtFedTimeCbList myTimeAdvanceGrantCbList;
488  DtFedTimeCbList myRegulationEnabledCbList;
489  DtFedTimeCbList myConstrainedEnabledCbList;
490 
492  std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegSucceededCbList;
493  std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegFailedCbList;
494  std::list<DtLabelledSynchPointCbInfo> myLabFederationSynchedCbList;
495  std::list<DtLabelledAnnounceCbInfo> myLabAnnounceSynchPointCbList;
496 
497  std::list<DtGeneralSynchPointCbInfo> mySynchPtRegSucceededCbList;
498  std::list<DtGeneralSynchPointCbInfo> mySynchPtRegFailedCbList;
499  std::list<DtGeneralSynchPointCbInfo> myFederationSynchedCbList;
500  std::list<DtGeneralAnnounceCbInfo> myAnnounceSynchPointCbList;
501 
502  bool myRemoveObjectOnAttOutOfScope;
503 
505  virtual void applyFedsSynchedCallbacks(const char* label);
506  virtual void applyRegistrationSucceededCallbacks(const char* label);
507  virtual void applyRegistrationFailedCallbacks(const char* label);
508 
510  virtual bool applyAnnounceCallbacks(const char* label, const char* tag);
511 };
512 
513 #endif
514 #endif
515 #endif
516 
517 
518 

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)