VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vrlFederateAmbassador13.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>
23 #include <list>
24 
25 typedef void (*DtFederateSaveCb)(
26  const char* label,
27  void* usr);
28 
29 typedef void (*DtFederateRestoreCb)(
30  const char* label,
31  void* usr);
32 
33 typedef void (*DtSynchPointCb)(
34  const char* label,
35  void* usr);
36 
37 typedef void (*DtAnnounceSynchPointCb)(
38  const char* label,
39  const char* tag,
40  void* usr);
41 
44 
46 {
48  {
50  RTI::ObjectHandle handle;
51  };
52 
53 public:
56 
58  virtual ~DtVrlFederateAmbassador()
59  throw( RTI::FederateInternalError );
60 
61 protected:
64 
66  DtVrlFederateAmbassador& operator=(const DtVrlFederateAmbassador& src );
67 
68 public:
71  virtual void init( DtExerciseConn* exConn,
72  DtHlaObjectManager* hlaObjMgr,
73  DtInteractionManager* interMgr );
74 
75 public:
77  static DtVrlFederateAmbassador* create();
78 
79 public:
82  virtual void addReflectAttributeValuesCb( RTI::ObjectHandle id,
83  DtReflectAttributeValuesCb cb, void* usr );
84  virtual void removeReflectAttributeValuesCb( RTI::ObjectHandle id,
85  DtReflectAttributeValuesCb cb, void* usr );
86 
89  virtual void addDiscoverObjectCb( RTI::ObjectClassHandle hand,
90  DtDiscoverObjectCb cb, void* usr );
91  virtual void removeDiscoverObjectCb( RTI::ObjectClassHandle hand,
92  DtDiscoverObjectCb cb, void* usr );
93 
96  virtual void addRemoveObjectCb( RTI::ObjectHandle id,
97  DtRemoveObjectCb cb, void* usr );
98  virtual void removeRemoveObjectCb( RTI::ObjectHandle id,
99  DtRemoveObjectCb cb, void* usr );
100 
103  virtual void addStartRegCb( RTI::ObjectClassHandle hand,
104  DtStartRegCb cb, void* usr );
105  virtual void removeStartRegCb( RTI::ObjectClassHandle hand,
106  DtStartRegCb cb, void* usr );
107 
110  virtual void addStopRegCb( RTI::ObjectClassHandle hand,
111  DtStopRegCb cb, void* usr );
112  virtual void removeStopRegCb( RTI::ObjectClassHandle hand,
113  DtStopRegCb cb, void* usr );
114 
117  virtual void addUpdatesOnCb( RTI::ObjectHandle hand,
118  DtUpdatesOnCb cb, void* usr );
119  virtual void removeUpdatesOnCb( RTI::ObjectHandle hand,
120  DtUpdatesOnCb cb, void* usr );
121 
124  virtual void addUpdatesOffCb( RTI::ObjectHandle hand,
125  DtUpdatesOffCb cb, void* usr );
126  virtual void removeUpdatesOffCb( RTI::ObjectHandle hand,
127  DtUpdatesOffCb cb, void* usr );
128 
131  virtual void addStartInteractionsCb( RTI::InteractionClassHandle hand,
132  DtStartStopInterCb cb, void* usr );
133  virtual void removeStartInteractionsCb( RTI::InteractionClassHandle hand,
134  DtStartStopInterCb cb, void* usr );
135 
138  virtual void addStopInteractionsCb( RTI::InteractionClassHandle hand,
139  DtStartStopInterCb cb, void* usr );
140  virtual void removeStopInteractionsCb( RTI::InteractionClassHandle hand,
141  DtStartStopInterCb cb, void* usr );
142 
145  virtual void addReceiveInteractionCb( RTI::InteractionClassHandle hand,
146  DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
147  virtual void removeReceiveInteractionCb( RTI::InteractionClassHandle hand,
148  DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
149 
152  virtual void addTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
153  virtual void removeTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
154 
157  virtual void addTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
158  virtual void removeTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
159 
162  virtual void addTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
163  virtual void removeTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
164 
165  virtual void setRemoveObjectOnAttOutOfScope(bool remove);
166  virtual bool removeObjectOnAttOutOfScope() const;
167 
168 
169 
171 
172  virtual void addFederateSaveCb(const DtString& label,
173  DtFederateSaveCb func, void* usr);
174  virtual void addFederateSaveCb(DtFederateSaveCb func,
175  void* usr);
176 
177  virtual void removeFederateSaveCb(const DtString& label,
178  DtFederateSaveCb func, void* usr);
179  virtual void removeFederateSaveCb(DtFederateSaveCb func,
180  void* usr);
182 
184 
185  virtual void addFederateRestoreCb(const DtString& label,
186  DtFederateRestoreCb func, void* usr);
187  virtual void addFederateRestoreCb(DtFederateRestoreCb func,
188  void* usr);
189 
190  virtual void removeFederateRestoreCb(const DtString& label,
191  DtFederateRestoreCb func, void* usr);
192  virtual void removeFederateRestoreCb(DtFederateRestoreCb func,
193  void* usr);
195 
196  virtual bool waitingForSaveOrRestore() const;
197 
198 public:
203 
205  virtual void timeAdvanceGrant( const RTI::FedTime& theTime )
206  throw( RTI::InvalidFederationTime,
207  RTI::TimeAdvanceWasNotInProgress,
208  RTI::FederateInternalError );
209 
210  virtual void timeRegulationEnabled( const RTI::FedTime& theTime )
211  throw( RTI::InvalidFederationTime,
212  RTI::EnableTimeRegulationWasNotPending,
213  RTI::FederateInternalError );
214 
215  virtual void timeConstrainedEnabled( const RTI::FedTime& theTime )
216  throw( RTI::InvalidFederationTime,
217  RTI::EnableTimeConstrainedWasNotPending,
218  RTI::FederateInternalError );
219 
220  virtual void startRegistrationForObjectClass(
221  RTI::ObjectClassHandle theClass )
222  throw( RTI::ObjectClassNotPublished,
223  RTI::FederateInternalError );
224 
225  virtual void stopRegistrationForObjectClass(
226  RTI::ObjectClassHandle theClass )
227  throw( RTI::ObjectClassNotPublished,
228  RTI::FederateInternalError );
229 
230  virtual void turnInteractionsOn(
231  RTI::InteractionClassHandle theHandle )
232  throw( RTI::InteractionClassNotPublished,
233  RTI::FederateInternalError );
234 
235  virtual void turnInteractionsOff(
236  RTI::InteractionClassHandle theHandle )
237  throw( RTI::InteractionClassNotPublished,
238  RTI::FederateInternalError );
239 
240  virtual void discoverObjectInstance(
241  RTI::ObjectHandle theObject,
242  RTI::ObjectClassHandle theObjectClass,
243  const char* theObjectName )
244  throw( RTI::CouldNotDiscover,
245  RTI::ObjectClassNotKnown,
246  RTI::FederateInternalError );
247 
248  virtual void reflectAttributeValues(
249  RTI::ObjectHandle theObject,
250  const RTI::AttributeHandleValuePairSet& theAttributes,
251  const RTI::FedTime& theTime,
252  const char* theTag,
253  RTI::EventRetractionHandle theHandle )
254  throw( RTI::ObjectNotKnown,
255  RTI::AttributeNotKnown,
256  RTI::FederateOwnsAttributes,
257  RTI::InvalidFederationTime,
258  RTI::FederateInternalError );
259 
260  virtual void reflectAttributeValues(
261  RTI::ObjectHandle theObject,
262  const RTI::AttributeHandleValuePairSet& theAttributes,
263  const char* theTag )
264  throw( RTI::ObjectNotKnown,
265  RTI::AttributeNotKnown,
266  RTI::FederateOwnsAttributes,
267  RTI::FederateInternalError);
268 
269  virtual void receiveInteraction(
270  RTI::InteractionClassHandle theInteraction,
271  const RTI::ParameterHandleValuePairSet& theParameters,
272  const RTI::FedTime& theTime,
273  const char* theTag,
274  RTI::EventRetractionHandle theHandle )
275  throw( RTI::InteractionClassNotKnown,
276  RTI::InteractionParameterNotKnown,
277  RTI::InvalidFederationTime,
278  RTI::FederateInternalError );
279 
280  virtual void receiveInteraction(
281  RTI::InteractionClassHandle theInteraction,
282  const RTI::ParameterHandleValuePairSet& theParameters,
283  const char* theTag )
284  throw( RTI::InteractionClassNotKnown,
285  RTI::InteractionParameterNotKnown,
286  RTI::FederateInternalError );
287 
288  virtual void removeObjectInstance(
289  RTI::ObjectHandle theObject,
290  const RTI::FedTime& theTime,
291  const char* theTag,
292  RTI::EventRetractionHandle theHandle )
293  throw( RTI::ObjectNotKnown,
294  RTI::InvalidFederationTime,
295  RTI::FederateInternalError );
296 
297  virtual void removeObjectInstance(
298  RTI::ObjectHandle theObject,
299  const char* theTag )
300  throw( RTI::ObjectNotKnown,
301  RTI::FederateInternalError );
302 
303  virtual void attributesInScope (
304  RTI::ObjectHandle theObject,
305  const RTI::AttributeHandleSet& theAttributes)
306  throw ( RTI::ObjectNotKnown,
307  RTI::AttributeNotKnown,
308  RTI::FederateInternalError);
309 
310  virtual void attributesOutOfScope (
311  RTI::ObjectHandle theObject,
312  const RTI::AttributeHandleSet& theAttributes)
313  throw ( RTI::ObjectNotKnown,
314  RTI::AttributeNotKnown,
315  RTI::FederateInternalError);
316 
317 
318  virtual void provideAttributeValueUpdate(
319  RTI::ObjectHandle theObject,
320  const RTI::AttributeHandleSet& theAttributes )
321  throw( RTI::ObjectNotKnown,
322  RTI::AttributeNotKnown,
323  RTI::AttributeNotOwned,
324  RTI::FederateInternalError );
325 
326  virtual void turnUpdatesOnForObjectInstance(
327  RTI::ObjectHandle theObject,
328  const RTI::AttributeHandleSet& theAttributes )
329  throw( RTI::ObjectNotKnown,
330  RTI::AttributeNotOwned,
331  RTI::FederateInternalError );
332 
333  virtual void turnUpdatesOffForObjectInstance(
334  RTI::ObjectHandle theObject,
335  const RTI::AttributeHandleSet& theAttributes )
336  throw( RTI::ObjectNotKnown,
337  RTI::AttributeNotOwned,
338  RTI::FederateInternalError );
339 
341  virtual void requestAttributeOwnershipAssumption(
342  RTI::ObjectHandle theObject,
343  const RTI::AttributeHandleSet& offeredAttributes,
344  const char* theTag )
345  throw( RTI::ObjectNotKnown,
346  RTI::AttributeNotKnown,
347  RTI::AttributeAlreadyOwned,
348  RTI::AttributeNotPublished,
349  RTI::FederateInternalError );
350 
351  virtual void attributeOwnershipDivestitureNotification(
352  RTI::ObjectHandle theObject,
353  const RTI::AttributeHandleSet& releasedAttributes )
354  throw( RTI::ObjectNotKnown,
355  RTI::AttributeNotKnown,
356  RTI::AttributeNotOwned,
357  RTI::AttributeDivestitureWasNotRequested,
358  RTI::FederateInternalError );
359 
360  virtual void attributeOwnershipAcquisitionNotification(
361  RTI::ObjectHandle theObject,
362  const RTI::AttributeHandleSet& securedAttributes )
363  throw( RTI::ObjectNotKnown,
364  RTI::AttributeNotKnown,
365  RTI::AttributeAcquisitionWasNotRequested,
366  RTI::AttributeAlreadyOwned,
367  RTI::AttributeNotPublished,
368  RTI::FederateInternalError );
369 
370  virtual void attributeOwnershipUnavailable(
371  RTI::ObjectHandle theObject,
372  const RTI::AttributeHandleSet& theAttributes )
373  throw( RTI::ObjectNotKnown,
374  RTI::AttributeNotKnown,
375  RTI::AttributeAlreadyOwned,
376  RTI::AttributeAcquisitionWasNotRequested,
377  RTI::FederateInternalError );
378 
379  virtual void requestAttributeOwnershipRelease(
380  RTI::ObjectHandle theObject,
381  const RTI::AttributeHandleSet& candidateAttributes,
382  const char* theTag )
383  throw( RTI::ObjectNotKnown,
384  RTI::AttributeNotKnown,
385  RTI::AttributeNotOwned,
386  RTI::FederateInternalError );
387 
388  virtual void confirmAttributeOwnershipAcquisitionCancellation(
389  RTI::ObjectHandle theObject,
390  const RTI::AttributeHandleSet& theAttributes )
391  throw( RTI::ObjectNotKnown,
392  RTI::AttributeNotKnown,
393  RTI::AttributeAlreadyOwned,
394  RTI::AttributeAcquisitionWasNotCanceled,
395  RTI::FederateInternalError );
396 
397  virtual void informAttributeOwnership(
398  RTI::ObjectHandle theObject,
399  RTI::AttributeHandle theAttribute,
400  RTI::FederateHandle theOwner )
401  throw( RTI::ObjectNotKnown,
402  RTI::AttributeNotKnown,
403  RTI::FederateInternalError );
404 
405  virtual void attributeIsNotOwned(
406  RTI::ObjectHandle theObject,
407  RTI::AttributeHandle theAttribute )
408  throw( RTI::ObjectNotKnown,
409  RTI::AttributeNotKnown,
410  RTI::FederateInternalError );
411 
412  virtual void attributeOwnedByRTI(
413  RTI::ObjectHandle theObject,
414  RTI::AttributeHandle theAttribute )
415  throw( RTI::ObjectNotKnown,
416  RTI::AttributeNotKnown,
417  RTI::FederateInternalError);
418 
419  // Ignores federation saves, and immediately responds with
420  // "Federation Save Complete".
422  virtual void initiateFederateSave(
423  const char* label )
424  throw( RTI::UnableToPerformSave,
425  RTI::FederateInternalError );
426 
427  virtual void federationSaved()
428  throw( RTI::FederateInternalError);
429 
430  virtual void federationNotSaved()
431  throw( RTI::FederateInternalError );
433 
434  // Ignores federation restores, and immediately responds with
435  // "Federation Restore Complete".
437  virtual void initiateFederateRestore (
438  const char *label, // supplied C4
439  RTI::FederateHandle handle) // supplied C1
440  throw (
441  RTI::SpecifiedSaveLabelDoesNotExist,
442  RTI::CouldNotRestore,
443  RTI::FederateInternalError);
444 
445  virtual void federationRestored ()
446  throw (
447  RTI::FederateInternalError);
449 
451  virtual void synchronizationPointRegistrationSucceeded( const char* label )
452  throw( RTI::FederateInternalError );
453 
454  virtual void synchronizationPointRegistrationFailed( const char* label )
455  throw( RTI::FederateInternalError );
456 
457  virtual void federationSynchronized( const char* label )
458  throw( RTI::FederateInternalError );
459 
460  virtual void announceSynchronizationPoint(
461  const char* label, const char* tag )
462  throw( RTI::FederateInternalError );
463 
465  virtual void addSynchPointRegSucceededCb(const DtString& label,
466  DtSynchPointCb func, void* usr);
467  virtual void addSynchPointRegSucceededCb(DtSynchPointCb func,
468  void* usr);
469 
470  virtual void removeSynchPointRegSucceededCb(const DtString& label,
471  DtSynchPointCb func, void* usr);
472  virtual void removeSynchPointRegSucceededCb(DtSynchPointCb func,
473  void* usr);
474 
475  virtual void addSynchPointRegFailedCb(const DtString& label,
476  DtSynchPointCb func, void* usr);
477  virtual void addSynchPointRegFailedCb(DtSynchPointCb func,
478  void* usr);
479 
480  virtual void removeSynchPointRegFailedCb(const DtString& label,
481  DtSynchPointCb func, void* usr);
482  virtual void removeSynchPointRegFailedCb(DtSynchPointCb func,
483  void* usr);
484 
485  virtual void addFederationSynchedCb(const DtString& label,
486  DtSynchPointCb func, void* usr);
487  virtual void addFederationSynchedCb(DtSynchPointCb func,
488  void* usr);
489 
490  virtual void removeFederationSynchedCb(const DtString& label,
491  DtSynchPointCb func, void* usr);
492  virtual void removeFederationSynchedCb(DtSynchPointCb func,
493  void* usr);
494 
495  virtual void addAnnounceSynchPointCb(const DtString& label,
496  DtAnnounceSynchPointCb func, void* usr);
497  virtual void addAnnounceSynchPointCb(DtAnnounceSynchPointCb func,
498  void* usr);
499 
500  virtual void removeAnnounceSynchPointCb(const DtString& label,
501  DtAnnounceSynchPointCb func, void* usr);
502  virtual void removeAnnounceSynchPointCb(DtAnnounceSynchPointCb func,
503  void* usr);
504 
505 protected:
506 
507  virtual const RTI::Region* getRegionFromAttributes(
508  const RTI::AttributeHandleValuePairSet& theAttributes ) const;
509 
510  virtual const RTI::Region* getRegionFromParameters(
511  const RTI::ParameterHandleValuePairSet& theAttributes ) const;
512 
514  {
516  void* userData;
517  };
518 
520  {
522  void* userData;
523  };
524 
526  {
529  void* userData;
530  };
531 
533  {
536  void* userData;
537  };
538 
540  {
542  void* userData;
543  };
544 
546  {
549  void* userData;
550  };
551 
553  {
555  void* userData;
556  };
557 
559  {
562  void* userData;
563  };
564 
565  static void attributesOutOfScopeCb(void* usr);
566 
567  virtual void processAttributesOutOfScope(RTI::ObjectHandle handle);
568 
572 
583 
585  std::list<DtFederateSaveCbInfo> myFederateSaveCbList;
586  std::list<DtLabelledFederateSaveCbInfo> myLabFederateSaveCbList;
587  std::list<DtFederateRestoreCbInfo> myFederateRestoreCbList;
588  std::list<DtLabelledFederateRestoreCbInfo> myLabFederateRestoreCbList;
589 
590  std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegSucceededCbList;
591  std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegFailedCbList;
592  std::list<DtLabelledSynchPointCbInfo> myLabFederationSynchedCbList;
593  std::list<DtLabelledAnnounceCbInfo> myLabAnnounceSynchPointCbList;
594 
595  std::list<DtGeneralSynchPointCbInfo> mySynchPtRegSucceededCbList;
596  std::list<DtGeneralSynchPointCbInfo> mySynchPtRegFailedCbList;
597  std::list<DtGeneralSynchPointCbInfo> myFederationSynchedCbList;
598  std::list<DtGeneralAnnounceCbInfo> myAnnounceSynchPointCbList;
599 
601 
603  virtual void applyFedsSynchedCallbacks(const char* label);
604  virtual void applyRegistrationSucceededCallbacks(const char* label);
605  virtual void applyRegistrationFailedCallbacks(const char* label);
606 
608  virtual bool applyAnnounceCallbacks(const char* label, const char* tag);
609 
610 protected:
611 
614 };
615 
616 #endif
617 #endif
618 #endif
619 
620 
621 

Document ID: Generated on Mon Feb 6 18:36:34 EST 2017 from SVN revision 173107
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)