MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simpleTimeFedAmb1516e.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2004 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: simpleTimeFedAmb1516.h,v $ $Revision: 1.2 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef MyFederateAmbassador_H_
10 #define MyFederateAmbassador_H_
11 
12 #ifdef WIN32
13 #pragma warning(disable: 4251)
14 #pragma warning(disable: 4786)
15 #pragma warning(disable: 4290)
16 #endif
17 
18 #include <RTI/Enums.h>
19 #include <RTI/Typedefs.h>
20 #include <RTI/RTI1516.h>
22 #include "simpleTimeStringUtil.h"
24 #include <string>
25 #include <map>
26 
27 using namespace rti1516e;
28 
29 typedef std::map<std::wstring, AttributeHandle> DtAttrNameHandleMap;
30 typedef std::map<std::wstring, ParameterHandle> DtParamNameHandleMap;
31 
32 class DtTalkAmbData
33 {
34 
35 public:
36  DtTalkAmbData();
37  ~DtTalkAmbData();
38 
39 
40 public:
41  bool myNameReservationReturned;
42  bool myNameReservationSucceeded;
43  std::map<ObjectClassHandle, std::wstring> objectClassMap;
44  std::map<ObjectInstanceHandle, std::wstring> objectInstanceMap;
45  std::map<InteractionClassHandle,std::wstring> interactionClassMap;
46  std::map<ObjectInstanceHandle, AttributeHandleSet*> updateRequestMap;
47 
48  // Map between strings and attribute handles
49  DtAttrNameHandleMap theAttrNameHandleMap;
50 
51  // Map between strings and paramterHandles
52  DtParamNameHandleMap theParamNameHandleMap;
53 
54  // The set of Attributes that this federate's published objects will contain.
55  std::set<std::string> ourAttrs;
56 
57  // the Set of Parameters that this federate's published interactions will contain.
58  std::set<std::string> ourParms;
59 
60  // This federation of simple objects has a single master object, (determined by command line arguments)
61  // The master federate will keep the other federates from entering their main loop of execution until
62  // all of numFederates have joined.
63  bool isMaster;
64 
65  // numFederates is the number of federates (including the master) that the master should wait to join the
66  // federation before it allows any federate to enter its main loop.
67  // This variable is only used by the master federate.
68  int numFederates;
69 
70  AttributeHandleValueMap* attrValues;
71  ParameterHandleValueMap* paramValues;
72  bool isConstrained;
73  bool isRegulating;
74  bool timeAdvanced;
75  int otherFederatesReady;
76  bool registerFailed;
77  bool registerSucceeded;
78  bool announceSyncReceived;
79  bool federationIsSynchronized;
80  timeManagedEntity timeManagedObject;
81 };
82 
84 {
85 public:
87 
88  virtual ~MyFederateAmbassador ()
89  throw () ;
90 
91  // 6.3
92  virtual
93  void
94  objectInstanceNameReservationSucceeded(std::wstring const &
95  theObjectInstanceName)
96  throw (FederateInternalError);
97 
98  virtual
99  void
100  objectInstanceNameReservationFailed(std::wstring const &
101  theObjectInstanceName)
102  throw (FederateInternalError);
103 
104  // 6.5
105  virtual void discoverObjectInstance (
106  ObjectInstanceHandle theObject,
107  ObjectClassHandle theObjectClass,
108  std::wstring const & theObjectInstanceName)
109  throw (FederateInternalError);
110 
111  virtual void discoverObjectInstance (
112  ObjectInstanceHandle theObject,
113  ObjectClassHandle theObjectClass,
114  std::wstring const & theObjectInstanceName,
115  FederateHandle producingFederate)
116  throw (
117  FederateInternalError);
118 
119  // 6.11
120  virtual void reflectAttributeValues (
121  ObjectInstanceHandle theObject,
122  AttributeHandleValueMap const & theAttributeValues,
123  VariableLengthData const & theUserSuppliedTag,
124  OrderType sentOrder,
125  TransportationType theType,
126  SupplementalReflectInfo theReflectInfo)
127  throw (
128  FederateInternalError);
129 
130  virtual void reflectAttributeValues (
131  ObjectInstanceHandle theObject,
132  AttributeHandleValueMap const & theAttributeValues,
133  VariableLengthData const & theUserSuppliedTag,
134  OrderType sentOrder,
135  TransportationType theType,
136  LogicalTime const & theTime,
137  OrderType receivedOrder,
138  SupplementalReflectInfo theReflectInfo)
139  throw (
140  FederateInternalError);
141 
142  virtual void reflectAttributeValues (
143  ObjectInstanceHandle theObject,
144  AttributeHandleValueMap const & theAttributeValues,
145  VariableLengthData const & theUserSuppliedTag,
146  OrderType sentOrder,
147  TransportationType theType,
148  LogicalTime const & theTime,
149  OrderType receivedOrder,
150  MessageRetractionHandle theHandle,
151  SupplementalReflectInfo theReflectInfo)
152  throw (
153  FederateInternalError);
154 
155  // 6.13
156  virtual void receiveInteraction (
157  InteractionClassHandle theInteraction,
158  ParameterHandleValueMap const & theParameterValues,
159  VariableLengthData const & theUserSuppliedTag,
160  OrderType sentOrder,
161  TransportationType theType,
162  SupplementalReceiveInfo theReceiveInfo)
163  throw (
164  FederateInternalError);
165 
166  virtual void receiveInteraction (
167  InteractionClassHandle theInteraction,
168  ParameterHandleValueMap const & theParameterValues,
169  VariableLengthData const & theUserSuppliedTag,
170  OrderType sentOrder,
171  TransportationType theType,
172  LogicalTime const & theTime,
173  OrderType receivedOrder,
174  SupplementalReceiveInfo theReceiveInfo)
175  throw (
176  FederateInternalError);
177 
178  virtual void receiveInteraction (
179  InteractionClassHandle theInteraction,
180  ParameterHandleValueMap const & theParameterValues,
181  VariableLengthData const & theUserSuppliedTag,
182  OrderType sentOrder,
183  TransportationType theType,
184  LogicalTime const & theTime,
185  OrderType receivedOrder,
186  MessageRetractionHandle theHandle,
187  SupplementalReceiveInfo theReceiveInfo)
188  throw (
189  FederateInternalError);
190 
191  // 6.15
192  virtual void removeObjectInstance (
193  ObjectInstanceHandle theObject,
194  VariableLengthData const & theUserSuppliedTag,
195  OrderType sentOrder,
196  SupplementalRemoveInfo theRemoveInfo)
197  throw (
198  FederateInternalError);
199  virtual void removeObjectInstance (
200  ObjectInstanceHandle theObject,
201  VariableLengthData const & theUserSuppliedTag,
202  OrderType sentOrder,
203  LogicalTime const & theTime,
204  OrderType receivedOrder,
205  SupplementalRemoveInfo theRemoveInfo)
206  throw (
207  FederateInternalError);
208 
209  virtual void removeObjectInstance (
210  ObjectInstanceHandle theObject,
211  VariableLengthData const & theUserSuppliedTag,
212  OrderType sentOrder,
213  LogicalTime const & theTime,
214  OrderType receivedOrder,
215  MessageRetractionHandle theHandle,
216  SupplementalRemoveInfo theRemoveInfo)
217  throw (
218  FederateInternalError);
219 
220  virtual
221  void
222  provideAttributeValueUpdate(ObjectInstanceHandle theObject,
223  AttributeHandleSet const & theAttributes,
224  VariableLengthData const & theUserSuppliedTag)
225  throw (
226  FederateInternalError);
227 
228  virtual
229  void
230  timeRegulationEnabled(LogicalTime const & theFederateTime)
231  throw (
232  FederateInternalError);
233 
234 
235  virtual
236  void
237  timeConstrainedEnabled(LogicalTime const & theFederateTime)
238  throw (
239  FederateInternalError);
240 
241  virtual
242  void
243  timeAdvanceGrant(LogicalTime const & theTime)
244  throw (
245  FederateInternalError);
246 
247  virtual
248  void
249  requestRetraction(MessageRetractionHandle theHandle)
250  throw (FederateInternalError);
251 
252 
253  virtual
254  void
255  synchronizationPointRegistrationSucceeded(std::wstring const & label )
256  throw (FederateInternalError);
257  virtual
258  void
259  synchronizationPointRegistrationFailed(std::wstring const & label,
260  SynchronizationPointFailureReason reason)
261  throw (FederateInternalError);
262 
263  virtual
264  void
265  announceSynchronizationPoint(std::wstring const & label,
266  VariableLengthData const & theUserSuppliedTag)
267  throw (FederateInternalError);
268 
269  virtual void federationSynchronized (
270  std::wstring const & label,
271  FederateHandleSet const& failedToSyncSet)
272  throw (
273  FederateInternalError);
274 
275 
276 public:
277  DtTalkAmbData & myData;
278 };
279 
280 #endif
281 
282 

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)