MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
handleCreator1516e.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2010 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: handleCreator1516e.h,v $ $Revision: 1.0 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef handleCreatore_H_
10 #define handleCreatore_H_
11 
14 
15 #ifdef DtIFSPEC1516E
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 rti1516e
24 {
25 
30 #define DEFINE_HANDLE_CLASS_FRIEND(HandleKind) \
31  \
32  class HandleKind##Friend \
33  { \
34  public: \
35  HandleKind##Friend(); \
36  static rti1516e::HandleKind HandleKind(Dt##HandleKind handleValue); \
37  static rti1516e::HandleKind HandleKind( \
38  VariableLengthData const & encodedValue); \
39  static HandleKind##Implementation const* \
40  getImplementation(rti1516e::HandleKind const& handle); \
41  static HandleKind##Implementation* getImplementation( \
42  rti1516e::HandleKind& handle); \
43 }; \
44  inline HandleKind##Friend::HandleKind##Friend() \
45  { \
46 } \
47  inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
48  Dt##HandleKind handleValue) \
49  { \
50  return rti1516e::HandleKind( \
51  (HandleKind##Implementation*)handleValue); \
52 } \
53  inline rti1516e::HandleKind HandleKind##Friend::HandleKind( \
54  VariableLengthData const & encodedValue) \
55  { \
56  return rti1516e::HandleKind(encodedValue); \
57 } \
58  inline HandleKind##Implementation const * \
59  HandleKind##Friend::getImplementation(rti1516e::HandleKind const& handle) \
60  { \
61  return handle.getImplementation(); \
62 } \
63  inline HandleKind##Implementation* \
64  HandleKind##Friend::getImplementation(rti1516e::HandleKind & handle) \
65  { \
66  return handle.getImplementation(); \
67 } \
68  inline rti1516e::HandleKind make##HandleKind(Dt##HandleKind handle) \
69  { \
70  return HandleKind##Friend::HandleKind(handle); \
71 } \
72  inline rti1516e::HandleKind make##HandleKind( \
73  VariableLengthData const & encodedValue) \
74  { \
75  return HandleKind##Friend::HandleKind(encodedValue); \
76 } \
77  inline Dt##HandleKind make##HandleKind##Impl(const rti1516e::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  rti1516e::HandleKind##Set const & rtiHandleSet, \
87  Dt##HandleKind##Set & internHandleSet) \
88  { \
89  for (rti1516e::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  rti1516e::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 rti1516e::MessageRetractionHandle MessageRetractionHandle(
134  DtMessageRetractionHandle handleValue);
135  static rti1516e::MessageRetractionHandle MessageRetractionHandle(
136  VariableLengthData const & encodedValue);
137  static MessageRetractionHandleImplementation const*
138  getImplementation(rti1516e::MessageRetractionHandle const& handle);
139  static MessageRetractionHandleImplementation* getImplementation(
140  rti1516e::MessageRetractionHandle& handle);
141  };
142  inline MessageRetractionHandleFriend::MessageRetractionHandleFriend()
143  {
144  }
145  inline rti1516e::MessageRetractionHandle
146  MessageRetractionHandleFriend::MessageRetractionHandle(
147  DtMessageRetractionHandle handleValue)
148  {
149  return rti1516e::MessageRetractionHandle(
150  (MessageRetractionHandleImplementation*)&handleValue);
151  }
152  inline rti1516e::MessageRetractionHandle
153  MessageRetractionHandleFriend::MessageRetractionHandle(
154  VariableLengthData const & encodedValue)
155  {
156  return rti1516e::MessageRetractionHandle(encodedValue);
157  }
158  inline MessageRetractionHandleImplementation const *
159  MessageRetractionHandleFriend::getImplementation(
160  rti1516e::MessageRetractionHandle const& handle)
161  {
162  return handle.getImplementation();
163  }
164  inline MessageRetractionHandleImplementation*
165  MessageRetractionHandleFriend::getImplementation(
166  rti1516e::MessageRetractionHandle & handle)
167  {
168  return handle.getImplementation();
169  }
170  inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
172  {
173  return MessageRetractionHandleFriend::MessageRetractionHandle(handle);
174 
175  }
176  inline rti1516e::MessageRetractionHandle makeMessageRetractionHandle(
177  VariableLengthData const & encodedValue)
178  {
179  return MessageRetractionHandleFriend::MessageRetractionHandle(encodedValue);
180 
181  }
182  inline DtMessageRetractionHandle makeMessageRetractionHandleImpl(
183  rti1516e::MessageRetractionHandle handle)
184  {
185  return MessageRetractionHandleFriend::getImplementation(handle)->value();
186  }
187 
188  inline rti1516e::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(rti1516e::OrderType order)
196  {
197  return (order == RECEIVE) ? MAKRti::DtReceive : MAKRti::DtTimestamp;
198  }
199 
200  inline MAKRti::DtTransportType makeTransportTypeImpl(rti1516e::TransportationType transport)
201  {
202  return (transport == RELIABLE) ? MAKRti::DtReliable : MAKRti::DtBest_Effort;
203  }
204 
205  inline rti1516e::OrderType makeOrderType(MAKRti::DtOrderType order)
206  {
207  return (order == MAKRti::DtReceive) ? RECEIVE : TIMESTAMP;
208  }
209 
210  inline rti1516e::TransportationType makeTransportType(MAKRti::DtTransportType transport)
211  {
212  return (transport == MAKRti::DtReliable) ? RELIABLE : BEST_EFFORT;
213  }
214 
215 
216 };
217 
218 #endif
219 #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)