VR-Link API Documentation for DIS
vrlFedAmb13.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 
00006 
00007 #ifndef DtVrlFederateAmbassador_H_
00008 #define DtVrlFederateAmbassador_H_
00009  
00013 
00014 #if DtHLA
00015 #if !DtHLA_1516
00016 
00017 
00018 
00019 #include "callbacks.h"
00020 
00021 #include <RTI.hh>
00022 #include "nullFedAmb13.h"
00023 #include <list>
00024 
00025 typedef void (*DtSynchPointCb)(
00026    const char* label,
00027    void* usr);
00028 
00029 typedef void (*DtAnnounceSynchPointCb)(
00030    const char* label,
00031    const char* tag,
00032    void* usr);
00033 
00034 class DT_DLL_VL DtInteractionManager;
00035 class DT_DLL_VL DtHlaObjectManager;
00036 
00037 class DT_DLL_VL DtVrlFederateAmbassador : public DtNullFederateAmbassador
00038 {
00039    struct DtScopeChangeCallbackData
00040    {
00041       DtVrlFederateAmbassador* fedAmb;
00042       RTI::ObjectHandle        handle;
00043    };
00044 
00045 public:
00047    DtVrlFederateAmbassador();
00048 
00050    virtual ~DtVrlFederateAmbassador()
00051       throw( RTI::FederateInternalError );
00052 
00053 protected:
00055    DtVrlFederateAmbassador( const DtVrlFederateAmbassador& src );
00056 
00058    DtVrlFederateAmbassador& operator=(const DtVrlFederateAmbassador& src );
00059 
00060 public:
00063    virtual void init( DtExerciseConn* exConn,
00064       DtHlaObjectManager* hlaObjMgr,
00065       DtInteractionManager* interMgr );
00066 
00067 public:
00069    static DtVrlFederateAmbassador* create();
00070 
00071 public:
00074    virtual void addReflectAttributeValuesCb( RTI::ObjectHandle id,
00075       DtReflectAttributeValuesCb cb, void* usr );
00076    virtual void removeReflectAttributeValuesCb( RTI::ObjectHandle id,
00077       DtReflectAttributeValuesCb cb, void* usr );
00078 
00081    virtual void addDiscoverObjectCb( RTI::ObjectClassHandle hand,
00082       DtDiscoverObjectCb cb, void* usr );
00083    virtual void removeDiscoverObjectCb( RTI::ObjectClassHandle hand,
00084       DtDiscoverObjectCb cb, void* usr );
00085 
00088    virtual void addRemoveObjectCb( RTI::ObjectHandle id,
00089       DtRemoveObjectCb cb, void* usr );
00090    virtual void removeRemoveObjectCb( RTI::ObjectHandle id,
00091       DtRemoveObjectCb cb, void* usr );
00092 
00095    virtual void addStartRegCb( RTI::ObjectClassHandle hand,
00096       DtStartRegCb cb, void* usr );
00097    virtual void removeStartRegCb( RTI::ObjectClassHandle hand,
00098       DtStartRegCb cb, void* usr );
00099 
00102    virtual void addStopRegCb( RTI::ObjectClassHandle hand,
00103       DtStopRegCb cb, void* usr );
00104    virtual void removeStopRegCb( RTI::ObjectClassHandle hand,
00105       DtStopRegCb cb, void* usr );
00106 
00109    virtual void addUpdatesOnCb( RTI::ObjectHandle hand,
00110       DtUpdatesOnCb cb, void* usr );
00111    virtual void removeUpdatesOnCb( RTI::ObjectHandle hand,
00112       DtUpdatesOnCb cb, void* usr );
00113 
00116    virtual void addUpdatesOffCb( RTI::ObjectHandle hand,
00117       DtUpdatesOffCb cb, void* usr );
00118    virtual void removeUpdatesOffCb( RTI::ObjectHandle hand,
00119       DtUpdatesOffCb cb, void* usr );
00120 
00123    virtual void addStartInteractionsCb( RTI::InteractionClassHandle hand,
00124       DtStartStopInterCb cb, void* usr );
00125    virtual void removeStartInteractionsCb( RTI::InteractionClassHandle hand,
00126       DtStartStopInterCb cb, void* usr );
00127 
00130    virtual void addStopInteractionsCb( RTI::InteractionClassHandle hand,
00131       DtStartStopInterCb cb, void* usr );
00132    virtual void removeStopInteractionsCb( RTI::InteractionClassHandle hand,
00133       DtStartStopInterCb cb, void* usr );
00134 
00137    virtual void addReceiveInteractionCb( RTI::InteractionClassHandle hand,
00138       DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
00139    virtual void removeReceiveInteractionCb( RTI::InteractionClassHandle hand,
00140       DtReceiveInteractionCb cb, void* usr, DtDDMRegionSP region = DtDDMRegionSP() );
00141    
00144    virtual void addTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
00145    virtual void removeTimeAdvanceGrantCb( DtFedTimeCb cb, void* usr );
00146 
00149    virtual void addTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
00150    virtual void removeTimeRegulationEnabledCb( DtFedTimeCb cb, void* usr );
00151 
00154    virtual void addTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
00155    virtual void removeTimeConstrainedEnabledCb( DtFedTimeCb cb, void* usr );
00156 
00157    virtual void setRemoveObjectOnAttOutOfScope(bool remove);
00158    virtual bool removeObjectOnAttOutOfScope() const;
00159 
00160 
00161 public:
00166 
00168    virtual void timeAdvanceGrant( const RTI::FedTime& theTime )
00169       throw( RTI::InvalidFederationTime,
00170              RTI::TimeAdvanceWasNotInProgress,
00171              RTI::FederateInternalError );
00172 
00173    virtual void timeRegulationEnabled( const RTI::FedTime& theTime )
00174       throw( RTI::InvalidFederationTime,
00175              RTI::EnableTimeRegulationWasNotPending,
00176              RTI::FederateInternalError );
00177 
00178    virtual void timeConstrainedEnabled( const RTI::FedTime& theTime )
00179       throw( RTI::InvalidFederationTime,
00180              RTI::EnableTimeConstrainedWasNotPending,
00181              RTI::FederateInternalError );
00182 
00183    virtual void startRegistrationForObjectClass(
00184       RTI::ObjectClassHandle theClass )
00185       throw( RTI::ObjectClassNotPublished,
00186              RTI::FederateInternalError );
00187 
00188    virtual void stopRegistrationForObjectClass(
00189       RTI::ObjectClassHandle theClass )
00190       throw( RTI::ObjectClassNotPublished,
00191              RTI::FederateInternalError );
00192 
00193    virtual void turnInteractionsOn(
00194       RTI::InteractionClassHandle theHandle )
00195       throw( RTI::InteractionClassNotPublished,
00196              RTI::FederateInternalError );
00197    
00198    virtual void turnInteractionsOff(
00199       RTI::InteractionClassHandle theHandle )
00200       throw( RTI::InteractionClassNotPublished,
00201              RTI::FederateInternalError );
00202 
00203    virtual void discoverObjectInstance(
00204       RTI::ObjectHandle theObject,
00205       RTI::ObjectClassHandle theObjectClass,
00206       const char* theObjectName )
00207       throw( RTI::CouldNotDiscover,
00208              RTI::ObjectClassNotKnown,
00209              RTI::FederateInternalError );
00210 
00211    virtual void reflectAttributeValues(
00212       RTI::ObjectHandle theObject,
00213       const RTI::AttributeHandleValuePairSet& theAttributes,
00214       const RTI::FedTime& theTime,
00215       const char* theTag,
00216       RTI::EventRetractionHandle theHandle )
00217       throw( RTI::ObjectNotKnown,
00218              RTI::AttributeNotKnown,
00219              RTI::FederateOwnsAttributes,
00220              RTI::InvalidFederationTime,
00221              RTI::FederateInternalError );
00222 
00223    virtual void reflectAttributeValues(
00224       RTI::ObjectHandle theObject,
00225       const RTI::AttributeHandleValuePairSet& theAttributes,
00226       const char* theTag )
00227       throw( RTI::ObjectNotKnown,
00228              RTI::AttributeNotKnown,
00229              RTI::FederateOwnsAttributes,
00230              RTI::FederateInternalError);
00231 
00232    virtual void receiveInteraction(
00233       RTI::InteractionClassHandle theInteraction,
00234       const RTI::ParameterHandleValuePairSet& theParameters,
00235       const RTI::FedTime& theTime,
00236       const char* theTag,
00237       RTI::EventRetractionHandle theHandle )
00238       throw( RTI::InteractionClassNotKnown,
00239              RTI::InteractionParameterNotKnown,
00240              RTI::InvalidFederationTime,
00241              RTI::FederateInternalError );
00242 
00243    virtual void receiveInteraction(
00244       RTI::InteractionClassHandle theInteraction,
00245       const RTI::ParameterHandleValuePairSet& theParameters,
00246       const char* theTag )
00247       throw( RTI::InteractionClassNotKnown,
00248              RTI::InteractionParameterNotKnown,
00249              RTI::FederateInternalError );
00250 
00251    virtual void removeObjectInstance(
00252       RTI::ObjectHandle theObject,
00253       const RTI::FedTime& theTime,
00254       const char* theTag,
00255       RTI::EventRetractionHandle theHandle )
00256       throw( RTI::ObjectNotKnown,
00257              RTI::InvalidFederationTime,
00258              RTI::FederateInternalError );
00259    
00260    virtual void removeObjectInstance(
00261       RTI::ObjectHandle theObject,
00262       const char* theTag )
00263       throw( RTI::ObjectNotKnown,
00264              RTI::FederateInternalError );
00265 
00266    virtual void attributesInScope (
00267       RTI::ObjectHandle theObject,     
00268       const RTI::AttributeHandleSet& theAttributes) 
00269       throw ( RTI::ObjectNotKnown,
00270               RTI::AttributeNotKnown,
00271               RTI::FederateInternalError);
00272 
00273    virtual void attributesOutOfScope (
00274       RTI::ObjectHandle theObject,     
00275       const RTI::AttributeHandleSet& theAttributes) 
00276       throw ( RTI::ObjectNotKnown,
00277               RTI::AttributeNotKnown,
00278               RTI::FederateInternalError);
00279 
00280    
00281    virtual void provideAttributeValueUpdate(
00282       RTI::ObjectHandle theObject,
00283       const RTI::AttributeHandleSet& theAttributes )
00284       throw( RTI::ObjectNotKnown,
00285              RTI::AttributeNotKnown,
00286              RTI::AttributeNotOwned,
00287              RTI::FederateInternalError );
00288 
00289    virtual void turnUpdatesOnForObjectInstance(
00290       RTI::ObjectHandle theObject,
00291       const RTI::AttributeHandleSet& theAttributes )
00292       throw( RTI::ObjectNotKnown,
00293              RTI::AttributeNotOwned,
00294              RTI::FederateInternalError );
00295 
00296    virtual void turnUpdatesOffForObjectInstance(
00297       RTI::ObjectHandle theObject,
00298       const RTI::AttributeHandleSet& theAttributes )
00299       throw( RTI::ObjectNotKnown,
00300              RTI::AttributeNotOwned,
00301              RTI::FederateInternalError );
00302 
00304    virtual void requestAttributeOwnershipAssumption(
00305       RTI::ObjectHandle theObject,
00306       const RTI::AttributeHandleSet& offeredAttributes,
00307       const char* theTag )
00308       throw( RTI::ObjectNotKnown,
00309              RTI::AttributeNotKnown,
00310              RTI::AttributeAlreadyOwned,
00311              RTI::AttributeNotPublished,
00312              RTI::FederateInternalError );
00313    
00314    virtual void attributeOwnershipDivestitureNotification(
00315       RTI::ObjectHandle theObject,
00316       const RTI::AttributeHandleSet& releasedAttributes )
00317       throw( RTI::ObjectNotKnown,
00318              RTI::AttributeNotKnown,
00319              RTI::AttributeNotOwned,
00320              RTI::AttributeDivestitureWasNotRequested,
00321              RTI::FederateInternalError );
00322    
00323    virtual void attributeOwnershipAcquisitionNotification(
00324       RTI::ObjectHandle theObject,
00325       const RTI::AttributeHandleSet& securedAttributes )
00326       throw( RTI::ObjectNotKnown,
00327              RTI::AttributeNotKnown,
00328              RTI::AttributeAcquisitionWasNotRequested,
00329              RTI::AttributeAlreadyOwned,
00330              RTI::AttributeNotPublished,
00331              RTI::FederateInternalError );
00332    
00333    virtual void attributeOwnershipUnavailable(
00334       RTI::ObjectHandle theObject,
00335       const RTI::AttributeHandleSet& theAttributes )
00336       throw( RTI::ObjectNotKnown,
00337              RTI::AttributeNotKnown,
00338              RTI::AttributeAlreadyOwned,
00339              RTI::AttributeAcquisitionWasNotRequested,
00340              RTI::FederateInternalError );
00341    
00342    virtual void requestAttributeOwnershipRelease(
00343       RTI::ObjectHandle theObject,
00344       const RTI::AttributeHandleSet& candidateAttributes,
00345       const char* theTag )
00346       throw( RTI::ObjectNotKnown,
00347              RTI::AttributeNotKnown,
00348              RTI::AttributeNotOwned,
00349              RTI::FederateInternalError );
00350    
00351    virtual void confirmAttributeOwnershipAcquisitionCancellation(
00352       RTI::ObjectHandle theObject,
00353       const RTI::AttributeHandleSet& theAttributes )
00354       throw( RTI::ObjectNotKnown,
00355              RTI::AttributeNotKnown,
00356              RTI::AttributeAlreadyOwned,
00357              RTI::AttributeAcquisitionWasNotCanceled,
00358              RTI::FederateInternalError );
00359    
00360    virtual void informAttributeOwnership(
00361       RTI::ObjectHandle theObject,
00362       RTI::AttributeHandle theAttribute,
00363       RTI::FederateHandle theOwner )
00364       throw( RTI::ObjectNotKnown,
00365              RTI::AttributeNotKnown,
00366              RTI::FederateInternalError );
00367    
00368    virtual void attributeIsNotOwned(
00369       RTI::ObjectHandle theObject,
00370       RTI::AttributeHandle theAttribute )
00371       throw( RTI::ObjectNotKnown,
00372              RTI::AttributeNotKnown,
00373              RTI::FederateInternalError );
00374    
00375    virtual void attributeOwnedByRTI(
00376       RTI::ObjectHandle theObject,
00377       RTI::AttributeHandle theAttribute )
00378       throw( RTI::ObjectNotKnown,
00379              RTI::AttributeNotKnown,
00380              RTI::FederateInternalError);
00381 
00383    virtual void synchronizationPointRegistrationSucceeded( const char* label )
00384       throw( RTI::FederateInternalError );
00385 
00386    virtual void synchronizationPointRegistrationFailed( const char* label )
00387       throw( RTI::FederateInternalError );
00388 
00389    virtual void federationSynchronized( const char* label )
00390       throw( RTI::FederateInternalError );
00391 
00392    virtual void announceSynchronizationPoint(
00393       const char* label, const char* tag )
00394       throw( RTI::FederateInternalError );
00395 
00397    virtual void addSynchPointRegSucceededCb(const DtString& label,
00398       DtSynchPointCb func, void* usr);
00399    virtual void addSynchPointRegSucceededCb(DtSynchPointCb func, 
00400       void* usr);
00401 
00402    virtual void removeSynchPointRegSucceededCb(const DtString& label,
00403       DtSynchPointCb func, void* usr);
00404    virtual void removeSynchPointRegSucceededCb(DtSynchPointCb func, 
00405       void* usr);
00406 
00407    virtual void addSynchPointRegFailedCb(const DtString& label,
00408       DtSynchPointCb func, void* usr);
00409    virtual void addSynchPointRegFailedCb(DtSynchPointCb func, 
00410       void* usr);
00411 
00412    virtual void removeSynchPointRegFailedCb(const DtString& label,
00413       DtSynchPointCb func, void* usr);
00414    virtual void removeSynchPointRegFailedCb(DtSynchPointCb func, 
00415       void* usr);
00416 
00417    virtual void addFederationSynchedCb(const DtString& label,
00418       DtSynchPointCb func, void* usr);
00419    virtual void addFederationSynchedCb(DtSynchPointCb func, 
00420       void* usr);
00421 
00422    virtual void removeFederationSynchedCb(const DtString& label,
00423       DtSynchPointCb func, void* usr);
00424    virtual void removeFederationSynchedCb(DtSynchPointCb func, 
00425       void* usr);
00426 
00427    virtual void addAnnounceSynchPointCb(const DtString& label,
00428       DtAnnounceSynchPointCb func, void* usr);
00429    virtual void addAnnounceSynchPointCb(DtAnnounceSynchPointCb func, 
00430       void* usr);
00431 
00432    virtual void removeAnnounceSynchPointCb(const DtString& label,
00433       DtAnnounceSynchPointCb func, void* usr);
00434    virtual void removeAnnounceSynchPointCb(DtAnnounceSynchPointCb func, 
00435       void* usr);
00436 
00437 protected:
00438 
00439    virtual const RTI::Region* getRegionFromAttributes(
00440       const RTI::AttributeHandleValuePairSet& theAttributes ) const;
00441 
00442    virtual const RTI::Region* getRegionFromParameters(
00443       const RTI::ParameterHandleValuePairSet& theAttributes ) const;
00444 
00445 
00446    struct DtGeneralSynchPointCbInfo
00447    {
00448       DtSynchPointCb cbFunction;
00449       void* userData;
00450    };
00451 
00452    struct DtLabelledSynchPointCbInfo
00453    {
00454       DtString label;
00455       DtSynchPointCb cbFunction;
00456       void* userData;
00457    };
00458 
00459    struct DtGeneralAnnounceCbInfo
00460    {
00461       DtAnnounceSynchPointCb cbFunction;
00462       void* userData;
00463    };
00464 
00465    struct DtLabelledAnnounceCbInfo
00466    {
00467       DtString label;
00468       DtAnnounceSynchPointCb cbFunction;
00469       void* userData;
00470    };
00471 
00472    static void attributesOutOfScopeCb(void* usr);
00473 
00474    virtual void processAttributesOutOfScope(RTI::ObjectHandle handle);
00475 
00476    DtExerciseConn*       myExConn;
00477    DtInteractionManager* myInteractionManager;
00478    DtHlaObjectManager*   myHlaObjectManager;
00479 
00480    DtReflectAttributeValuesCbList myRavCbList;
00481    DtUpdatesOnCbList              myUpdatesOnCbList;
00482    DtUpdatesOffCbList             myUpdatesOffCbList;
00483    DtStartRegCbList               myStartRegCbList;
00484    DtStopRegCbList                myStopRegCbList;
00485    DtStartStopInterCbList         myStartIntCbList;
00486    DtStartStopInterCbList         myStopIntCbList;
00487    DtFedTimeCbList                myTimeAdvanceGrantCbList;
00488    DtFedTimeCbList                myRegulationEnabledCbList;
00489    DtFedTimeCbList                myConstrainedEnabledCbList;
00490    
00492    std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegSucceededCbList;
00493    std::list<DtLabelledSynchPointCbInfo> myLabSynchPtRegFailedCbList;
00494    std::list<DtLabelledSynchPointCbInfo> myLabFederationSynchedCbList;
00495    std::list<DtLabelledAnnounceCbInfo>   myLabAnnounceSynchPointCbList;
00496 
00497    std::list<DtGeneralSynchPointCbInfo> mySynchPtRegSucceededCbList;
00498    std::list<DtGeneralSynchPointCbInfo> mySynchPtRegFailedCbList;
00499    std::list<DtGeneralSynchPointCbInfo> myFederationSynchedCbList;
00500    std::list<DtGeneralAnnounceCbInfo>     myAnnounceSynchPointCbList;
00501 
00502    bool myRemoveObjectOnAttOutOfScope;
00503 
00505    virtual void applyFedsSynchedCallbacks(const char* label);
00506    virtual void applyRegistrationSucceededCallbacks(const char* label);
00507    virtual void applyRegistrationFailedCallbacks(const char* label);
00508 
00510    virtual bool applyAnnounceCallbacks(const char* label, const char* tag);
00511 };
00512 
00513 #endif   //! DtHLA
00514 #endif
00515 #endif   //! DtVrlFederateAmbassador_H_
00516 
00517 
00518 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)