MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
handleCreator.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2003 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: handleCreator.h,v $ $Revision: 1.12 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef handleCreator_H_
10 #define handleCreator_H_
11 
14 
15 #ifdef DtIFSPEC1516
16 
17 #include "handleImpl.h"
18 #include "internalTypes.h"
19 #include <vlutil/vlFedTarget.h>
20 #include <RTI/Handle.h>
21 #include <RTI/Typedefs.h>
22 
23 namespace rti1516
24 {
25 
30 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \
31  \
32 class HandleKind##Friend \
33 { \
34 public: \
35  HandleKind##Friend(); \
36  static rti1516::HandleKind HandleKind(Dt##HandleKind handleValue); \
37  static rti1516::HandleKind HandleKind( \
38  VariableLengthData const & encodedValue); \
39  static HandleKind##Implementation const* getImplementation( \
40  rti1516::HandleKind const& handle); \
41  static HandleKind##Implementation* getImplementation( \
42  rti1516::HandleKind& handle); \
43 }; \
44 inline HandleKind##Friend::HandleKind##Friend() \
45 { \
46 } \
47 inline rti1516::HandleKind HandleKind##Friend::HandleKind( \
48  Dt##HandleKind handleValue) \
49 { \
50  return rti1516::HandleKind( \
51  (HandleKind##Implementation*)handleValue); \
52 } \
53 inline rti1516::HandleKind HandleKind##Friend::HandleKind( \
54  VariableLengthData const & encodedValue) \
55 { \
56  return rti1516::HandleKind(encodedValue); \
57 } \
58 inline HandleKind##Implementation const * \
59 HandleKind##Friend::getImplementation(rti1516::HandleKind const& handle) \
60 { \
61  return handle.getImplementation(); \
62 } \
63 inline HandleKind##Implementation* \
64 HandleKind##Friend::getImplementation(rti1516::HandleKind & handle) \
65 { \
66  return handle.getImplementation(); \
67 } \
68  \
69 inline rti1516::HandleKind make##HandleKind(Dt##HandleKind handle) \
70 { \
71  return HandleKind##Friend::HandleKind(handle); \
72 } \
73  \
74 inline rti1516::HandleKind make##HandleKind( \
75  VariableLengthData const & encodedValue) \
76 { \
77  return HandleKind##Friend::HandleKind(encodedValue); \
78 } \
79  \
80 inline Dt##HandleKind make##HandleKind##Impl(rti1516::HandleKind handle) \
81 { \
82  return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \
83 }
84 
87 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \
88  \
89 inline void fill##HandleKind##SetImpl( \
90  rti1516::HandleKind##Set const & rtiHandleSet, \
91  Dt##HandleKind##Set & internHandleSet) \
92 { \
93  for (rti1516::HandleKind##Set::const_iterator iter = rtiHandleSet.begin(); \
94  iter != rtiHandleSet.end(); \
95  iter++) \
96  { \
97  internHandleSet.insert(make##HandleKind##Impl(*iter)); \
98  } \
99 }
100 
103 #define DEFINE_FILL_HANDLE_SET(HandleKind) \
104  \
105 inline void fill##HandleKind##Set( \
106  Dt##HandleKind##Set const & internHandleSet, \
107  rti1516::HandleKind##Set & rtiHandleSet) \
108 { \
109  for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \
110  iter != internHandleSet.end(); \
111  iter++) \
112  { \
113  rtiHandleSet.insert(make##HandleKind(*iter)); \
114  } \
115 }
116 
117 DEFINE_HANDLE_CLASS_FRIEND(FederateHandle)
118 DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle)
119 DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle)
120 DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle)
121 DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle)
122 DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle)
123 DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle)
124 DEFINE_HANDLE_CLASS_FRIEND(RegionHandle)
125 
126 DEFINE_FILL_HANDLE_SET(DimensionHandle)
127 DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle)
128 DEFINE_FILL_HANDLE_SET(RegionHandle)
129 DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle)
130 
134 class MessageRetractionHandleFriend
135 {
136 public:
137  MessageRetractionHandleFriend();
138  static rti1516::MessageRetractionHandle MessageRetractionHandle(
139  DtMessageRetractionHandle handleValue);
140  static rti1516::MessageRetractionHandle MessageRetractionHandle(
141  VariableLengthData const & encodedValue);
142  static MessageRetractionHandleImplementation const* getImplementation(
143  rti1516::MessageRetractionHandle const& handle);
144  static MessageRetractionHandleImplementation* getImplementation(
145  rti1516::MessageRetractionHandle& handle);
146 };
147 inline MessageRetractionHandleFriend::MessageRetractionHandleFriend()
148 {
149 }
150 inline rti1516::MessageRetractionHandle
151 MessageRetractionHandleFriend::MessageRetractionHandle(
152  DtMessageRetractionHandle handleValue)
153 {
154  return rti1516::MessageRetractionHandle(
155  (MessageRetractionHandleImplementation*)&handleValue);
156 }
157 inline rti1516::MessageRetractionHandle
158 MessageRetractionHandleFriend::MessageRetractionHandle(
159  VariableLengthData const & encodedValue)
160 {
161  return rti1516::MessageRetractionHandle(encodedValue);
162 }
163 inline MessageRetractionHandleImplementation const *
164 MessageRetractionHandleFriend::getImplementation(
165  rti1516::MessageRetractionHandle const& handle)
166 {
167  return handle.getImplementation();
168 }
169 inline MessageRetractionHandleImplementation*
170 MessageRetractionHandleFriend::getImplementation(
171  rti1516::MessageRetractionHandle & handle)
172 {
173  return handle.getImplementation();
174 }
175 
176 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
178 {
179  return MessageRetractionHandleFriend::MessageRetractionHandle(handle);
180 }
181 
182 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
183  VariableLengthData const & encodedValue)
184 {
185  return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue);
186 }
187 
188 inline DtMessageRetractionHandle makeMessageRetractionHandleImpl(
189  rti1516::MessageRetractionHandle handle)
190 {
191  return MessageRetractionHandleFriend::getImplementation(handle)->value();
192 }
193 
194 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
195  DtFederateHandle fedHandle, unsigned long serialNumber)
196 {
197  DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle};
198  return makeMessageRetractionHandle(handleImpl);
199 };
200 
201 inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516::OrderType order)
202 {
203  return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp;
204 }
205 
206 inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516::TransportationType transport)
207 {
208  return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort;
209 }
210 
211 inline rti1516::OrderType makeOrderType(MAKRti::DtOrderType order)
212 {
213  return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP;
214 }
215 
216 inline rti1516::TransportationType makeTransportType(MAKRti::DtTransportType transport)
217 {
218  return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT;
219 }
220 
221 };
222 
223 #elif defined(DtIFSPEC1516E)
224 
225 #include "handleImpl.h"
226 #include "internalTypes.h"
227 #include <vlutil/vlFedTarget.h>
228 #include <RTI/Handle.h>
229 #include <RTI/Typedefs.h>
230 
231 namespace rti1516e
232 {
233 
238 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \
239  \
240 class HandleKind##Friend \
241 { \
242 public: \
243  HandleKind##Friend(); \
244  static rti1516e::HandleKind HandleKind(Dt##HandleKind handleValue); \
245  static rti1516e::HandleKind HandleKind( \
246  VariableLengthData const & encodedValue); \
247  static HandleKind##Implementation const* getImplementation( \
248  rti1516e::HandleKind const& handle); \
249  static HandleKind##Implementation* getImplementation( \
250  rti1516e::HandleKind& handle); \
251 }; \
252 inline HandleKind##Friend::HandleKind##Friend() \
253 { \
254 } \
255 inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
256  Dt##HandleKind handleValue) \
257 { \
258  return rti1516e::HandleKind((HandleKind##Implementation*)handleValue); \
259 } \
260 inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
261  VariableLengthData const & encodedValue) \
262 { \
263  return rti1516e::HandleKind(encodedValue); \
264 } \
265 inline HandleKind##Implementation const * \
266 HandleKind##Friend::getImplementation(rti1516e::HandleKind const& handle) \
267 { \
268  return handle.getImplementation(); \
269 } \
270 inline HandleKind##Implementation* \
271 HandleKind##Friend::getImplementation(rti1516e::HandleKind & handle) \
272 { \
273  return handle.getImplementation(); \
274 } \
275  \
276 inline rti1516e::HandleKind make##HandleKind(Dt##HandleKind handle) \
277 { \
278  return HandleKind##Friend::HandleKind(handle); \
279 } \
280  \
281 inline rti1516e::HandleKind make##HandleKind( \
282  VariableLengthData const & encodedValue) \
283 { \
284  return HandleKind##Friend::HandleKind(encodedValue); \
285 } \
286  \
287 inline Dt##HandleKind make##HandleKind##Impl(const rti1516e::HandleKind& handle)\
288 { \
289  return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \
290 }
291 
294 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \
295  \
296 inline void fill##HandleKind##SetImpl( \
297  rti1516e::HandleKind##Set const & rtiHandleSet, \
298  Dt##HandleKind##Set & internHandleSet) \
299 { \
300  for (rti1516e::HandleKind##Set::const_iterator iter = rtiHandleSet.begin();\
301  iter != rtiHandleSet.end(); \
302  iter++) \
303  { \
304  internHandleSet.insert(make##HandleKind##Impl(*iter)); \
305  } \
306 }
307 
310 #define DEFINE_FILL_HANDLE_SET(HandleKind) \
311  \
312 inline void fill##HandleKind##Set( \
313  Dt##HandleKind##Set const & internHandleSet, \
314  rti1516e::HandleKind##Set & rtiHandleSet) \
315 { \
316  for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \
317  iter != internHandleSet.end(); \
318  iter++) \
319  { \
320  rtiHandleSet.insert(make##HandleKind(*iter)); \
321  } \
322 }
323 
324 DEFINE_HANDLE_CLASS_FRIEND(FederateHandle)
325 DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle)
326 DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle)
327 DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle)
328 DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle)
329 DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle)
330 DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle)
331 DEFINE_HANDLE_CLASS_FRIEND(RegionHandle)
332 
333 DEFINE_FILL_HANDLE_SET(DimensionHandle)
334 DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle)
335 DEFINE_FILL_HANDLE_SET(RegionHandle)
336 DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle)
337 
341 class MessageRetractionHandleFriend
342 {
343 public:
344  MessageRetractionHandleFriend();
345  static rti1516e::MessageRetractionHandle MessageRetractionHandle(
346  DtMessageRetractionHandle handleValue);
347  static rti1516e::MessageRetractionHandle MessageRetractionHandle(
348  VariableLengthData const & encodedValue);
349  static MessageRetractionHandleImplementation const* getImplementation(
350  rti1516e::MessageRetractionHandle const& handle);
351  static MessageRetractionHandleImplementation* getImplementation(
352  rti1516e::MessageRetractionHandle& handle);
353 };
354 inline MessageRetractionHandleFriend::MessageRetractionHandleFriend()
355 {
356 }
357 inline rti1516e::MessageRetractionHandle
358 MessageRetractionHandleFriend::MessageRetractionHandle(
359  DtMessageRetractionHandle handleValue)
360 {
361  return rti1516e::MessageRetractionHandle(
362  (MessageRetractionHandleImplementation*)&handleValue);
363 }
364 inline rti1516e::MessageRetractionHandle
365 MessageRetractionHandleFriend::MessageRetractionHandle(
366  VariableLengthData const & encodedValue)
367 {
368  return rti1516e::MessageRetractionHandle(encodedValue);
369 }
370 inline MessageRetractionHandleImplementation const *
371 MessageRetractionHandleFriend::getImplementation(
372  rti1516e::MessageRetractionHandle const& handle)
373 {
374  return handle.getImplementation();
375 }
376 inline MessageRetractionHandleImplementation*
377 MessageRetractionHandleFriend::getImplementation(
378  rti1516e::MessageRetractionHandle & handle)
379 {
380  return handle.getImplementation();
381 }
382 
383 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
385 {
386  return MessageRetractionHandleFriend::MessageRetractionHandle(handle);
387 }
388 
389 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
390  VariableLengthData const & encodedValue)
391 {
392  return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue);
393 }
394 
395 inline DtMessageRetractionHandle makeMessageRetractionHandleImpl(
396  rti1516e::MessageRetractionHandle handle)
397 {
398  return MessageRetractionHandleFriend::getImplementation(handle)->value();
399 }
400 
401 inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
402  DtFederateHandle fedHandle, unsigned long serialNumber)
403 {
404  DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle};
405  return makeMessageRetractionHandle(handleImpl);
406 };
407 
408 inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516e::OrderType order)
409 {
410  return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp;
411 }
412 
413 inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516e::TransportationType transport)
414 {
415  return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort;
416 }
417 
418 inline rti1516e::OrderType makeOrderType(MAKRti::DtOrderType order)
419 {
420  return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP;
421 }
422 
423 inline rti1516e::TransportationType makeTransportType(MAKRti::DtTransportType transport)
424 {
425  return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT;
426 }
427 
428 };
429 
430 #endif
431 #endif
Definition: Enums.h:100
Definition: Enums.h:29
This file contains the designator or handle classes used by the interface.
DtHandle DtFederateHandle
Definition: internalTypes.h:29
This file contains the standard RTI types that are defined in namespace rti1516.
OrderType
Definition: Enums.h:27
Definition: internalTypes.h:63
TransportationType
Definition: Enums.h:97
The declaration of internal types.
Definition: Enums.h:99
Definition: Enums.h:30

Document ID: Generated on Thu May 11 15:55:32 EDT 2023 from SVN revision 254743
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)