VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aggregateStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include "geometry/extent.h"
12 
13 namespace makVrf
14 {
17  {
19  : myFormation(DtOtherAggregateFormation)
20  , myAggregateState(DtOtherAggregateState)
21  {
22  }
23 
26  , myFormationName(orig.myFormationName)
27  , myAggregateState(orig.myAggregateState)
28  , myFormation(orig.myFormation)
29  {
30  }
31 
33  {
35 
36  myFormationName = rhs.myFormationName;
37  myFormation = rhs.myFormation;
38  myAggregateState = rhs.myAggregateState;
39 
40  return *this;
41  }
42 
43  DEFINE_ACCESSOR_MUTATOR(DtAggregateFormation, formation, Formation)
44  DEFINE_ACCESSOR_MUTATOR(DtString, formationName, FormationName)
45  DEFINE_ACCESSOR_MUTATOR(DtAggregateState, aggregateState, AggregateState)
46 
47  protected:
49  DtAggregateFormation myFormation;
51  DtString myFormationName;
53  DtAggregateState myAggregateState;
54  };
55 
59  {
60  public:
62 
64  : DtEntityStateComponent(storage)
65  {
66  }
67 
68  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, formationName, FormationName)
69  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtAggregateState, aggregateState, AggregateState)
70  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtAggregateFormation, formation, Formation)
71  };
72 
75  {
76  public:
78 
80  const DtAggregateStateComponentData& aggregateFrameState() const { return myAggregateData; };
81  DtAggregateStateComponentData& aggregateFrameState() { return myAggregateData; };
82 
83  virtual const DtString& formationName() const override;
84  virtual void setFormationName(const DtString&) override;
85 
86  virtual const DtAggregateState& aggregateState() const override;
87  virtual void setAggregateState(const DtAggregateState&) override;
88 
89  virtual const DtAggregateFormation& formation() const override;
90  virtual void setFormation(const DtAggregateFormation&) override;
91 
92  protected:
94  };
95 
98  {
99  public:
101 
103  const DtAggregateStateComponentData& aggregateFrameState() const { return myAggregateData; };
104 
105  virtual const DtString& formationName() const override;
106  virtual const DtAggregateState& aggregateState() const override;
107  virtual const DtAggregateFormation& formation() const override;
108 
109  protected:
112  {
113  myAggregateData = data;
114  }
115 
116  protected:
118  };
119 
123  {
124  public:
126  virtual ~DtAggregateStateComponentImplementation() override;
127 
128  bool isDoubleBuffered() { return true; };
129  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
130  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
131  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
132 
133  virtual void updateDataStorage() override
134  {
135  if (myNextFrameState.isWritable())
136  {
137  myCurrentFrameState.advanceAggregateFrame(myNextFrameState.aggregateFrameState());
138  myCurrentFrameState.checkForUpdatedItems();
139  }
140 
141  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
142  myCurrentFrameState.emitComponentUpdated();
143  }
144 
145  virtual void updateStateData(DtStateData* sd) override
146  {
147  myCurrentFrameState.updateStateData(sd);
148  myNextFrameState.updateStateData(sd);
149  }
150 
151  virtual Legion::WriteStateInstance writeStateInstance() override { return myWriteAggregateStateRepository; };
152 
154  virtual void convertToRemote() override;
155 
157  virtual void convertToLocal() override;
158 
159  virtual void addAdditionalStateComponents() override;
160 
161  virtual bool forceAdvance() override;
162 
163  virtual void aboutToBeDeleted() override
164  {
166  myCurrentFrameState.aboutToBeDeleted();
167  myNextFrameState.aboutToBeDeleted();
168  }
169 
170  protected:
173  LOM::WriteEntityRepository myWriteAggregateStateRepository;
174  };
175 
179 }
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: aggregateStateComponent.h:145
Write-access (next-frame) entity state component template.
Definition: entityStateComponent.h:227
3) Define the current frame class. This will be used for read access.
Definition: aggregateStateComponent.h:97
DtAggregateStateComponentData(const DtAggregateStateComponentData &orig)
Definition: aggregateStateComponent.h:24
DtAggregateStateComponentData operator=(const DtAggregateStateComponentData &rhs)
Definition: aggregateStateComponent.h:32
DtAggregateStateComponentNextFrame myNextFrameState
Definition: aggregateStateComponent.h:172
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: aggregateStateComponent.h:133
DtAggregateStateComponentData()
Definition: aggregateStateComponent.h:18
virtual Legion::WriteStateInstance writeStateInstance() override
Returns the Legion write state instance for this component. Throws if not supported.
Definition: aggregateStateComponent.h:151
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aggregateStateComponent.h:122
Abstract base interface for the entity state component.
Definition: entityStateComponent.h:141
const DtAggregateStateComponentData & aggregateFrameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aggregateStateComponent.h:103
DtAggregateState myAggregateState
Operational state of the aggregate unit (e.g., aggregated, disaggregated, fully disaggregated).
Definition: aggregateStateComponent.h:53
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
2) Define the next frame class. This will be used for write access.
Definition: aggregateStateComponent.h:74
Plain data container holding aggregate-specific state fields for use in the double-buffered state com...
Definition: aggregateStateComponent.h:16
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: aggregateStateComponent.h:58
DtAggregateStateComponentData myAggregateData
Definition: aggregateStateComponent.h:93
Plain-old-data container for all serializable entity state fields.
Definition: entityStateComponent.h:30
DtStateComponentCreator< DtAggregateStateComponentImplementation > DtAggregateStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aggregateStateComponent.h:178
bool isDoubleBuffered()
Definition: aggregateStateComponent.h:128
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the read-only current frame state. Throws if not double-buffered.
Definition: aggregateStateComponent.h:129
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#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
DtAggregateStateComponentData & aggregateFrameState()
Definition: aggregateStateComponent.h:81
Read-only (current-frame) entity state component template.
Definition: entityStateComponent.h:404
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
void advanceAggregateFrame(const DtAggregateStateComponentData &data)
Definition: aggregateStateComponent.h:111
DtAggregateStateComponentData myAggregateData
Definition: aggregateStateComponent.h:117
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
#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
const DtAggregateStateComponentData & aggregateFrameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: aggregateStateComponent.h:80
#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 void aboutToBeDeleted() override
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
Definition: aggregateStateComponent.h:163
DtAggregateFormation myFormation
Formation type of the aggregate unit.
Definition: aggregateStateComponent.h:49
DtAggregateStateComponentCurrentFrame myCurrentFrameState
Definition: aggregateStateComponent.h:171
Contains the declaration of the DtExtent class.
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the read-only next frame state. Throws if not double-buffered.
Definition: aggregateStateComponent.h:131
virtual DtFrameStateInterface * nextFrameState() override
Returns the writable next frame state. Throws if not double-buffered.
Definition: aggregateStateComponent.h:130
#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
DtEntityStateComponentData & operator=(const DtEntityStateComponentData &rhs)
Assignment operator. Performs a member-wise deep copy of rhs.
Definition: entityStateComponent.h:64
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtString myFormationName
Name of the formation assigned to the aggregate unit.
Definition: aggregateStateComponent.h:51
LOM::WriteEntityRepository myWriteAggregateStateRepository
Definition: aggregateStateComponent.h:173

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)