![]() |
MAK RTIspy API Documentation for HLA 1516
|
00001 /********************************************************************* 00002 ** Copyright (c) 2003 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: handleCreator.h,v $ $Revision: 1.12 $ $State: Exp $ 00007 *********************************************************************/ 00008 00009 #ifndef handleCreator_H_ 00010 #define handleCreator_H_ 00011 00014 00015 #ifdef DtIFSPEC1516 00016 00017 #include "handleImpl.h" 00018 #include "internalTypes.h" 00019 #include <vlutil/vlFedTarget.h> 00020 #include <RTI/Handle.h> 00021 #include <RTI/Typedefs.h> 00022 00023 namespace rti1516 00024 { 00025 00030 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \ 00031 \ 00032 class HandleKind##Friend \ 00033 { \ 00034 public: \ 00035 HandleKind##Friend(); \ 00036 static rti1516::HandleKind HandleKind(Dt##HandleKind handleValue); \ 00037 static rti1516::HandleKind HandleKind( \ 00038 VariableLengthData const & encodedValue); \ 00039 static HandleKind##Implementation const* \ 00040 getImplementation(rti1516::HandleKind const& handle); \ 00041 static HandleKind##Implementation* getImplementation( \ 00042 rti1516::HandleKind& handle); \ 00043 }; \ 00044 inline HandleKind##Friend::HandleKind##Friend() \ 00045 { \ 00046 } \ 00047 inline rti1516::HandleKind HandleKind##Friend::HandleKind( \ 00048 Dt##HandleKind handleValue) \ 00049 { \ 00050 return rti1516::HandleKind( \ 00051 (HandleKind##Implementation*)handleValue); \ 00052 } \ 00053 inline rti1516::HandleKind HandleKind##Friend::HandleKind( \ 00054 VariableLengthData const & encodedValue) \ 00055 { \ 00056 return rti1516::HandleKind(encodedValue); \ 00057 } \ 00058 inline HandleKind##Implementation const * \ 00059 HandleKind##Friend::getImplementation(rti1516::HandleKind const& handle) \ 00060 { \ 00061 return handle.getImplementation(); \ 00062 } \ 00063 inline HandleKind##Implementation* \ 00064 HandleKind##Friend::getImplementation(rti1516::HandleKind & handle) \ 00065 { \ 00066 return handle.getImplementation(); \ 00067 } \ 00068 inline rti1516::HandleKind make##HandleKind(Dt##HandleKind handle) \ 00069 { \ 00070 return HandleKind##Friend::HandleKind(handle); \ 00071 } \ 00072 inline rti1516::HandleKind make##HandleKind( \ 00073 VariableLengthData const & encodedValue) \ 00074 { \ 00075 return HandleKind##Friend::HandleKind(encodedValue); \ 00076 } \ 00077 inline Dt##HandleKind make##HandleKind##Impl(rti1516::HandleKind handle) \ 00078 { \ 00079 return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \ 00080 } 00081 00084 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \ 00085 inline void fill##HandleKind##SetImpl( \ 00086 rti1516::HandleKind##Set const & rtiHandleSet, \ 00087 Dt##HandleKind##Set & internHandleSet) \ 00088 { \ 00089 for (rti1516::HandleKind##Set::const_iterator iter = rtiHandleSet.begin(); \ 00090 iter != rtiHandleSet.end(); \ 00091 iter++) \ 00092 { \ 00093 internHandleSet.insert(make##HandleKind##Impl(*iter)); \ 00094 } \ 00095 } 00096 00099 #define DEFINE_FILL_HANDLE_SET(HandleKind) \ 00100 inline void fill##HandleKind##Set( \ 00101 Dt##HandleKind##Set const & internHandleSet, \ 00102 rti1516::HandleKind##Set & rtiHandleSet) \ 00103 { \ 00104 for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \ 00105 iter != internHandleSet.end(); \ 00106 iter++) \ 00107 { \ 00108 rtiHandleSet.insert(make##HandleKind(*iter)); \ 00109 } \ 00110 } 00111 00112 DEFINE_HANDLE_CLASS_FRIEND(FederateHandle) 00113 DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle) 00114 DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle) 00115 DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle) 00116 DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle) 00117 DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle) 00118 DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle) 00119 DEFINE_HANDLE_CLASS_FRIEND(RegionHandle) 00120 00121 DEFINE_FILL_HANDLE_SET(DimensionHandle) 00122 DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle) 00123 DEFINE_FILL_HANDLE_SET(RegionHandle) 00124 DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle) 00125 00129 class MessageRetractionHandleFriend 00130 { 00131 public: 00132 MessageRetractionHandleFriend(); 00133 static rti1516::MessageRetractionHandle MessageRetractionHandle( 00134 DtMessageRetractionHandle handleValue); 00135 static rti1516::MessageRetractionHandle MessageRetractionHandle( 00136 VariableLengthData const & encodedValue); 00137 static MessageRetractionHandleImplementation const* 00138 getImplementation(rti1516::MessageRetractionHandle const& handle); 00139 static MessageRetractionHandleImplementation* getImplementation( 00140 rti1516::MessageRetractionHandle& handle); 00141 }; 00142 inline MessageRetractionHandleFriend::MessageRetractionHandleFriend() 00143 { 00144 } 00145 inline rti1516::MessageRetractionHandle 00146 MessageRetractionHandleFriend::MessageRetractionHandle( 00147 DtMessageRetractionHandle handleValue) 00148 { 00149 return rti1516::MessageRetractionHandle( 00150 (MessageRetractionHandleImplementation*)&handleValue); 00151 } 00152 inline rti1516::MessageRetractionHandle 00153 MessageRetractionHandleFriend::MessageRetractionHandle( 00154 VariableLengthData const & encodedValue) 00155 { 00156 return rti1516::MessageRetractionHandle(encodedValue); 00157 } 00158 inline MessageRetractionHandleImplementation const * 00159 MessageRetractionHandleFriend::getImplementation( 00160 rti1516::MessageRetractionHandle const& handle) 00161 { 00162 return handle.getImplementation(); 00163 } 00164 inline MessageRetractionHandleImplementation* 00165 MessageRetractionHandleFriend::getImplementation( 00166 rti1516::MessageRetractionHandle & handle) 00167 { 00168 return handle.getImplementation(); 00169 } 00170 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle( 00171 DtMessageRetractionHandle handle) 00172 { 00173 return MessageRetractionHandleFriend::MessageRetractionHandle(handle); 00174 00175 } 00176 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle( 00177 VariableLengthData const & encodedValue) 00178 { 00179 return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue); 00180 00181 } 00182 inline DtMessageRetractionHandle makeMessageRetractionHandleImpl( 00183 rti1516::MessageRetractionHandle handle) 00184 { 00185 return MessageRetractionHandleFriend::getImplementation(handle)->value(); 00186 } 00187 00188 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle( 00189 DtFederateHandle fedHandle, unsigned long serialNumber) 00190 { 00191 DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle}; 00192 return makeMessageRetractionHandle(handleImpl); 00193 }; 00194 00195 inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516::OrderType order) 00196 { 00197 return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp; 00198 } 00199 00200 inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516::TransportationType transport) 00201 { 00202 return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort; 00203 } 00204 00205 inline rti1516::OrderType makeOrderType(MAKRti::DtOrderType order) 00206 { 00207 return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP; 00208 } 00209 00210 inline rti1516::TransportationType makeTransportType(MAKRti::DtTransportType transport) 00211 { 00212 return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT; 00213 } 00214 00215 00216 }; 00217 #elif defined(DtIFSPEC1516E) 00218 00219 00220 #include "handleImpl.h" 00221 #include "internalTypes.h" 00222 #include <vlutil/vlFedTarget.h> 00223 #include <RTI/Handle.h> 00224 #include <RTI/Typedefs.h> 00225 00226 namespace rti1516e 00227 { 00228 00233 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \ 00234 \ 00235 class HandleKind##Friend \ 00236 { \ 00237 public: \ 00238 HandleKind##Friend(); \ 00239 static rti1516e::HandleKind HandleKind(Dt##HandleKind handleValue); \ 00240 static rti1516e::HandleKind HandleKind( \ 00241 VariableLengthData const & encodedValue); \ 00242 static HandleKind##Implementation const* \ 00243 getImplementation(rti1516e::HandleKind const& handle); \ 00244 static HandleKind##Implementation* getImplementation( \ 00245 rti1516e::HandleKind& handle); \ 00246 }; \ 00247 inline HandleKind##Friend::HandleKind##Friend() \ 00248 { \ 00249 } \ 00250 inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \ 00251 Dt##HandleKind handleValue) \ 00252 { \ 00253 return rti1516e::HandleKind( \ 00254 (HandleKind##Implementation*)handleValue); \ 00255 } \ 00256 inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \ 00257 VariableLengthData const & encodedValue) \ 00258 { \ 00259 return rti1516e::HandleKind(encodedValue); \ 00260 } \ 00261 inline HandleKind##Implementation const * \ 00262 HandleKind##Friend::getImplementation(rti1516e::HandleKind const& handle) \ 00263 { \ 00264 return handle.getImplementation(); \ 00265 } \ 00266 inline HandleKind##Implementation* \ 00267 HandleKind##Friend::getImplementation(rti1516e::HandleKind & handle) \ 00268 { \ 00269 return handle.getImplementation(); \ 00270 } \ 00271 inline rti1516e::HandleKind make##HandleKind(Dt##HandleKind handle) \ 00272 { \ 00273 return HandleKind##Friend::HandleKind(handle); \ 00274 } \ 00275 inline rti1516e::HandleKind make##HandleKind( \ 00276 VariableLengthData const & encodedValue) \ 00277 { \ 00278 return HandleKind##Friend::HandleKind(encodedValue); \ 00279 } \ 00280 inline Dt##HandleKind make##HandleKind##Impl(rti1516e::HandleKind handle) \ 00281 { \ 00282 return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \ 00283 } 00284 00287 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \ 00288 inline void fill##HandleKind##SetImpl( \ 00289 rti1516e::HandleKind##Set const & rtiHandleSet, \ 00290 Dt##HandleKind##Set & internHandleSet) \ 00291 { \ 00292 for (rti1516e::HandleKind##Set::const_iterator iter = rtiHandleSet.begin(); \ 00293 iter != rtiHandleSet.end(); \ 00294 iter++) \ 00295 { \ 00296 internHandleSet.insert(make##HandleKind##Impl(*iter)); \ 00297 } \ 00298 } 00299 00302 #define DEFINE_FILL_HANDLE_SET(HandleKind) \ 00303 inline void fill##HandleKind##Set( \ 00304 Dt##HandleKind##Set const & internHandleSet, \ 00305 rti1516e::HandleKind##Set & rtiHandleSet) \ 00306 { \ 00307 for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \ 00308 iter != internHandleSet.end(); \ 00309 iter++) \ 00310 { \ 00311 rtiHandleSet.insert(make##HandleKind(*iter)); \ 00312 } \ 00313 } 00314 00315 DEFINE_HANDLE_CLASS_FRIEND(FederateHandle) 00316 DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle) 00317 DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle) 00318 DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle) 00319 DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle) 00320 DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle) 00321 DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle) 00322 DEFINE_HANDLE_CLASS_FRIEND(RegionHandle) 00323 00324 DEFINE_FILL_HANDLE_SET(DimensionHandle) 00325 DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle) 00326 DEFINE_FILL_HANDLE_SET(RegionHandle) 00327 DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle) 00328 00332 class MessageRetractionHandleFriend 00333 { 00334 public: 00335 MessageRetractionHandleFriend(); 00336 static rti1516e::MessageRetractionHandle MessageRetractionHandle( 00337 DtMessageRetractionHandle handleValue); 00338 static rti1516e::MessageRetractionHandle MessageRetractionHandle( 00339 VariableLengthData const & encodedValue); 00340 static MessageRetractionHandleImplementation const* 00341 getImplementation(rti1516e::MessageRetractionHandle const& handle); 00342 static MessageRetractionHandleImplementation* getImplementation( 00343 rti1516e::MessageRetractionHandle& handle); 00344 }; 00345 inline MessageRetractionHandleFriend::MessageRetractionHandleFriend() 00346 { 00347 } 00348 inline rti1516e::MessageRetractionHandle 00349 MessageRetractionHandleFriend::MessageRetractionHandle( 00350 DtMessageRetractionHandle handleValue) 00351 { 00352 return rti1516e::MessageRetractionHandle( 00353 (MessageRetractionHandleImplementation*)&handleValue); 00354 } 00355 inline rti1516e::MessageRetractionHandle 00356 MessageRetractionHandleFriend::MessageRetractionHandle( 00357 VariableLengthData const & encodedValue) 00358 { 00359 return rti1516e::MessageRetractionHandle(encodedValue); 00360 } 00361 inline MessageRetractionHandleImplementation const * 00362 MessageRetractionHandleFriend::getImplementation( 00363 rti1516e::MessageRetractionHandle const& handle) 00364 { 00365 return handle.getImplementation(); 00366 } 00367 inline MessageRetractionHandleImplementation* 00368 MessageRetractionHandleFriend::getImplementation( 00369 rti1516e::MessageRetractionHandle & handle) 00370 { 00371 return handle.getImplementation(); 00372 } 00373 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle( 00374 DtMessageRetractionHandle handle) 00375 { 00376 return MessageRetractionHandleFriend::MessageRetractionHandle(handle); 00377 00378 } 00379 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle( 00380 VariableLengthData const & encodedValue) 00381 { 00382 return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue); 00383 00384 } 00385 inline DtMessageRetractionHandle makeMessageRetractionHandleImpl( 00386 rti1516e::MessageRetractionHandle handle) 00387 { 00388 return MessageRetractionHandleFriend::getImplementation(handle)->value(); 00389 } 00390 00391 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle( 00392 DtFederateHandle fedHandle, unsigned long serialNumber) 00393 { 00394 DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle}; 00395 return makeMessageRetractionHandle(handleImpl); 00396 }; 00397 00398 inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516e::OrderType order) 00399 { 00400 return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp; 00401 } 00402 00403 inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516e::TransportationType transport) 00404 { 00405 return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort; 00406 } 00407 00408 inline rti1516e::OrderType makeOrderType(MAKRti::DtOrderType order) 00409 { 00410 return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP; 00411 } 00412 00413 inline rti1516e::TransportationType makeTransportType(MAKRti::DtTransportType transport) 00414 { 00415 return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT; 00416 } 00417 00418 00419 }; 00420 00421 #endif //! DtIFSPEC1516 00422 #endif //! handleCreator_H_