MAK RTIspy API Documentation for HLA Evolved
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
examples
hlaBounce
ballController13.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 BallController13_H_
10
#define BallController13_H_
11
12
#include "
ballData.h
"
13
#include "
ballController.h
"
14
#include <
RTI.hh
>
15
16
class
HlaBounceFederateAmbassador
;
17
class
ObjectParams13
;
18
19
// Class that updates owned balls and processes updates on
20
// other balls for 1516 federates
21
class
BallController13
:
public
BallController
22
{
23
public
:
24
25
BallController13
(
BallMap
* data,
DdmRegionMap
* regionData);
26
virtual
~BallController13
();
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
// Unsubscribes from the current DDM regions, but does not delete the region
65
// information. Needed when adding a new region extent. If
66
// resubscribeWithoutRegion is set, automatically resubscribes without regions.
67
virtual
bool
unsubscribeWithRegionsKeepRegionInfo
(
bool
resubscribeWithoutRegion);
68
69
// Process discovery of a new ball
70
void
ballDiscovered
(
ObjectParams13
* objParams);
71
72
// Process removal of another federate's ball
73
void
ballRemoved
(
RTI::ObjectHandle
handle);
74
75
// Process the movement of the ball into a visible area
76
void
ballVisible
(
RTI::ObjectHandle
handle);
77
78
// Process the movement of the ball out of a visible area
79
void
ballNotVisible
(
RTI::ObjectHandle
handle);
80
81
// Process update of an existing ball
82
void
ballUpdated
(
RTI::ObjectHandle
handle,
83
const
RTI::AttributeHandleValuePairSet
& attrVals);
84
85
// Tries to release ownership of the requested object
86
void
releaseOwnership
(
RTI::ObjectHandle
theObject,
87
RTI::AttributeHandleSet
const
& attributes);
88
89
// Takes control of the ball which the federate has successfully acquired
90
// ownership of
91
void
ownershipAcquired
(
RTI::ObjectHandle
theObject,
92
RTI::AttributeHandleSet
const
& attributes);
93
94
// Tries to assume ownership of the object being divested
95
void
assumeOwnership
(
RTI::ObjectHandle
theObject,
96
RTI::AttributeHandleSet
const
& attributes);
97
98
// Discontinues updates for the ball which the federate has successfully
99
// divested ownership of
100
void
ownershipDivested
(
RTI::ObjectHandle
theObject,
101
RTI::AttributeHandleSet
const
& attributes);
102
103
// Sets the field dimensions
104
virtual
void
setDimensions
(
int
minX,
int
minY,
int
maxX,
int
maxY);
105
106
// Returns the federate ID (based on the federate handle)
107
virtual
const
std::wstring&
federateId
()
const
;
108
109
// Returns the federate type
110
virtual
const
std::wstring&
federateType
()
const
;
111
112
// Returns the federate name
113
virtual
const
std::wstring&
federateName
()
const
;
114
115
// Returns the federation name
116
virtual
const
std::wstring&
federationName
()
const
;
117
118
// Returns false. Federate name is not supported in 1.3.
119
virtual
bool
isFederateNameSupported
()
const
;
120
121
// Returns false. The interaction FOM module extension is not supported
122
// in 1.3.
123
virtual
bool
isInteractionExtensionSupported
()
const
;
124
125
protected
:
126
127
// Sends updates on all owned balls to other federates in the federation
128
virtual
void
sendUpdates
();
129
130
// Receives updates on balls from other federates in the federation
131
virtual
void
receiveUpdates
();
132
133
// Request the RTI to create the a new ball
134
virtual
void
requestNewBall
(
Ball
* ball,
const
std::wstring name);
135
136
// Loads the AttributeHandleValuePairSet with the data from the given ball
137
void
setAttributesForBall
(
RTI::AttributeHandleValuePairSet
& attrVals,
138
const
Ball
* ball);
139
140
// Loads the Ball with the data from the given attributes
141
void
setBallFromAttributes
(
Ball
* ball,
142
const
RTI::AttributeHandleValuePairSet
& attrVals);
143
144
// Subscribes to the default region
145
void
subscribeToDefaultRegion
();
146
147
// Unsubscribes from the default region. Based on input parameter, either
148
// deletes the discovered balls or marks them as out of scope.
149
void
unsubscribeFromDefaultRegion
(
bool
deleteDiscoveredBalls);
150
151
// Deletes known balls. Can delete owned, not owned, or both.
152
virtual
void
deleteKnownBalls
(
bool
deleteOwned,
bool
deleteOthers);
153
154
// Marks all balls this federate does not own as out of scope
155
void
markBallsOutOfScope
();
156
157
// Creates a publication region for the given ball and sets ball's object
158
// parameters with the new region handle.
159
bool
createPublicationRegion
(
Ball
* ball);
160
161
// Constructs a user supplied tag for the given ball object parameters.
162
// Not really relevant to federate operations.
163
std::string
constructTag
(
const
Ball
* ball)
const
;
164
165
private
:
166
167
// No default constructor
168
BallController13
();
169
170
protected
:
171
172
BallMap
myPendingBalls
;
173
174
RTI::RTIambassador
*
myRtiAmbassador
;
175
HlaBounceFederateAmbassador
*
myFederateAmbassador
;
176
177
RTI::FederateHandle
myFederateHandle
;
178
std::wstring
myFederateHandleString
;
179
std::wstring
myFederateType
;
180
std::wstring
myFederationName
;
181
182
bool
myIsSubscribedToDefaultRegion
;
183
RTI::Region
*
mySubscriptionRegion
;
184
185
int
myDdmXRangeConv
;
186
int
myDdmYRangeConv
;
187
188
RTI::ObjectClassHandle
myBallClass
;
189
RTI::AttributeHandle
myColorAttr
;
190
RTI::AttributeHandle
mySizeAttr
;
191
RTI::AttributeHandle
myXAttr
;
192
RTI::AttributeHandle
myYAttr
;
193
RTI::AttributeHandle
mySpeedAttr
;
194
RTI::AttributeHandle
myDirectionAttr
;
195
RTI::AttributeHandleSet
*
myAllBallAttrs
;
196
RTI::AttributeHandleValuePairSet
*
myAttrVals
;
197
RTI::AttributeHandle
myPrivToDeleteAttr
;
198
RTI::SpaceHandle
myXYSpace
;
199
RTI::DimensionHandle
myXDim
;
200
RTI::DimensionHandle
myYDim
;
201
202
static
const
std::string
theFedFile
;
203
static
const
std::string
theBallClassName
;
204
static
const
std::string
theColorAttrName
;
205
static
const
std::string
theSizeAttrName
;
206
static
const
std::string
theXAttrName
;
207
static
const
std::string
theYAttrName
;
208
static
const
std::string
theSpeedAttrName
;
209
static
const
std::string
theDirectionAttrName
;
210
static
const
std::string
thePrivToDeleteAttrName
;
211
static
const
std::string
theXYSpaceName
;
212
static
const
std::string
theXDimName
;
213
static
const
std::string
theYDimName
;
214
};
215
216
#endif
Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (
www.mak.com
)