MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simpleTimeFedAmb1516.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2018 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/RTI1516.h>
19 #include <RTI/NullFederateAmbassador.h>
20 #include "simpleTimeStringUtil.h"
22 #include <string>
23 #include <map>
24 
25 using namespace rti1516;
26 
27 typedef std::map<std::wstring, AttributeHandle> DtAttrNameHandleMap;
28 typedef std::map<std::wstring, ParameterHandle> DtParamNameHandleMap;
29 
30 class DtTalkAmbData
31 {
32 
33 public:
34  DtTalkAmbData();
35  ~DtTalkAmbData();
36 
37 
38 public:
39  bool myNameReservationReturned;
40  bool myNameReservationSucceeded;
41  std::map<ObjectClassHandle, std::wstring> objectClassMap;
42  std::map<ObjectInstanceHandle, std::wstring> objectInstanceMap;
43  std::map<InteractionClassHandle,std::wstring> interactionClassMap;
44  std::map<ObjectInstanceHandle, AttributeHandleSet*> updateRequestMap;
45 
46  // Map between strings and attribute handles
47  DtAttrNameHandleMap theAttrNameHandleMap;
48 
49  // Map between strings and paramterHandles
50  DtParamNameHandleMap theParamNameHandleMap;
51 
52  // The set of Attributes that this federate's published objects will contain.
53  std::set<std::string> ourAttrs;
54 
55  // the Set of Parameters that this federate's published interactions will contain.
56  std::set<std::string> ourParms;
57 
58  // This federation of simple objects has a single master object, (determined by command line arguments)
59  // The master federate will keep the other federates from entering their main loop of execution until
60  // all of numFederates have joined.
61  bool isMaster;
62 
63  // numFederates is the number of federates (including the master) that the master should wait to join the
64  // federation before it allows any federate to enter its main loop.
65  // This variable is only used by the master federate.
66  int numFederates;
67 
68  AttributeHandleValueMap* attrValues;
69  ParameterHandleValueMap* paramValues;
70  bool isConstrained;
71  bool isRegulating;
72  bool timeAdvanced;
73  LogicalTime* time;
74  int otherFederatesReady;
75  bool registerFailed;
76  bool registerSucceeded;
77  bool announceSyncReceived;
78  bool federationIsSynchronized;
79  timeManagedEntity timeManagedObject;
80 };
81 
83 {
84 public:
85 
87 
88  virtual ~MyFederateAmbassador()
89  throw ();
90 
91  // 6.3
92  virtual
93  void
94  objectInstanceNameReservationSucceeded(std::wstring const &
95  theObjectInstanceName)
96  throw (UnknownName,
97  FederateInternalError);
98 
99  virtual
100  void
101  objectInstanceNameReservationFailed(std::wstring const &
102  theObjectInstanceName)
103  throw (UnknownName,
104  FederateInternalError);
105 
106  // 6.5
107  virtual void discoverObjectInstance (
108  ObjectInstanceHandle theObject,
109  ObjectClassHandle theObjectClass,
110  std::wstring const & theObjectInstanceName)
111  throw (
112  CouldNotDiscover,
113  ObjectClassNotKnown,
114  FederateInternalError);
115 
116  // 6.7
117  virtual
118  void
120  (ObjectInstanceHandle theObject,
121  AttributeHandleValueMap const & theAttributeValues,
122  VariableLengthData const & theUserSuppliedTag,
123  OrderType sentOrder,
124  TransportationType theType)
125  throw (ObjectInstanceNotKnown,
126  AttributeNotRecognized,
127  AttributeNotSubscribed,
128  FederateInternalError);
129 
130  virtual
131  void
133  (ObjectInstanceHandle theObject,
134  AttributeHandleValueMap const & theAttributeValues,
135  VariableLengthData const & theUserSuppliedTag,
136  OrderType sentOrder,
137  TransportationType theType,
138  RegionHandleSet const & theSentRegionHandleSet)
139  throw (ObjectInstanceNotKnown,
140  AttributeNotRecognized,
141  AttributeNotSubscribed,
142  FederateInternalError);
143 
144  virtual
145  void
147  (ObjectInstanceHandle theObject,
148  AttributeHandleValueMap const & theAttributeValues,
149  VariableLengthData const & theUserSuppliedTag,
150  OrderType sentOrder,
151  TransportationType theType,
152  LogicalTime const & theTime,
153  OrderType receivedOrder)
154  throw (ObjectInstanceNotKnown,
155  AttributeNotRecognized,
156  AttributeNotSubscribed,
157  FederateInternalError);
158 
159  virtual
160  void
162  (ObjectInstanceHandle theObject,
163  AttributeHandleValueMap const & theAttributeValues,
164  VariableLengthData const & theUserSuppliedTag,
165  OrderType sentOrder,
166  TransportationType theType,
167  LogicalTime const & theTime,
168  OrderType receivedOrder,
169  RegionHandleSet const & theSentRegionHandleSet)
170  throw (ObjectInstanceNotKnown,
171  AttributeNotRecognized,
172  AttributeNotSubscribed,
173  FederateInternalError);
174 
175  virtual
176  void
178  (ObjectInstanceHandle theObject,
179  AttributeHandleValueMap const & theAttributeValues,
180  VariableLengthData const & theUserSuppliedTag,
181  OrderType sentOrder,
182  TransportationType theType,
183  LogicalTime const & theTime,
184  OrderType receivedOrder,
185  MessageRetractionHandle theHandle)
186  throw (ObjectInstanceNotKnown,
187  AttributeNotRecognized,
188  AttributeNotSubscribed,
189  InvalidLogicalTime,
190  FederateInternalError);
191 
192  virtual
193  void
195  (ObjectInstanceHandle theObject,
196  AttributeHandleValueMap const & theAttributeValues,
197  VariableLengthData const & theUserSuppliedTag,
198  OrderType sentOrder,
199  TransportationType theType,
200  LogicalTime const & theTime,
201  OrderType receivedOrder,
202  MessageRetractionHandle theHandle,
203  RegionHandleSet const & theSentRegionHandleSet)
204  throw (ObjectInstanceNotKnown,
205  AttributeNotRecognized,
206  AttributeNotSubscribed,
207  InvalidLogicalTime,
208  FederateInternalError);
209 
210 
211  // 6.9
212  virtual
213  void
215  (InteractionClassHandle theInteraction,
216  ParameterHandleValueMap const & theParameterValues,
217  VariableLengthData const & theUserSuppliedTag,
218  OrderType sentOrder,
219  TransportationType theType)
220  throw (InteractionClassNotRecognized,
221  InteractionParameterNotRecognized,
222  InteractionClassNotSubscribed,
223  FederateInternalError);
224 
225  virtual
226  void
228  (InteractionClassHandle theInteraction,
229  ParameterHandleValueMap const & theParameterValues,
230  VariableLengthData const & theUserSuppliedTag,
231  OrderType sentOrder,
232  TransportationType theType,
233  RegionHandleSet const & theSentRegionHandleSet)
234  throw (InteractionClassNotRecognized,
235  InteractionParameterNotRecognized,
236  InteractionClassNotSubscribed,
237  FederateInternalError);
238 
239  virtual
240  void
242  (InteractionClassHandle theInteraction,
243  ParameterHandleValueMap const & theParameterValues,
244  VariableLengthData const & theUserSuppliedTag,
245  OrderType sentOrder,
246  TransportationType theType,
247  LogicalTime const & theTime,
248  OrderType receivedOrder)
249  throw (InteractionClassNotRecognized,
250  InteractionParameterNotRecognized,
251  InteractionClassNotSubscribed,
252  FederateInternalError);
253 
254  virtual
255  void
257  (InteractionClassHandle theInteraction,
258  ParameterHandleValueMap const & theParameterValues,
259  VariableLengthData const & theUserSuppliedTag,
260  OrderType sentOrder,
261  TransportationType theType,
262  LogicalTime const & theTime,
263  OrderType receivedOrder,
264  RegionHandleSet const & theSentRegionHandleSet)
265  throw (InteractionClassNotRecognized,
266  InteractionParameterNotRecognized,
267  InteractionClassNotSubscribed,
268  FederateInternalError);
269 
270  virtual
271  void
273  (InteractionClassHandle theInteraction,
274  ParameterHandleValueMap const & theParameterValues,
275  VariableLengthData const & theUserSuppliedTag,
276  OrderType sentOrder,
277  TransportationType theType,
278  LogicalTime const & theTime,
279  OrderType receivedOrder,
280  MessageRetractionHandle theHandle)
281  throw (InteractionClassNotRecognized,
282  InteractionParameterNotRecognized,
283  InteractionClassNotSubscribed,
284  InvalidLogicalTime,
285  FederateInternalError);
286 
287  virtual
288  void
290  (InteractionClassHandle theInteraction,
291  ParameterHandleValueMap const & theParameterValues,
292  VariableLengthData const & theUserSuppliedTag,
293  OrderType sentOrder,
294  TransportationType theType,
295  LogicalTime const & theTime,
296  OrderType receivedOrder,
297  MessageRetractionHandle theHandle,
298  RegionHandleSet const & theSentRegionHandleSet)
299  throw (InteractionClassNotRecognized,
300  InteractionParameterNotRecognized,
301  InteractionClassNotSubscribed,
302  InvalidLogicalTime,
303  FederateInternalError);
304 
305  virtual
306  void
307  removeObjectInstance(ObjectInstanceHandle theObject,
308  VariableLengthData const & theUserSuppliedTag,
309  OrderType sentOrder)
310  throw (ObjectInstanceNotKnown,
311  FederateInternalError);
312 
313  virtual
314  void
315  removeObjectInstance(ObjectInstanceHandle theObject,
316  VariableLengthData const & theUserSuppliedTag,
317  OrderType sentOrder,
318  LogicalTime const & theTime,
319  OrderType receivedOrder)
320  throw (ObjectInstanceNotKnown,
321  FederateInternalError);
322 
323  virtual
324  void
325  removeObjectInstance(ObjectInstanceHandle theObject,
326  VariableLengthData const & theUserSuppliedTag,
327  OrderType sentOrder,
328  LogicalTime const & theTime,
329  OrderType receivedOrder,
330  MessageRetractionHandle theHandle)
331  throw (ObjectInstanceNotKnown,
332  InvalidLogicalTime,
333  FederateInternalError);
334 
335  virtual
336  void
337  provideAttributeValueUpdate(ObjectInstanceHandle theObject,
338  AttributeHandleSet const & theAttributes,
339  VariableLengthData const & theUserSuppliedTag)
340  throw (ObjectInstanceNotKnown,
341  AttributeNotRecognized,
342  AttributeNotOwned,
343  FederateInternalError);
344 
345  virtual
346  void
347  timeRegulationEnabled(LogicalTime const & theFederateTime)
348  throw (InvalidLogicalTime,
349  NoRequestToEnableTimeRegulationWasPending,
350  FederateInternalError);
351 
352 
353  virtual
354  void
355  timeConstrainedEnabled(LogicalTime const & theFederateTime)
356  throw (InvalidLogicalTime,
357  NoRequestToEnableTimeConstrainedWasPending,
358  FederateInternalError);
359 
360  virtual
361  void
362  timeAdvanceGrant(LogicalTime const & theTime)
363  throw (InvalidLogicalTime,
364  JoinedFederateIsNotInTimeAdvancingState,
365  FederateInternalError);
366 
367  virtual
368  void
369  requestRetraction(MessageRetractionHandle theHandle)
370  throw (FederateInternalError);
371 
372 
373  virtual
374  void
375  synchronizationPointRegistrationSucceeded(std::wstring const & label )
376  throw (FederateInternalError);
377  virtual
378  void
379  synchronizationPointRegistrationFailed(std::wstring const & label,
380  SynchronizationFailureReason reason)
381  throw (FederateInternalError);
382 
383  virtual
384  void
385  announceSynchronizationPoint(std::wstring const & label,
386  VariableLengthData const & theUserSuppliedTag)
387  throw (FederateInternalError);
388 
389  virtual
390  void
391  federationSynchronized(std::wstring const & label)
392  throw (FederateInternalError);
393 
394 
395 public:
396  DtTalkAmbData & myData;
397 };
398 
399 #endif

Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)