25 : mySubordinates(orig.mySubordinates)
48 mySubordinates.push_back(uuid);
52 if (index >= mySubordinates.size())
54 while (mySubordinates.size() <= index)
60 mySubordinates[index] = uuid;
68 std::vector<DtUUID>::iterator iter = mySubordinates.begin();
69 std::vector<DtUUID>::iterator end = mySubordinates.end();
75 mySubordinates.erase(iter);
92 std::vector<DtUUID>::const_iterator iter = mySubordinates.begin();
93 std::vector<DtUUID>::const_iterator end = mySubordinates.end();
112 if (mySubordinates.size())
114 return mySubordinates[0];
124 if (mySubordinates.size())
126 return mySubordinates[mySubordinates.size() - 1];
134 std::vector<DtUUID> mySubordinates{};
159 virtual
int numSubordinates()
const {
throw DtUnimplementedMethod(
"The int numSubordinates() const is undefined for this class."); };
170 mutable boost::signals2::signal<void (const DtFrameStateInterface*, const std::vector<DtUUID>& oldSubordinates,
const std::vector<DtUUID>& newSubordinates)> signal_subordinatesChanged{};
186 virtual int numSubordinates()
const override;
189 virtual int indexOfSubordinate(
const DtUUID&)
const override;
191 virtual const DtUUID& firstSubordinate()
const override;
193 virtual const DtUUID& lastSubordinate()
const override;
195 virtual const std::vector<DtUUID>& subordinates()
const override;
198 virtual void setSubordinates(
const std::vector<DtUUID>&)
override;
201 virtual void addSubordinate(
const DtUUID&,
int index = -1)
override;
204 virtual bool removeSubordinate(
const DtUUID&)
override;
207 virtual bool hasSubordinate(
const DtUUID&)
const override;
209 virtual void removeAllSubordinates()
override;
215 virtual void makeReadOnly()
override {};
234 virtual const DtUUID& firstSubordinate()
const override;
236 virtual const DtUUID& lastSubordinate()
const override;
238 virtual int numSubordinates()
const override;
241 virtual int indexOfSubordinate(
const DtUUID&)
const override;
243 virtual const std::vector<DtUUID>& subordinates()
const override;
246 virtual bool hasSubordinate(
const DtUUID&)
const override;
285 virtual void updateDataStorage()
override;
291 myCurrentFrameState.updateStateData(sd);
292 myNextFrameState.updateStateData(sd);
299 myCurrentFrameState.aboutToBeDeleted();
300 myNextFrameState.aboutToBeDeleted();
UUID is a unique ID wrapper class.
Definition: uuid.h:59
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
virtual int indexOfSubordinate(const DtUUID &) const
Returns the zero-based index of the specified subordinate UUID, or -1 if not found.
Definition: subordinateManagerStateComponent.h:163
DtSubordinateManagerStateComponentCurrentFrame myCurrentFrameState
The current (read) frame state.
Definition: subordinateManagerStateComponent.h:305
bool hasSubordinate(const DtUUID &uuid) const
Checks whether the specified UUID is present in the subordinate list.
Definition: subordinateManagerStateComponent.h:90
#define UNDEFINED_METHOD(Type, Method,...)
Defines a virtual non-const method with variadic parameters that throws DtUnimplementedMethod, requiring an override in a derived class.
Definition: doubleBufferedDataStorage.h:138
2) Define the next frame class. This will be used for write access.
Definition: subordinateManagerStateComponent.h:174
DtSubordinateManagerStateComponentData myData
Current frame subordinate manager data storage.
Definition: subordinateManagerStateComponent.h:259
DtSubordinateManagerStateComponentData & operator=(const DtSubordinateManagerStateComponentData &rhs)
Assignment operator.
Definition: subordinateManagerStateComponent.h:32
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
const DtSubordinateManagerStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: subordinateManagerStateComponent.h:231
const DtSubordinateManagerStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: subordinateManagerStateComponent.h:182
std::vector< DtUUID > mySubordinates
Cached copy of the last-published subordinate list, used to detect changes for signal emission...
Definition: subordinateManagerStateComponent.h:309
Contains the DtUUID class declaration.
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
void advanceFrame(const DtSubordinateManagerStateComponentData &data)
Advances the current frame by copying state from the given data snapshot.
Definition: subordinateManagerStateComponent.h:252
const DtUUID & lastSubordinate() const
Returns the UUID of the last subordinate, or a null UUID if the list is empty.
Definition: subordinateManagerStateComponent.h:122
virtual void makeWritable() override
Override to make component writable.
Definition: subordinateManagerStateComponent.h:212
void addSubordinate(const DtUUID &uuid, int index=-1)
Adds a subordinate UUID to the list, optionally at a specific index.
Definition: subordinateManagerStateComponent.h:44
static const DtUUID & nullUUID()
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
Plain data container for subordinate manager state, storing the ordered list of subordinate entity UU...
Definition: subordinateManagerStateComponent.h:16
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Macro to define all required static and virtual state component type methods. Place in the public sec...
Definition: stateComponent.h:272
virtual bool hasSubordinate(const DtUUID &) const
Returns whether the given UUID is present in the subordinate list.
Definition: subordinateManagerStateComponent.h:167
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtSubordinateManagerStateComponentData(const DtSubordinateManagerStateComponentData &orig)
Copy constructor.
Definition: subordinateManagerStateComponent.h:24
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool isDoubleBuffered()
Returns true, indicating this component uses double-buffered storage.
Definition: subordinateManagerStateComponent.h:273
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: subordinateManagerStateComponent.h:264
virtual const DtFrameStateInterface * currentFrameState() const override
Returns a const pointer to the current frame state.
Definition: subordinateManagerStateComponent.h:276
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual const-reference accessor and an undefined virtual setter, both throwing DtUnimplementedMethod and requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:112
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
virtual DtFrameStateInterface * nextFrameState() override
Returns a pointer to the next frame state for write access.
Definition: subordinateManagerStateComponent.h:279
Definition: stateComponent.h:79
virtual void updateStateData(DtStateData *sd) override
Updates both frame states to reference the new state data storage.
Definition: subordinateManagerStateComponent.h:289
const DtUUID & firstSubordinate() const
Returns the UUID of the first subordinate, or a null UUID if the list is empty.
Definition: subordinateManagerStateComponent.h:110
3) Define the current frame class. This will be used for read access.
Definition: subordinateManagerStateComponent.h:223
DtSubordinateManagerStateComponentData()
Default constructor.
Definition: subordinateManagerStateComponent.h:19
1) Define the interface class that will be used to represent the next and curent frames. The UNDEFINED_ macros are convenience macros that will define methods that throw exceptions (until they are implemented)
Definition: subordinateManagerStateComponent.h:139
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:29
DtSubordinateManagerStateComponentNextFrame myNextFrameState
The next (write) frame state.
Definition: subordinateManagerStateComponent.h:307
DtSubordinateManagerStateComponentData & frameState()
Definition: subordinateManagerStateComponent.h:183
virtual void aboutToBeDeleted() override
Notifies both frame states that this component is about to be destroyed.
Definition: subordinateManagerStateComponent.h:296
Contains the DtStateComponent class declaration.
virtual const DtFrameStateInterface * nextFrameState() const override
Returns a const pointer to the next frame state.
Definition: subordinateManagerStateComponent.h:282
bool removeSubordinate(const DtUUID &uuid)
Removes the first occurrence of the given subordinate UUID from the list.
Definition: subordinateManagerStateComponent.h:66
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtStateComponentCreator< DtSubordinateManagerStateComponentImplementation > DtSubordinateManagerStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: subordinateManagerStateComponent.h:314
std::vector< DtUUID > mySubordinates
Ordered list of subordinate entity UUIDs.
Definition: subordinateManagerStateComponent.h:134
void removeAllSubordinates()
Removes all subordinates from the list.
Definition: subordinateManagerStateComponent.h:86