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 {
16  {
18  : myFormation(DtOtherAggregateFormation)
19  , myAggregateState(DtOtherAggregateState)
20  {
21  }
22 
25  , myFormationName(orig.myFormationName)
26  , myAggregateState(orig.myAggregateState)
27  , myFormation(orig.myFormation)
28  {
29  }
30 
32  {
34 
35  myFormationName = rhs.myFormationName;
36  myFormation = rhs.myFormation;
37  myAggregateState = rhs.myAggregateState;
38 
39  return *this;
40  }
41 
42  DEFINE_ACCESSOR_MUTATOR(DtAggregateFormation, formation, Formation)
43  DEFINE_ACCESSOR_MUTATOR(DtString, formationName, FormationName)
44  DEFINE_ACCESSOR_MUTATOR(DtAggregateState, aggregateState, AggregateState)
45 
46  protected:
47  DtAggregateFormation myFormation;
48  DtString myFormationName;
49  DtAggregateState myAggregateState;
50  };
51 
55  {
56  public:
58 
60  : DtEntityStateComponent(storage)
61  {
62  }
63 
64  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, formationName, FormationName)
65  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtAggregateState, aggregateState, AggregateState)
66  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtAggregateFormation, formation, Formation)
67  };
68 
71  {
72  public:
74 
76  const DtAggregateStateComponentData& aggregateFrameState() const { return myAggregateData; };
77  DtAggregateStateComponentData& aggregateFrameState() { return myAggregateData; };
78 
79  virtual const DtString& formationName() const override;
80  virtual void setFormationName(const DtString&) override;
81 
82  virtual const DtAggregateState& aggregateState() const override;
83  virtual void setAggregateState(const DtAggregateState&) override;
84 
85  virtual const DtAggregateFormation& formation() const override;
86  virtual void setFormation(const DtAggregateFormation&) override;
87 
88  protected:
90  };
91 
94  {
95  public:
97 
99  const DtAggregateStateComponentData& aggregateFrameState() const { return myAggregateData; };
100 
101  virtual const DtString& formationName() const override;
102  virtual const DtAggregateState& aggregateState() const override;
103  virtual const DtAggregateFormation& formation() const override;
104 
105  protected:
108  {
109  myAggregateData = data;
110  }
111 
112  protected:
114  };
115 
119  {
120  public:
122  virtual ~DtAggregateStateComponentImplementation() override;
123 
124  bool isDoubleBuffered() { return true; };
125  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
126  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
127  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
128 
129  virtual void updateDataStorage() override
130  {
131  if (myNextFrameState.isWritable())
132  {
133  myCurrentFrameState.advanceAggregateFrame(myNextFrameState.aggregateFrameState());
134  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
135  }
136 
137  myCurrentFrameState.checkForUpdatedItems();
138  myCurrentFrameState.emitComponentUpdated();
139  }
140 
141  virtual void updateStateData(DtStateData* sd) override
142  {
143  myCurrentFrameState.updateStateData(sd);
144  myNextFrameState.updateStateData(sd);
145  }
146 
147  virtual Legion::WriteStateInstance writeStateInstance() override { return myWriteAggregateStateRepository; };
148 
150  virtual void convertToRemote() override;
151 
153  virtual void convertToLocal() override;
154 
155  virtual void addAdditionalStateComponents() override;
156 
157  virtual bool forceAdvance() override;
158 
159  virtual void aboutToBeDeleted() override
160  {
162  myCurrentFrameState.aboutToBeDeleted();
163  myNextFrameState.aboutToBeDeleted();
164  }
165 
166  protected:
169  LOM::WriteEntityRepository myWriteAggregateStateRepository;
170  };
171 
175 }
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: aggregateStateComponent.h:141
2) Define the next frame class. This will be used for write access.
Definition: entityStateComponent.h:127
3) Define the current frame class. This will be used for read access.
Definition: aggregateStateComponent.h:93
DtAggregateStateComponentData(const DtAggregateStateComponentData &orig)
Definition: aggregateStateComponent.h:23
DtAggregateStateComponentData operator=(const DtAggregateStateComponentData &rhs)
Definition: aggregateStateComponent.h:31
DtAggregateStateComponentNextFrame myNextFrameState
Definition: aggregateStateComponent.h:168
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: aggregateStateComponent.h:129
DtAggregateStateComponentData()
Definition: aggregateStateComponent.h:17
virtual Legion::WriteStateInstance writeStateInstance() override
Definition: aggregateStateComponent.h:147
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aggregateStateComponent.h:118
1) Define the interface class that will be used to represent the next and current frames...
Definition: entityStateComponent.h:91
const DtAggregateStateComponentData & aggregateFrameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aggregateStateComponent.h:99
DtAggregateState myAggregateState
Definition: aggregateStateComponent.h:49
Definition: stateComponent.h:269
2) Define the next frame class. This will be used for write access.
Definition: aggregateStateComponent.h:70
Definition: aggregateStateComponent.h:15
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:54
DtAggregateStateComponentData myAggregateData
Definition: aggregateStateComponent.h:89
Definition: entityStateComponent.h:25
DtStateComponentCreator< DtAggregateStateComponentImplementation > DtAggregateStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aggregateStateComponent.h:174
bool isDoubleBuffered()
Definition: aggregateStateComponent.h:124
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: aggregateStateComponent.h:125
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
DtAggregateStateComponentData & aggregateFrameState()
Definition: aggregateStateComponent.h:77
3) Define the current frame class. This will be used for read access.
Definition: entityStateComponent.h:208
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
void advanceAggregateFrame(const DtAggregateStateComponentData &data)
Definition: aggregateStateComponent.h:107
DtAggregateStateComponentData myAggregateData
Definition: aggregateStateComponent.h:113
virtual void aboutToBeDeleted()
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
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:76
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
virtual void aboutToBeDeleted() override
Definition: aggregateStateComponent.h:159
DtAggregateFormation myFormation
Definition: aggregateStateComponent.h:47
DtAggregateStateComponentCurrentFrame myCurrentFrameState
Definition: aggregateStateComponent.h:167
Contains the declaration of the DtExtent class.
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: aggregateStateComponent.h:127
virtual DtFrameStateInterface * nextFrameState() override
Definition: aggregateStateComponent.h:126
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:26
DtEntityStateComponentData & operator=(const DtEntityStateComponentData &rhs)
Definition: entityStateComponent.h:49
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
DtString myFormationName
Definition: aggregateStateComponent.h:48
LOM::WriteEntityRepository myWriteAggregateStateRepository
Definition: aggregateStateComponent.h:169

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)