![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2004 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: simpleTimeFedAmb13.h,v $ $Revision: 1.2 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #pragma warning(disable: 4786) 00010 #pragma warning(disable: 4290) 00011 00012 #include "NullFederateAmbassador.hh" 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, RTI::AttributeHandle> DtAttrNameHandleMap; 00022 typedef std::map<std::string, RTI::ParameterHandle> DtParamNameHandleMap; 00023 00024 class DtTalkAmbData{ 00025 00026 public : 00027 DtTalkAmbData(); 00028 ~DtTalkAmbData(); 00029 00030 00031 public: 00032 std::map<RTI::ObjectClassHandle, std::string> objectClassMap; 00033 std::map<RTI::ObjectHandle, std::string> objectInstanceMap; 00034 std::map<RTI::InteractionClassHandle, std::string> interactionClassMap; 00035 std::map<RTI::ObjectHandle, RTI::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 RTI::AttributeHandleValuePairSet* attrValues; 00061 RTI::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 NullFederateAmbassador 00076 { 00077 public: 00078 00079 MyFederateAmbassador(DtTalkAmbData & data); 00080 00081 virtual ~MyFederateAmbassador() 00082 throw (RTI::FederateInternalError); 00083 00084 00086 // Object Management Services // 00088 00089 virtual void discoverObjectInstance ( 00090 RTI::ObjectHandle theObject, // supplied C1 00091 RTI::ObjectClassHandle theObjectClass, // supplied C1 00092 const char* theObjectName) // supplied C4 00093 throw ( 00094 RTI::CouldNotDiscover, 00095 RTI::ObjectClassNotKnown, 00096 RTI::FederateInternalError); 00097 00098 virtual void reflectAttributeValues ( 00099 RTI::ObjectHandle theObject, // supplied C1 00100 const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4 00101 const RTI::FedTime& theTime, // supplied C1 00102 const char *theTag, // supplied C4 00103 RTI::EventRetractionHandle theHandle) // supplied C1 00104 throw ( 00105 RTI::ObjectNotKnown, 00106 RTI::AttributeNotKnown, 00107 RTI::FederateOwnsAttributes, 00108 RTI::InvalidFederationTime, 00109 RTI::FederateInternalError); 00110 00111 virtual void reflectAttributeValues ( 00112 RTI::ObjectHandle theObject, // supplied C1 00113 const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4 00114 const char *theTag) // supplied C4 00115 throw ( 00116 RTI::ObjectNotKnown, 00117 RTI::AttributeNotKnown, 00118 RTI::FederateOwnsAttributes, 00119 RTI::FederateInternalError); 00120 00121 // 4.6 00122 virtual void receiveInteraction ( 00123 RTI::InteractionClassHandle theInteraction, // supplied C1 00124 const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4 00125 const RTI::FedTime& theTime, // supplied C4 00126 const char *theTag, // supplied C4 00127 RTI::EventRetractionHandle theHandle) // supplied C1 00128 throw ( 00129 RTI::InteractionClassNotKnown, 00130 RTI::InteractionParameterNotKnown, 00131 RTI::InvalidFederationTime, 00132 RTI::FederateInternalError); 00133 00134 virtual void receiveInteraction ( 00135 RTI::InteractionClassHandle theInteraction, // supplied C1 00136 const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4 00137 const char *theTag) // supplied C4 00138 throw ( 00139 RTI::InteractionClassNotKnown, 00140 RTI::InteractionParameterNotKnown, 00141 RTI::FederateInternalError); 00142 00143 virtual void removeObjectInstance ( 00144 RTI::ObjectHandle theObject, // supplied C1 00145 const RTI::FedTime& theTime, // supplied C4 00146 const char *theTag, // supplied C4 00147 RTI::EventRetractionHandle theHandle) // supplied C1 00148 throw ( 00149 RTI::ObjectNotKnown, 00150 RTI::InvalidFederationTime, 00151 RTI::FederateInternalError); 00152 00153 virtual void removeObjectInstance ( 00154 RTI::ObjectHandle theObject, // supplied C1 00155 const char *theTag) // supplied C4 00156 throw ( 00157 RTI::ObjectNotKnown, 00158 RTI::FederateInternalError); 00159 00160 virtual void provideAttributeValueUpdate ( 00161 RTI::ObjectHandle theObject, 00162 const RTI::AttributeHandleSet& theAttributes) 00163 throw ( 00164 RTI::ObjectNotKnown, 00165 RTI::AttributeNotKnown, 00166 RTI::AttributeNotOwned, 00167 RTI::FederateInternalError); 00168 00169 virtual void timeRegulationEnabled ( 00170 const RTI::FedTime& theFederateTime) // supplied C4 00171 throw ( 00172 RTI::InvalidFederationTime, 00173 RTI::EnableTimeRegulationWasNotPending, 00174 RTI::FederateInternalError); 00175 00176 virtual void timeConstrainedEnabled ( 00177 const RTI::FedTime& theFederateTime) // supplied C4 00178 throw ( 00179 RTI::InvalidFederationTime, 00180 RTI::EnableTimeConstrainedWasNotPending, 00181 RTI::FederateInternalError); 00182 00183 virtual void timeAdvanceGrant ( 00184 const RTI::FedTime& theTime) // supplied C4 00185 throw ( 00186 RTI::InvalidFederationTime, 00187 RTI::TimeAdvanceWasNotInProgress, 00188 RTI::FederateInternalError); 00189 00190 virtual void synchronizationPointRegistrationSucceeded ( 00191 const char *label) // supplied C4) 00192 throw ( 00193 RTI::FederateInternalError); 00194 00195 00196 virtual void synchronizationPointRegistrationFailed ( 00197 const char *label) // supplied C4) 00198 throw ( 00199 RTI::FederateInternalError); 00200 00201 virtual void announceSynchronizationPoint ( 00202 const char *label, // supplied C4 00203 const char *tag) // supplied C4 00204 throw ( 00205 RTI::FederateInternalError); 00206 00207 virtual void federationSynchronized ( 00208 const char *label) // supplied C4) 00209 throw ( 00210 RTI::FederateInternalError); 00211 00212 00213 public: 00214 DtTalkAmbData & myData; 00215 }; 00216