MAK RTIspy API Documentation for HLA 1516
simpleTimeFedAmb13dlc.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2009 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: simpleTimeFedAmb13dlc.h,v $ $Revision: 1.1 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #pragma warning(disable: 4786)
00010 #pragma warning(disable: 4290)
00011 
00012 #include "NullFederateAmbassador13.h"
00013 #include <map>
00014 #include <set>
00015 #include <string>
00016 #include "simpleTimeTimeManagedEntity.h"
00017 
00018 
00019 
00020 // Map between strings and attribute handles
00021 typedef std::map<std::string, rti13::AttributeHandle>  DtAttrNameHandleMap;
00022 typedef std::map<std::string, rti13::ParameterHandle> DtParamNameHandleMap;
00023 
00024 class DtTalkAmbData{
00025    
00026 public :
00027    DtTalkAmbData();
00028    ~DtTalkAmbData();
00029  
00030 
00031 public:
00032  std::map<rti13::ObjectClassHandle, std::string> objectClassMap;
00033  std::map<rti13::ObjectHandle, std::string> objectInstanceMap;
00034  std::map<rti13::InteractionClassHandle, std::string> interactionClassMap; 
00035  std::map<rti13::ObjectHandle, rti13::AttributeHandleSet*> updateRequestMap;
00036 
00037  // Map between strings and attribute handles
00038  DtAttrNameHandleMap theAttrNameHandleMap; 
00039 
00040  // Map between strings and attribute handles
00041  DtParamNameHandleMap theParamNameHandleMap;
00042 
00043  // The set of Attributes that this federate's published objects will contain.
00044  std::set <std::string> ourAttrs;
00045 
00046  // The set of Parameters that this federate's published interactions will contain.
00047  std::set <std::string> ourParms;  
00048 
00049  // This federation of simple objects has a single master object, (determined by command line arguments)
00050  //  The master federate will keep the other federates from entering their main loop of execution until
00051  //  all of numFederates have joined.
00052  bool isMaster;
00053 
00054  // numFederates is the number of federates (including the master) that the master should wait to join the 
00055  //  federation before it allows any federate to enter its main loop. 
00056  // This variable is only used by the master federate.
00057  int numFederates;
00058 
00059  
00060  rti13::AttributeHandleValuePairSet* attrValues;
00061  rti13::ParameterHandleValuePairSet* paramValues;
00062 
00063  bool isConstrained;
00064  bool isRegulating;
00065  bool timeAdvanced;
00066  int otherFederatesReady;
00067  bool registerFailed;
00068  bool registerSucceeded;
00069  bool announceSyncReceived;
00070  bool federationIsSynchronized;
00071  timeManagedEntity timeManagedObject; 
00072 };
00073 
00074 
00075 class MyFederateAmbassador : public rti13::NullFederateAmbassador
00076 {
00077 public:
00078 
00079    MyFederateAmbassador(DtTalkAmbData & data);
00080 
00081    virtual ~MyFederateAmbassador() 
00082      throw (rti13::FederateInternalError);
00083 
00084 
00086    // Object Management Services //
00088 
00089    virtual void discoverObjectInstance (
00090            rti13::ObjectHandle          theObject,      // supplied C1
00091            rti13::ObjectClassHandle     theObjectClass, // supplied C1
00092      const char*                      theObjectName)  // supplied C4  
00093    throw (
00094      rti13::CouldNotDiscover,
00095      rti13::ObjectClassNotKnown,
00096      rti13::FederateInternalError);
00097 
00098    virtual void reflectAttributeValues (
00099            rti13::ObjectHandle                 theObject,     // supplied C1
00100      const rti13::AttributeHandleValuePairSet& theAttributes, // supplied C4
00101      const rti13::FedTime&                     theTime,       // supplied C1
00102      const char                             *theTag,        // supplied C4
00103            rti13::EventRetractionHandle        theHandle)     // supplied C1
00104    throw (
00105      rti13::ObjectNotKnown,
00106      rti13::AttributeNotKnown,
00107      rti13::FederateOwnsAttributes,
00108      rti13::InvalidFederationTime,
00109      rti13::FederateInternalError);
00110 
00111    virtual void reflectAttributeValues (
00112            rti13::ObjectHandle                 theObject,     // supplied C1
00113      const rti13::AttributeHandleValuePairSet& theAttributes, // supplied C4
00114      const char                             *theTag)        // supplied C4
00115    throw (
00116      rti13::ObjectNotKnown,
00117      rti13::AttributeNotKnown,
00118      rti13::FederateOwnsAttributes,
00119      rti13::FederateInternalError);
00120 
00121    // 4.6
00122    virtual void receiveInteraction (
00123            rti13::InteractionClassHandle       theInteraction, // supplied C1
00124      const rti13::ParameterHandleValuePairSet& theParameters,  // supplied C4
00125      const rti13::FedTime&                     theTime,        // supplied C4
00126      const char                             *theTag,         // supplied C4
00127            rti13::EventRetractionHandle        theHandle)      // supplied C1
00128    throw (
00129      rti13::InteractionClassNotKnown,
00130      rti13::InteractionParameterNotKnown,
00131      rti13::InvalidFederationTime,
00132      rti13::FederateInternalError);
00133 
00134    virtual void receiveInteraction (
00135            rti13::InteractionClassHandle       theInteraction, // supplied C1
00136      const rti13::ParameterHandleValuePairSet& theParameters,  // supplied C4
00137      const char                             *theTag)         // supplied C4
00138    throw (
00139      rti13::InteractionClassNotKnown,
00140      rti13::InteractionParameterNotKnown,
00141      rti13::FederateInternalError);
00142 
00143    virtual void removeObjectInstance (
00144            rti13::ObjectHandle          theObject, // supplied C1
00145      const rti13::FedTime&              theTime,   // supplied C4
00146      const char                      *theTag,    // supplied C4
00147            rti13::EventRetractionHandle theHandle) // supplied C1
00148    throw (
00149      rti13::ObjectNotKnown,
00150      rti13::InvalidFederationTime,
00151      rti13::FederateInternalError);
00152 
00153    virtual void removeObjectInstance (
00154            rti13::ObjectHandle          theObject, // supplied C1
00155      const char                      *theTag)    // supplied C4
00156    throw (
00157      rti13::ObjectNotKnown,
00158      rti13::FederateInternalError);
00159 
00160 virtual void provideAttributeValueUpdate (
00161         rti13::ObjectHandle        theObject,     
00162   const rti13::AttributeHandleSet& theAttributes) 
00163 throw (
00164   rti13::ObjectNotKnown,
00165   rti13::AttributeNotKnown,
00166   rti13::AttributeNotOwned,
00167   rti13::FederateInternalError);
00168 
00169 virtual void timeRegulationEnabled (
00170  const  rti13::FedTime& theFederateTime) // supplied C4
00171 throw (
00172   rti13::InvalidFederationTime,
00173   rti13::EnableTimeRegulationWasNotPending,
00174   rti13::FederateInternalError);
00175 
00176 virtual void timeConstrainedEnabled (
00177   const rti13::FedTime& theFederateTime) // supplied C4
00178 throw (
00179   rti13::InvalidFederationTime,
00180   rti13::EnableTimeConstrainedWasNotPending,
00181   rti13::FederateInternalError);
00182 
00183 virtual void timeAdvanceGrant (
00184   const rti13::FedTime& theTime) // supplied C4
00185 throw (
00186   rti13::InvalidFederationTime,
00187   rti13::TimeAdvanceWasNotInProgress,
00188   rti13::FederateInternalError);
00189 
00190 virtual void synchronizationPointRegistrationSucceeded (
00191   const char *label) // supplied C4)
00192 throw (
00193   rti13::FederateInternalError);
00194 
00195 
00196 virtual void synchronizationPointRegistrationFailed (
00197   const char *label) // supplied C4)
00198 throw (
00199   rti13::FederateInternalError);
00200 
00201 virtual void announceSynchronizationPoint (
00202   const char *label, // supplied C4
00203   const char *tag)   // supplied C4
00204 throw (
00205   rti13::FederateInternalError);
00206 
00207 virtual void federationSynchronized (
00208   const char *label) // supplied C4)
00209 throw (
00210   rti13::FederateInternalError);
00211  
00212 
00213 public:
00214    DtTalkAmbData & myData;
00215 };
00216 

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)