MAK RTIspy API Documentation for HLA 1.3
ballController1516e.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2010 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: .h,v $ $Revision: 1.2 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef BallController1516e_H_
10 #define BallController1516e_H_
11 
12 #include "ballData.h"
13 #include "ballController.h"
14 #include <RTI/RTI1516.h>
15 
17 class ObjectParams1516e;
18 
19 // Class that updates owned balls and processes updates on
20 // other balls for 1516e federates
22 {
23 public:
24 
25  BallController1516e(BallMap* data, DdmRegionMap* regionData);
26  virtual ~BallController1516e();
27 
28  // Creates (if not already created) and joins the given federation.
29  // Returns success indicator. federateName is not used in 1516.
30  virtual bool createAndJoinFederation(const std::wstring& federation,
31  const std::wstring& federateType,
32  const std::wstring& federateName = std::wstring(),
33  bool includeInterExt = false);
34 
35  // Resigns from and attempts to destroy the current federation.
36  // Returns success indicator.
37  virtual bool resignAndDestroyFederation();
38 
39  // Subscribes to the ball class and all its attributes. Must already have
40  // created and joined the federation. Returns success indicator.
41  virtual bool subscribe();
42 
43  // Unsubscribes to the ball class and all its attributes. Must already have
44  // created and joined the federation. Returns success indicator.
45  virtual bool unsubscribe();
46 
47  // Deletes the ball with the given ID
48  virtual void deleteBall(const std::wstring id);
49 
50  // Attempts to acquire the ball with the given ID
51  virtual void acquireBall(const std::wstring id);
52 
53  // Attempts to divest the owned ball with the given ID
54  virtual void divestBall(const std::wstring id);
55 
56  // Adds a new DDM subscription region
57  virtual bool subscribeWithRegion(int xLowerBound, int yLowerBound,
58  int xUpperBound, int yUpperBound);
59 
60  // Unsubscribes from the current DDM regions. If resubscribeWithoutRegion is
61  // set, automatically resubscribes without regions.
62  virtual bool unsubscribeWithRegions(bool resubscribeWithoutRegion);
63 
64  // Process a denial for a new ball name
65  void nameReservationFailed(const std::wstring& name);
66 
67  // Process an approval for a new ball name
68  void nameReservationSucceeded(const std::wstring& name);
69 
70  // Process discovery of a new ball
71  void ballDiscovered(ObjectParams1516e* objParams);
72 
73  // Process removal of another federate's ball
74  void ballRemoved(rti1516e::ObjectInstanceHandle handle);
75 
76  // Process the movement of the ball into a visible area
77  void ballVisible(rti1516e::ObjectInstanceHandle handle);
78 
79  // Process the movement of the ball out of a visible area
80  void ballNotVisible(rti1516e::ObjectInstanceHandle handle);
81 
82  // Process update of an existing ball
83  void ballUpdated(rti1516e::ObjectInstanceHandle handle,
84  const rti1516e::AttributeHandleValueMap& attrVals);
85 
86  // Process a display text interaction
88  const rti1516e::ParameterHandleValueMap& paramVals);
89 
90  // Tries to release ownership of the requested object
91  void releaseOwnership(rti1516e::ObjectInstanceHandle theObject,
92  rti1516e::AttributeHandleSet const & attributes);
93 
94  // Takes control of the ball which the federate has successfully acquired
95  // ownership of
96  void ownershipAcquired(rti1516e::ObjectInstanceHandle theObject,
97  rti1516e::AttributeHandleSet const & attributes);
98 
99  // Tries to assume ownership of the object being divested
100  void assumeOwnership(rti1516e::ObjectInstanceHandle theObject,
101  rti1516e::AttributeHandleSet const & attributes);
102 
103  // Confirms that the object is divested
104  void confirmDivestiture(rti1516e::ObjectInstanceHandle theObject,
105  rti1516e::AttributeHandleSet const & attributes);
106 
107  // Sets the field dimensions
108  virtual void setDimensions(int minX, int minY, int maxX, int maxY);
109 
110  // Returns the federate ID (based on the federate handle)
111  virtual const std::wstring& federateId() const;
112 
113  // Returns the federate type
114  virtual const std::wstring& federateType() const;
115 
116  // Returns the federate name
117  virtual const std::wstring& federateName() const;
118 
119  // Returns the federation name
120  virtual const std::wstring& federationName() const;
121 
122  // Returns true. Federate name is supported in HLA Evolved.
123  virtual bool isFederateNameSupported() const;
124 
125  // Returns true. The interaction FOM module extension is supported
126  // in HLA Evolved.
127  virtual bool isInteractionExtensionSupported() const;
128 
129 protected:
130 
131  // Sends updates on all owned balls to other federates in the federation
132  virtual void sendUpdates();
133 
134  // Receives updates on balls from other federates in the federation
135  virtual void receiveUpdates();
136 
137  // Request the RTI to create the a new ball
138  virtual void requestNewBall(Ball* ball, const std::wstring name);
139 
140  // Loads the AttributeHandleValueMap with the data from the given ball
142  const Ball* ball);
143 
144  // Loads the Ball with the data from the given attributes
145  void setBallFromAttributes(Ball* ball,
146  const rti1516e::AttributeHandleValueMap& attrVals);
147 
148  // Loads the TextEvent with the data from the given parameters
149  void setTextEventFromParameters(TextEvent& textEvent,
150  const rti1516e::ParameterHandleValueMap& paramVals);
151 
152  // Subscribes to the default region
154 
155  // Unsubscribes from the default region. Based on input parameter, either
156  // deletes the discovered balls or marks them as out of scope.
157  void unsubscribeFromDefaultRegion(bool deleteDiscoveredBalls);
158 
159  // Subscribes to the text interaction class.
161 
162  // Unsubscribes from the text interaction class.
164 
165  // Deletes known balls. Can delete owned, not owned, or both.
166  virtual void deleteKnownBalls(bool deleteOwned, bool deleteOthers);
167 
168  // Marks all balls this federate does not own as out of scope
169  void markBallsOutOfScope();
170 
171  // Creates a publication region for the given ball and sets ball's object
172  // parameters with the new region handle.
173  bool createPublicationRegion(Ball* ball);
174 
175  // Constructs a user supplied tag for the given ball object parameters.
176  // Not really relevant to federate operations.
178 
179 private:
180 
181  // No default constructor
183 
184 protected:
185 
188 
189  std::auto_ptr < rti1516e::RTIambassador > myRtiAmbassador;
191 
194  std::wstring myFederateType;
195  std::wstring myFederationName;
196 
198 
201 
213 
222 
223  static const std::wstring theFddFile;
224  static const std::wstring theBallClassName;
225  static const std::wstring theColorAttrName;
226  static const std::wstring theSizeAttrName;
227  static const std::wstring theXAttrName;
228  static const std::wstring theYAttrName;
229  static const std::wstring theSpeedAttrName;
230  static const std::wstring theDirectionAttrName;
231  static const std::wstring thePrivToDeleteAttrName;
232  static const std::wstring theXDimName;
233  static const std::wstring theYDimName;
234 
235  static const std::wstring theInteractionFomModule;
236  static const std::wstring theTextClassName;
237  static const std::wstring theTextParamName;
238  static const std::wstring theTextXParamName;
239  static const std::wstring theTextYParamName;
240  static const std::wstring theTextSizeParamName;
241  static const std::wstring theTextIntervalParamName;
242 
243 };
244 
245 #endif

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)