![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2004 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: simpleTimeFedAmb1516.h,v $ $Revision: 1.2 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef MyFederateAmbassador_H_ 00010 #define MyFederateAmbassador_H_ 00011 00012 #ifdef WIN32 00013 #pragma warning(disable: 4251) 00014 #pragma warning(disable: 4786) 00015 #pragma warning(disable: 4290) 00016 #endif 00017 00018 #include <RTI/Enums.h> 00019 #include <RTI/Typedefs.h> 00020 #include <RTI/RTI1516.h> 00021 #include <RTI/NullFederateAmbassador.h> 00022 #include "simpleTimeStringUtil.h" 00023 #include "simpleTimeTimeManagedEntity.h" 00024 #include <string> 00025 #include <map> 00026 00027 using namespace rti1516e; 00028 00029 typedef std::map<std::wstring, AttributeHandle> DtAttrNameHandleMap; 00030 typedef std::map<std::wstring, ParameterHandle> DtParamNameHandleMap; 00031 00032 class DtTalkAmbData 00033 { 00034 00035 public: 00036 DtTalkAmbData(); 00037 ~DtTalkAmbData(); 00038 00039 00040 public: 00041 bool myNameReservationReturned; 00042 bool myNameReservationSucceeded; 00043 std::map<ObjectClassHandle, std::wstring> objectClassMap; 00044 std::map<ObjectInstanceHandle, std::wstring> objectInstanceMap; 00045 std::map<InteractionClassHandle,std::wstring> interactionClassMap; 00046 std::map<ObjectInstanceHandle, AttributeHandleSet*> updateRequestMap; 00047 00048 // Map between strings and attribute handles 00049 DtAttrNameHandleMap theAttrNameHandleMap; 00050 00051 // Map between strings and paramterHandles 00052 DtParamNameHandleMap theParamNameHandleMap; 00053 00054 // The set of Attributes that this federate's published objects will contain. 00055 std::set<std::string> ourAttrs; 00056 00057 // the Set of Parameters that this federate's published interactions will contain. 00058 std::set<std::string> ourParms; 00059 00060 // This federation of simple objects has a single master object, (determined by command line arguments) 00061 // The master federate will keep the other federates from entering their main loop of execution until 00062 // all of numFederates have joined. 00063 bool isMaster; 00064 00065 // numFederates is the number of federates (including the master) that the master should wait to join the 00066 // federation before it allows any federate to enter its main loop. 00067 // This variable is only used by the master federate. 00068 int numFederates; 00069 00070 AttributeHandleValueMap* attrValues; 00071 ParameterHandleValueMap* paramValues; 00072 bool isConstrained; 00073 bool isRegulating; 00074 bool timeAdvanced; 00075 int otherFederatesReady; 00076 bool registerFailed; 00077 bool registerSucceeded; 00078 bool announceSyncReceived; 00079 bool federationIsSynchronized; 00080 timeManagedEntity timeManagedObject; 00081 }; 00082 00083 class MyFederateAmbassador : public NullFederateAmbassador 00084 { 00085 public: 00086 MyFederateAmbassador(DtTalkAmbData & data); 00087 00088 virtual ~MyFederateAmbassador () 00089 throw () ; 00090 00091 // 6.3 00092 virtual 00093 void 00094 objectInstanceNameReservationSucceeded(std::wstring const & 00095 theObjectInstanceName) 00096 throw (FederateInternalError); 00097 00098 virtual 00099 void 00100 objectInstanceNameReservationFailed(std::wstring const & 00101 theObjectInstanceName) 00102 throw (FederateInternalError); 00103 00104 // 6.5 00105 virtual void discoverObjectInstance ( 00106 ObjectInstanceHandle theObject, 00107 ObjectClassHandle theObjectClass, 00108 std::wstring const & theObjectInstanceName) 00109 throw (FederateInternalError); 00110 00111 virtual void discoverObjectInstance ( 00112 ObjectInstanceHandle theObject, 00113 ObjectClassHandle theObjectClass, 00114 std::wstring const & theObjectInstanceName, 00115 FederateHandle producingFederate) 00116 throw ( 00117 FederateInternalError); 00118 00119 // 6.11 00120 virtual void reflectAttributeValues ( 00121 ObjectInstanceHandle theObject, 00122 AttributeHandleValueMap const & theAttributeValues, 00123 VariableLengthData const & theUserSuppliedTag, 00124 OrderType sentOrder, 00125 TransportationType theType, 00126 SupplementalReflectInfo theReflectInfo) 00127 throw ( 00128 FederateInternalError); 00129 00130 virtual void reflectAttributeValues ( 00131 ObjectInstanceHandle theObject, 00132 AttributeHandleValueMap const & theAttributeValues, 00133 VariableLengthData const & theUserSuppliedTag, 00134 OrderType sentOrder, 00135 TransportationType theType, 00136 LogicalTime const & theTime, 00137 OrderType receivedOrder, 00138 SupplementalReflectInfo theReflectInfo) 00139 throw ( 00140 FederateInternalError); 00141 00142 virtual void reflectAttributeValues ( 00143 ObjectInstanceHandle theObject, 00144 AttributeHandleValueMap const & theAttributeValues, 00145 VariableLengthData const & theUserSuppliedTag, 00146 OrderType sentOrder, 00147 TransportationType theType, 00148 LogicalTime const & theTime, 00149 OrderType receivedOrder, 00150 MessageRetractionHandle theHandle, 00151 SupplementalReflectInfo theReflectInfo) 00152 throw ( 00153 FederateInternalError); 00154 00155 // 6.13 00156 virtual void receiveInteraction ( 00157 InteractionClassHandle theInteraction, 00158 ParameterHandleValueMap const & theParameterValues, 00159 VariableLengthData const & theUserSuppliedTag, 00160 OrderType sentOrder, 00161 TransportationType theType, 00162 SupplementalReceiveInfo theReceiveInfo) 00163 throw ( 00164 FederateInternalError); 00165 00166 virtual void receiveInteraction ( 00167 InteractionClassHandle theInteraction, 00168 ParameterHandleValueMap const & theParameterValues, 00169 VariableLengthData const & theUserSuppliedTag, 00170 OrderType sentOrder, 00171 TransportationType theType, 00172 LogicalTime const & theTime, 00173 OrderType receivedOrder, 00174 SupplementalReceiveInfo theReceiveInfo) 00175 throw ( 00176 FederateInternalError); 00177 00178 virtual void receiveInteraction ( 00179 InteractionClassHandle theInteraction, 00180 ParameterHandleValueMap const & theParameterValues, 00181 VariableLengthData const & theUserSuppliedTag, 00182 OrderType sentOrder, 00183 TransportationType theType, 00184 LogicalTime const & theTime, 00185 OrderType receivedOrder, 00186 MessageRetractionHandle theHandle, 00187 SupplementalReceiveInfo theReceiveInfo) 00188 throw ( 00189 FederateInternalError); 00190 00191 // 6.15 00192 virtual void removeObjectInstance ( 00193 ObjectInstanceHandle theObject, 00194 VariableLengthData const & theUserSuppliedTag, 00195 OrderType sentOrder, 00196 SupplementalRemoveInfo theRemoveInfo) 00197 throw ( 00198 FederateInternalError); 00199 virtual void removeObjectInstance ( 00200 ObjectInstanceHandle theObject, 00201 VariableLengthData const & theUserSuppliedTag, 00202 OrderType sentOrder, 00203 LogicalTime const & theTime, 00204 OrderType receivedOrder, 00205 SupplementalRemoveInfo theRemoveInfo) 00206 throw ( 00207 FederateInternalError); 00208 00209 virtual void removeObjectInstance ( 00210 ObjectInstanceHandle theObject, 00211 VariableLengthData const & theUserSuppliedTag, 00212 OrderType sentOrder, 00213 LogicalTime const & theTime, 00214 OrderType receivedOrder, 00215 MessageRetractionHandle theHandle, 00216 SupplementalRemoveInfo theRemoveInfo) 00217 throw ( 00218 FederateInternalError); 00219 00220 virtual 00221 void 00222 provideAttributeValueUpdate(ObjectInstanceHandle theObject, 00223 AttributeHandleSet const & theAttributes, 00224 VariableLengthData const & theUserSuppliedTag) 00225 throw ( 00226 FederateInternalError); 00227 00228 virtual 00229 void 00230 timeRegulationEnabled(LogicalTime const & theFederateTime) 00231 throw ( 00232 FederateInternalError); 00233 00234 00235 virtual 00236 void 00237 timeConstrainedEnabled(LogicalTime const & theFederateTime) 00238 throw ( 00239 FederateInternalError); 00240 00241 virtual 00242 void 00243 timeAdvanceGrant(LogicalTime const & theTime) 00244 throw ( 00245 FederateInternalError); 00246 00247 virtual 00248 void 00249 requestRetraction(MessageRetractionHandle theHandle) 00250 throw (FederateInternalError); 00251 00252 00253 virtual 00254 void 00255 synchronizationPointRegistrationSucceeded(std::wstring const & label ) 00256 throw (FederateInternalError); 00257 virtual 00258 void 00259 synchronizationPointRegistrationFailed(std::wstring const & label, 00260 SynchronizationPointFailureReason reason) 00261 throw (FederateInternalError); 00262 00263 virtual 00264 void 00265 announceSynchronizationPoint(std::wstring const & label, 00266 VariableLengthData const & theUserSuppliedTag) 00267 throw (FederateInternalError); 00268 00269 virtual void federationSynchronized ( 00270 std::wstring const & label, 00271 FederateHandleSet const& failedToSyncSet) 00272 throw ( 00273 FederateInternalError); 00274 00275 00276 public: 00277 DtTalkAmbData & myData; 00278 }; 00279 00280 #endif 00281 00282