MAK RTIspy API Documentation for HLA 1516
 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* \
40  getImplementation(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 inline rti1516::HandleKind make##HandleKind(Dt##HandleKind handle) \
69 { \
70  return HandleKind##Friend::HandleKind(handle); \
71 } \
72 inline rti1516::HandleKind make##HandleKind( \
73  VariableLengthData const & encodedValue) \
74 { \
75  return HandleKind##Friend::HandleKind(encodedValue); \
76 } \
77 inline Dt##HandleKind make##HandleKind##Impl(rti1516::HandleKind handle) \
78 { \
79  return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \
80 }
81 
84 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \
85 inline void fill##HandleKind##SetImpl( \
86  rti1516::HandleKind##Set const & rtiHandleSet, \
87  Dt##HandleKind##Set & internHandleSet) \
88 { \
89  for (rti1516::HandleKind##Set::const_iterator iter = rtiHandleSet.begin(); \
90  iter != rtiHandleSet.end(); \
91  iter++) \
92  { \
93  internHandleSet.insert(make##HandleKind##Impl(*iter)); \
94  } \
95 }
96 
99 #define DEFINE_FILL_HANDLE_SET(HandleKind) \
100 inline void fill##HandleKind##Set( \
101  Dt##HandleKind##Set const & internHandleSet, \
102  rti1516::HandleKind##Set & rtiHandleSet) \
103 { \
104  for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \
105  iter != internHandleSet.end(); \
106  iter++) \
107  { \
108  rtiHandleSet.insert(make##HandleKind(*iter)); \
109  } \
110 }
111 
112 DEFINE_HANDLE_CLASS_FRIEND(FederateHandle)
113 DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle)
114 DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle)
115 DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle)
116 DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle)
117 DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle)
118 DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle)
119 DEFINE_HANDLE_CLASS_FRIEND(RegionHandle)
120 
121 DEFINE_FILL_HANDLE_SET(DimensionHandle)
122 DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle)
123 DEFINE_FILL_HANDLE_SET(RegionHandle)
124 DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle)
125 
129 class MessageRetractionHandleFriend
130 {
131 public:
132  MessageRetractionHandleFriend();
133  static rti1516::MessageRetractionHandle MessageRetractionHandle(
134  DtMessageRetractionHandle handleValue);
135  static rti1516::MessageRetractionHandle MessageRetractionHandle(
136  VariableLengthData const & encodedValue);
137  static MessageRetractionHandleImplementation const*
138  getImplementation(rti1516::MessageRetractionHandle const& handle);
139  static MessageRetractionHandleImplementation* getImplementation(
140  rti1516::MessageRetractionHandle& handle);
141 };
142 inline MessageRetractionHandleFriend::MessageRetractionHandleFriend()
143 {
144 }
145 inline rti1516::MessageRetractionHandle
146 MessageRetractionHandleFriend::MessageRetractionHandle(
147  DtMessageRetractionHandle handleValue)
148 {
149  return rti1516::MessageRetractionHandle(
150  (MessageRetractionHandleImplementation*)&handleValue);
151 }
152 inline rti1516::MessageRetractionHandle
153 MessageRetractionHandleFriend::MessageRetractionHandle(
154  VariableLengthData const & encodedValue)
155 {
156  return rti1516::MessageRetractionHandle(encodedValue);
157 }
158 inline MessageRetractionHandleImplementation const *
159 MessageRetractionHandleFriend::getImplementation(
160  rti1516::MessageRetractionHandle const& handle)
161 {
162  return handle.getImplementation();
163 }
164 inline MessageRetractionHandleImplementation*
165 MessageRetractionHandleFriend::getImplementation(
166  rti1516::MessageRetractionHandle & handle)
167 {
168  return handle.getImplementation();
169 }
170 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
172 {
173  return MessageRetractionHandleFriend::MessageRetractionHandle(handle);
174 
175 }
176 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
177  VariableLengthData const & encodedValue)
178 {
179  return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue);
180 
181 }
182 inline DtMessageRetractionHandle makeMessageRetractionHandleImpl(
183  rti1516::MessageRetractionHandle handle)
184 {
185  return MessageRetractionHandleFriend::getImplementation(handle)->value();
186 }
187 
188 inline rti1516::MessageRetractionHandle makeMessageRetractionHandle(
189  DtFederateHandle fedHandle, unsigned long serialNumber)
190 {
191  DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle};
192  return makeMessageRetractionHandle(handleImpl);
193 };
194 
195 inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516::OrderType order)
196 {
197  return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp;
198 }
199 
200 inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516::TransportationType transport)
201 {
202  return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort;
203 }
204 
205 inline rti1516::OrderType makeOrderType(MAKRti::DtOrderType order)
206 {
207  return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP;
208 }
209 
210 inline rti1516::TransportationType makeTransportType(MAKRti::DtTransportType transport)
211 {
212  return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT;
213 }
214 
215 
216 };
217 #elif defined(DtIFSPEC1516E)
218 
219 
220 #include "handleImpl.h"
221 #include "internalTypes.h"
222 #include <vlutil/vlFedTarget.h>
223 #include <RTI/Handle.h>
224 #include <RTI/Typedefs.h>
225 
226 namespace rti1516e
227 {
228 
233 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \
234  \
235  class HandleKind##Friend \
236  { \
237  public: \
238  HandleKind##Friend(); \
239  static rti1516e::HandleKind HandleKind(Dt##HandleKind handleValue); \
240  static rti1516e::HandleKind HandleKind( \
241  VariableLengthData const & encodedValue); \
242  static HandleKind##Implementation const* \
243  getImplementation(rti1516e::HandleKind const& handle); \
244  static HandleKind##Implementation* getImplementation( \
245  rti1516e::HandleKind& handle); \
246 }; \
247  inline HandleKind##Friend::HandleKind##Friend() \
248  { \
249 } \
250  inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
251  Dt##HandleKind handleValue) \
252  { \
253  return rti1516e::HandleKind( \
254  (HandleKind##Implementation*)handleValue); \
255 } \
256  inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
257  VariableLengthData const & encodedValue) \
258  { \
259  return rti1516e::HandleKind(encodedValue); \
260 } \
261  inline HandleKind##Implementation const * \
262  HandleKind##Friend::getImplementation(rti1516e::HandleKind const& handle) \
263  { \
264  return handle.getImplementation(); \
265 } \
266  inline HandleKind##Implementation* \
267  HandleKind##Friend::getImplementation(rti1516e::HandleKind & handle) \
268  { \
269  return handle.getImplementation(); \
270 } \
271  inline rti1516e::HandleKind make##HandleKind(Dt##HandleKind handle) \
272  { \
273  return HandleKind##Friend::HandleKind(handle); \
274 } \
275  inline rti1516e::HandleKind make##HandleKind( \
276  VariableLengthData const & encodedValue) \
277  { \
278  return HandleKind##Friend::HandleKind(encodedValue); \
279 } \
280  inline Dt##HandleKind make##HandleKind##Impl(const rti1516e::HandleKind& handle) \
281  { \
282  return (Dt##HandleKind)HandleKind##Friend::getImplementation(handle); \
283 }
284 
287 #define DEFINE_FILL_HANDLE_SET_IMPL(HandleKind) \
288  inline void fill##HandleKind##SetImpl( \
289  rti1516e::HandleKind##Set const & rtiHandleSet, \
290  Dt##HandleKind##Set & internHandleSet) \
291  { \
292  for (rti1516e::HandleKind##Set::const_iterator iter = rtiHandleSet.begin(); \
293  iter != rtiHandleSet.end(); \
294  iter++) \
295  { \
296  internHandleSet.insert(make##HandleKind##Impl(*iter)); \
297 } \
298 }
299 
302 #define DEFINE_FILL_HANDLE_SET(HandleKind) \
303  inline void fill##HandleKind##Set( \
304  Dt##HandleKind##Set const & internHandleSet, \
305  rti1516e::HandleKind##Set & rtiHandleSet) \
306  { \
307  for (Dt##HandleKind##Set::const_iterator iter = internHandleSet.begin(); \
308  iter != internHandleSet.end(); \
309  iter++) \
310  { \
311  rtiHandleSet.insert(make##HandleKind(*iter)); \
312 } \
313 }
314 
315  DEFINE_HANDLE_CLASS_FRIEND(FederateHandle)
316  DEFINE_HANDLE_CLASS_FRIEND(ObjectClassHandle)
317  DEFINE_HANDLE_CLASS_FRIEND(InteractionClassHandle)
318  DEFINE_HANDLE_CLASS_FRIEND(ObjectInstanceHandle)
319  DEFINE_HANDLE_CLASS_FRIEND(AttributeHandle)
320  DEFINE_HANDLE_CLASS_FRIEND(ParameterHandle)
321  DEFINE_HANDLE_CLASS_FRIEND(DimensionHandle)
322  DEFINE_HANDLE_CLASS_FRIEND(RegionHandle)
323 
324  DEFINE_FILL_HANDLE_SET(DimensionHandle)
325  DEFINE_FILL_HANDLE_SET_IMPL(DimensionHandle)
326  DEFINE_FILL_HANDLE_SET(RegionHandle)
327  DEFINE_FILL_HANDLE_SET_IMPL(RegionHandle)
328 
332  class MessageRetractionHandleFriend
333  {
334  public:
335  MessageRetractionHandleFriend();
336  static rti1516e::MessageRetractionHandle MessageRetractionHandle(
337  DtMessageRetractionHandle handleValue);
338  static rti1516e::MessageRetractionHandle MessageRetractionHandle(
339  VariableLengthData const & encodedValue);
340  static MessageRetractionHandleImplementation const*
341  getImplementation(rti1516e::MessageRetractionHandle const& handle);
342  static MessageRetractionHandleImplementation* getImplementation(
343  rti1516e::MessageRetractionHandle& handle);
344  };
345  inline MessageRetractionHandleFriend::MessageRetractionHandleFriend()
346  {
347  }
348  inline rti1516e::MessageRetractionHandle
349  MessageRetractionHandleFriend::MessageRetractionHandle(
350  DtMessageRetractionHandle handleValue)
351  {
352  return rti1516e::MessageRetractionHandle(
353  (MessageRetractionHandleImplementation*)&handleValue);
354  }
355  inline rti1516e::MessageRetractionHandle
356  MessageRetractionHandleFriend::MessageRetractionHandle(
357  VariableLengthData const & encodedValue)
358  {
359  return rti1516e::MessageRetractionHandle(encodedValue);
360  }
361  inline MessageRetractionHandleImplementation const *
362  MessageRetractionHandleFriend::getImplementation(
363  rti1516e::MessageRetractionHandle const& handle)
364  {
365  return handle.getImplementation();
366  }
367  inline MessageRetractionHandleImplementation*
368  MessageRetractionHandleFriend::getImplementation(
369  rti1516e::MessageRetractionHandle & handle)
370  {
371  return handle.getImplementation();
372  }
373  inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
375  {
376  return MessageRetractionHandleFriend::MessageRetractionHandle(handle);
377 
378  }
379  inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
380  VariableLengthData const & encodedValue)
381  {
382  return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue);
383 
384  }
385  inline DtMessageRetractionHandle makeMessageRetractionHandleImpl(
386  rti1516e::MessageRetractionHandle handle)
387  {
388  return MessageRetractionHandleFriend::getImplementation(handle)->value();
389  }
390 
391  inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
392  DtFederateHandle fedHandle, unsigned long serialNumber)
393  {
394  DtMessageRetractionHandle handleImpl = {serialNumber, fedHandle};
395  return makeMessageRetractionHandle(handleImpl);
396  };
397 
398  inline MAKRti::DtOrderType makeOrderTypeImpl(rti1516e::OrderType order)
399  {
400  return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp;
401  }
402 
403  inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516e::TransportationType transport)
404  {
405  return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort;
406  }
407 
408  inline rti1516e::OrderType makeOrderType(MAKRti::DtOrderType order)
409  {
410  return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP;
411  }
412 
413  inline rti1516e::TransportationType makeTransportType(MAKRti::DtTransportType transport)
414  {
415  return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT;
416  }
417 
418 
419 };
420 
421 #endif
422 #endif

Document ID: Generated on Mon Mar 21 09:41:37 EDT 2016 from SVN revision 163228
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)