MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
15 #include <RTI/RTI1516.h>
16 
18 class ObjectParams1516e;
19 
20 // Class that updates owned balls and processes updates on
21 // other balls for 1516e federates
23 {
24 public:
25 
26  BallController1516e(BallMap* data, DdmRegionMap* regionData);
27  virtual ~BallController1516e();
28 
29  // Creates (if not already created) and joins the given federation.
30  // Returns success indicator. federateName is not used in 1516.
31  virtual bool createAndJoinFederation(const std::wstring& federation,
32  const std::wstring& federateType,
33  const std::wstring& federateName = std::wstring(),
34  bool includeInterExt = false);
35 
36  // Resigns from and attempts to destroy the current federation.
37  // Returns success indicator.
38  virtual bool resignAndDestroyFederation();
39 
40  // Subscribes to the ball class and all its attributes. Must already have
41  // created and joined the federation. Returns success indicator.
42  virtual bool subscribe();
43 
44  // Unsubscribes to the ball class and all its attributes. Must already have
45  // created and joined the federation. Returns success indicator.
46  virtual bool unsubscribe();
47 
48  // Deletes the ball with the given ID
49  virtual void deleteBall(const std::wstring id);
50 
51  // Attempts to acquire the ball with the given ID
52  virtual void acquireBall(const std::wstring id);
53 
54  // Attempts to divest the owned ball with the given ID
55  virtual void divestBall(const std::wstring id);
56 
57  // Adds a new DDM subscription region
58  virtual bool subscribeWithRegion(int xLowerBound, int yLowerBound,
59  int xUpperBound, int yUpperBound);
60 
61  // Unsubscribes from the current DDM regions. If resubscribeWithoutRegion is
62  // set, automatically resubscribes without regions.
63  virtual bool unsubscribeWithRegions(bool resubscribeWithoutRegion);
64 
65  // Process a denial for a new ball name
66  void nameReservationFailed(const std::wstring& name);
67 
68  // Process an approval for a new ball name
69  void nameReservationSucceeded(const std::wstring& name);
70 
71  // Process discovery of a new ball
72  void ballDiscovered(ObjectParams1516e* objParams);
73 
74  // Process removal of another federate's ball
75  void ballRemoved(rti1516e::ObjectInstanceHandle handle);
76 
77  // Process the movement of the ball into a visible area
78  void ballVisible(rti1516e::ObjectInstanceHandle handle);
79 
80  // Process the movement of the ball out of a visible area
81  void ballNotVisible(rti1516e::ObjectInstanceHandle handle);
82 
83  // Process update of an existing ball
84  void ballUpdated(rti1516e::ObjectInstanceHandle handle,
85  const rti1516e::AttributeHandleValueMap& attrVals);
86 
87  // Process a display text interaction
89  const rti1516e::ParameterHandleValueMap& paramVals);
90 
91  // Tries to release ownership of the requested object
92  void releaseOwnership(rti1516e::ObjectInstanceHandle theObject,
93  rti1516e::AttributeHandleSet const & attributes);
94 
95  // Takes control of the ball which the federate has successfully acquired
96  // ownership of
97  void ownershipAcquired(rti1516e::ObjectInstanceHandle theObject,
98  rti1516e::AttributeHandleSet const & attributes);
99 
100  // Tries to assume ownership of the object being divested
101  void assumeOwnership(rti1516e::ObjectInstanceHandle theObject,
102  rti1516e::AttributeHandleSet const & attributes);
103 
104  // Confirms that the object is divested
105  void confirmDivestiture(rti1516e::ObjectInstanceHandle theObject,
106  rti1516e::AttributeHandleSet const & attributes);
107 
108  // Sets the field dimensions
109  virtual void setDimensions(int minX, int minY, int maxX, int maxY);
110 
111  // Returns the federate ID (based on the federate handle)
112  virtual const std::wstring& federateId() const;
113 
114  // Returns the federate type
115  virtual const std::wstring& federateType() const;
116 
117  // Returns the federate name
118  virtual const std::wstring& federateName() const;
119 
120  // Returns the federation name
121  virtual const std::wstring& federationName() const;
122 
123  // Returns true. Federate name is supported in HLA Evolved.
124  virtual bool isFederateNameSupported() const;
125 
126  // Returns true. The interaction FOM module extension is supported
127  // in HLA Evolved.
128  virtual bool isInteractionExtensionSupported() const;
129 
130 protected:
131 
132  // Sends updates on all owned balls to other federates in the federation
133  virtual void sendUpdates();
134 
135  // Receives updates on balls from other federates in the federation
136  virtual void receiveUpdates();
137 
138  // Request the RTI to create the a new ball
139  virtual void requestNewBall(Ball* ball, const std::wstring name);
140 
141  // Loads the AttributeHandleValueMap with the data from the given ball
142  void setAttributesForBall(rti1516e::AttributeHandleValueMap& attrVals,
143  const Ball* ball);
144 
145  // Loads the Ball with the data from the given attributes
146  void setBallFromAttributes(Ball* ball,
147  const rti1516e::AttributeHandleValueMap& attrVals);
148 
149  // Loads the TextEvent with the data from the given parameters
150  void setTextEventFromParameters(TextEvent& textEvent,
151  const rti1516e::ParameterHandleValueMap& paramVals);
152 
153  // Subscribes to the default region
155 
156  // Unsubscribes from the default region. Based on input parameter, either
157  // deletes the discovered balls or marks them as out of scope.
158  void unsubscribeFromDefaultRegion(bool deleteDiscoveredBalls);
159 
160  // Subscribes to the text interaction class.
162 
163  // Unsubscribes from the text interaction class.
165 
166  // Deletes known balls. Can delete owned, not owned, or both.
167  virtual void deleteKnownBalls(bool deleteOwned, bool deleteOthers);
168 
169  // Marks all balls this federate does not own as out of scope
170  void markBallsOutOfScope();
171 
172  // Creates a publication region for the given ball and sets ball's object
173  // parameters with the new region handle.
174  bool createPublicationRegion(Ball* ball);
175 
176  // Constructs a user supplied tag for the given ball object parameters.
177  // Not really relevant to federate operations.
178  rti1516e::VariableLengthData constructTag(const Ball* ball) const;
179 
180 private:
181 
182  // No default constructor
184 
185 protected:
186 
189 
190  std::auto_ptr < rti1516e::RTIambassador > myRtiAmbassador;
192 
195  std::wstring myFederateType;
196  std::wstring myFederationName;
197 
199 
202 
210  rti1516e::AttributeHandleSet myAllBallAttrs;
214 
222  rti1516e::ParameterHandleSet myAllTextParams;
223 
224  static const std::wstring theFddFile;
225  static const std::wstring theBallClassName;
226  static const std::wstring theColorAttrName;
227  static const std::wstring theSizeAttrName;
228  static const std::wstring theXAttrName;
229  static const std::wstring theYAttrName;
230  static const std::wstring theSpeedAttrName;
231  static const std::wstring theDirectionAttrName;
232  static const std::wstring thePrivToDeleteAttrName;
233  static const std::wstring theXDimName;
234  static const std::wstring theYDimName;
235 
236  static const std::wstring theInteractionFomModule;
237  static const std::wstring theTextClassName;
238  static const std::wstring theTextParamName;
239  static const std::wstring theTextXParamName;
240  static const std::wstring theTextYParamName;
241  static const std::wstring theTextSizeParamName;
242  static const std::wstring theTextIntervalParamName;
243 
244 };
245 
246 #endif
rti1516e::ObjectClassHandle myBallClass
Definition: ballController1516e.h:203
bool myIsSubscribedToDefaultRegion
Definition: ballController1516e.h:198
static const std::wstring theTextSizeParamName
Definition: ballController1516e.h:241
std::wstring myFederationName
Definition: ballController1516e.h:196
rti1516e::AttributeHandle myColorAttr
Definition: ballController1516e.h:204
virtual void deleteKnownBalls(bool deleteOwned, bool deleteOthers)
Definition: ballData.h:47
Definition: hlaBounceFedAmb13.h:23
virtual void divestBall(const std::wstring id)
virtual void deleteBall(const std::wstring id)
virtual void receiveUpdates()
void unsubscribeInteractionClass()
rti1516e::ParameterHandle myTextYParam
Definition: ballController1516e.h:219
void unsubscribeFromDefaultRegion(bool deleteDiscoveredBalls)
rti1516e::ParameterHandle myTextIntervalParam
Definition: ballController1516e.h:221
virtual void setDimensions(int minX, int minY, int maxX, int maxY)
static const std::wstring theYAttrName
Definition: ballController1516e.h:229
rti1516e::AttributeHandle myXAttr
Definition: ballController1516e.h:206
virtual const std::wstring & federateType() const
virtual bool resignAndDestroyFederation()
void ballUpdated(rti1516e::ObjectInstanceHandle handle, const rti1516e::AttributeHandleValueMap &attrVals)
ULong InteractionClassHandle
Definition: RTItypes13.h:106
Handle ParameterHandle
Definition: RTItypes13.h:114
rti1516e::AttributeHandleSet myAllBallAttrs
Definition: ballController1516e.h:210
virtual bool unsubscribeWithRegions(bool resubscribeWithoutRegion)
int myDdmXRangeConv
Definition: ballController1516e.h:200
void nameReservationSucceeded(const std::wstring &name)
static const std::wstring theInteractionFomModule
Definition: ballController1516e.h:236
rti1516e::VariableLengthData constructTag(const Ball *ball) const
void ballNotVisible(rti1516e::ObjectInstanceHandle handle)
std::wstring myFederateType
Definition: ballController1516e.h:195
virtual bool createAndJoinFederation(const std::wstring &federation, const std::wstring &federateType, const std::wstring &federateName=std::wstring(), bool includeInterExt=false)
rti1516e::AttributeHandle myYAttr
Definition: ballController1516e.h:207
static const std::wstring theBallClassName
Definition: ballController1516e.h:225
virtual const std::wstring & federateId() const
std::map< std::wstring, Ball * > BallMap
Definition: ballData.h:118
virtual const std::wstring & federateName() const
bool createPublicationRegion(Ball *ball)
static const std::wstring thePrivToDeleteAttrName
Definition: ballController1516e.h:232
Definition: textData.h:13
void setAttributesForBall(rti1516e::AttributeHandleValueMap &attrVals, const Ball *ball)
virtual void sendUpdates()
static const std::wstring theColorAttrName
Definition: ballController1516e.h:226
bool myIsUsingInteractionModule
Definition: ballController1516e.h:215
BallMap myPendingBalls
Definition: ballController1516e.h:188
static const std::wstring theYDimName
Definition: ballController1516e.h:234
void subscribeInteractionClass()
Handle DimensionHandle
Definition: RTItypes13.h:118
void subscribeToDefaultRegion()
static const std::wstring theXAttrName
Definition: ballController1516e.h:228
static const std::wstring theTextYParamName
Definition: ballController1516e.h:240
rti1516e::ParameterHandleSet myAllTextParams
Definition: ballController1516e.h:222
rti1516e::InteractionClassHandle myTextClass
Definition: ballController1516e.h:216
static const std::wstring theTextXParamName
Definition: ballController1516e.h:239
static const std::wstring theSizeAttrName
Definition: ballController1516e.h:227
static const std::wstring theTextIntervalParamName
Definition: ballController1516e.h:242
Definition: ballController.h:21
int myDdmYRangeConv
Definition: ballController1516e.h:201
HlaBounceFederateAmbassador * myFederateAmbassador
Definition: ballController1516e.h:191
virtual bool subscribe()
virtual bool isInteractionExtensionSupported() const
void confirmDivestiture(rti1516e::ObjectInstanceHandle theObject, rti1516e::AttributeHandleSet const &attributes)
rti1516e::DimensionHandle myXDim
Definition: ballController1516e.h:212
static const std::wstring theTextParamName
Definition: ballController1516e.h:238
void releaseOwnership(rti1516e::ObjectInstanceHandle theObject, rti1516e::AttributeHandleSet const &attributes)
void ballDiscovered(ObjectParams1516e *objParams)
virtual void requestNewBall(Ball *ball, const std::wstring name)
std::wstring myFederateHandleString
Definition: ballController1516e.h:194
void ballRemoved(rti1516e::ObjectInstanceHandle handle)
rti1516e::FederateHandle myFederateHandle
Definition: ballController1516e.h:193
static const std::wstring theXDimName
Definition: ballController1516e.h:233
void assumeOwnership(rti1516e::ObjectInstanceHandle theObject, rti1516e::AttributeHandleSet const &attributes)
rti1516e::ParameterHandle myTextParam
Definition: ballController1516e.h:217
rti1516e::AttributeHandle myDirectionAttr
Definition: ballController1516e.h:209
ULong FederateHandle
Definition: RTItypes13.h:120
rti1516e::AttributeHandle myPrivToDeleteAttr
Definition: ballController1516e.h:211
static const std::wstring theDirectionAttrName
Definition: ballController1516e.h:231
virtual bool isFederateNameSupported() const
void ownershipAcquired(rti1516e::ObjectInstanceHandle theObject, rti1516e::AttributeHandleSet const &attributes)
rti1516e::AttributeHandle mySizeAttr
Definition: ballController1516e.h:205
Definition: objParams1516e.h:14
virtual const std::wstring & federationName() const
std::map< std::wstring, DdmRegion * > DdmRegionMap
Definition: regionData.h:59
virtual bool subscribeWithRegion(int xLowerBound, int yLowerBound, int xUpperBound, int yUpperBound)
void setTextEventFromParameters(TextEvent &textEvent, const rti1516e::ParameterHandleValueMap &paramVals)
static const std::wstring theFddFile
Definition: ballController1516e.h:224
virtual bool unsubscribe()
static const std::wstring theSpeedAttrName
Definition: ballController1516e.h:230
rti1516e::DimensionHandle myYDim
Definition: ballController1516e.h:213
virtual void acquireBall(const std::wstring id)
void nameReservationFailed(const std::wstring &name)
BallMap myUnnamedBalls
Definition: ballController1516e.h:187
ULong ObjectClassHandle
Definition: RTItypes13.h:104
rti1516e::ParameterHandle myTextXParam
Definition: ballController1516e.h:218
void displayInteractionText(rti1516e::InteractionClassHandle handle, const rti1516e::ParameterHandleValueMap &paramVals)
static const std::wstring theTextClassName
Definition: ballController1516e.h:237
std::auto_ptr< rti1516e::RTIambassador > myRtiAmbassador
Definition: ballController1516e.h:190
rti1516e::AttributeHandle mySpeedAttr
Definition: ballController1516e.h:208
void ballVisible(rti1516e::ObjectInstanceHandle handle)
virtual ~BallController1516e()
Handle AttributeHandle
Definition: RTItypes13.h:112
rti1516e::ParameterHandle myTextSizeParam
Definition: ballController1516e.h:220
Definition: ballController1516e.h:22
void setBallFromAttributes(Ball *ball, const rti1516e::AttributeHandleValueMap &attrVals)

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)