13 #include <tbb/spin_rw_mutex.h>
37 , myThickness(thickness)
38 , myPermeability(permeability)
39 , myPriority(priority)
56 myDepth = orig.myDepth;
57 myPermeability = orig.myPermeability;
58 myPriority = orig.myPriority;
59 myThickness = orig.myThickness;
69 return myDepth < other.myDepth;
77 return (myDepth == other.myDepth
78 && myPriority == other.myPriority
79 && myThickness == other.myThickness
80 && myPermeability == other.myPermeability);
87 return !(*
this == other);
104 : myUnderwaterVisibility(0.)
105 , mySubsurfaceLayers()
106 , myAmbientWaterTemperature(0.)
123 myUnderwaterVisibility = orig.myUnderwaterVisibility;
124 mySubsurfaceLayers = orig.mySubsurfaceLayers;
125 myAmbientWaterTemperature = orig.myAmbientWaterTemperature;
126 myPriority = orig.myPriority;
184 bool myIsRemoteComponent =
false;
191 #define THERMOCLINE_GETTER(number, Accessor, Setter) \
192 const double thermoclineLayer##number####Setter() const override \
194 const unsigned indexToUse = number - 1; \
195 DtVrfSubsurfaceLayer dummy; \
196 thermoclineLayer(indexToUse, dummy); \
197 return dummy.Accessor(); \
205 #define THERMOCLINE_SETTER(number, Accessor, Setter) \
206 void setThermoclineLayer##number####Setter( const double& Accessor ) override \
208 const unsigned indexToUse = number - 1; \
209 DtVrfSubsurfaceLayer dummy; \
210 thermoclineLayer(indexToUse, dummy); \
211 if (dummy.Accessor() != Accessor) \
213 dummy.set##Setter(Accessor); \
215 setThermoclineLayerByIndex(dummy, indexToUse); \
223 #define THERMOCLINE_SETTER_GETTER(number, Accessor, Setter) \
224 THERMOCLINE_GETTER(number, Accessor, Setter); \
225 THERMOCLINE_SETTER(number, Accessor, Setter);
234 #define NEXTFRAME_ACCESSOR_MUTATOR_(MemberType, Accessor, MutatorAndMember) \
236 const MemberType Accessor() const override { return frameState().Accessor(); }; \
237 void set##MutatorAndMember(const MemberType& v) override { if (frameState().Accessor() != v) { markModified(); frameState().set##MutatorAndMember(v); } };
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
virtual void removeSubsurfaceLayer(const DtVrfSubsurfaceLayer &layerToRemove)
Removes a subsurface layer. Must be overridden by a concrete subclass.
Definition: subsurfaceStateComponent.h:176
bool operator==(const DtVrfSubsurfaceLayer &other) const
Equality comparison. All properties must match for layers to be considered equal. ...
Definition: subsurfaceStateComponent.h:75
DtVrfSubsurfaceLayer(const DtVrfSubsurfaceLayer &orig)
Copy constructor.
Definition: subsurfaceStateComponent.h:45
Template for the next-frame (writable) portion of a double-buffered state component. Frame-state access is intended for single-threaded use from a controller thread.
Definition: stateComponentImplementationTemplate.h:87
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
#define NEXTFRAME_ACCESSOR_BY_REF_MUTATOR(MemberType, Accessor, MutatorAndMember)
Declares a public next-frame accessor (by const reference) and next-frame mutator pair...
Definition: stateComponentImplementationTemplate.h:72
DtSubsurfaceStateComponentData()
Default constructor. Initializes all data members to zero.
Definition: subsurfaceStateComponent.h:103
Definition: stateComponent.h:103
virtual ~DtSubsurfaceStateComponentNextFrame() override
Destructor.
Definition: subsurfaceStateComponent.h:251
#define THERMOCLINE_GETTER(number, Accessor, Setter)
Generates a const getter for a thermocline layer property at the given 1-based layer number...
Definition: subsurfaceStateComponent.h:191
0) Define the State Component Data. This struct replaces the legion stuff
Definition: subsurfaceStateComponent.h:100
#define CURRENTFRAME_ACCESSOR_BY_REF(MemberType, Accessor, MutatorAndMember)
Declares a read-only current-frame accessor (by const reference). The MutatorAndMember parameter is u...
Definition: stateComponentImplementationTemplate.h:81
#define CURRENTFRAME_ACCESSOR(MemberType, Accessor, MutatorAndMember)
Declares a read-only current-frame accessor (by value). The MutatorAndMember parameter is unused...
Definition: stateComponentImplementationTemplate.h:77
bool operator<(const DtVrfSubsurfaceLayer &other) const
Less-than comparison based on depth, used for ordering in the multiset.
Definition: subsurfaceStateComponent.h:67
Template that combines a current-frame and next-frame sub-component into a fully double-buffered stat...
Definition: stateComponentImplementationTemplate.h:111
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
#define NEXTFRAME_ACCESSOR_MUTATOR(MemberType, Accessor, MutatorAndMember)
Declares a public next-frame accessor (by value) and next-frame mutator pair.
Definition: stateComponentImplementationTemplate.h:62
DtSubsurfaceStateComponentCurrentFrame(DtStateData *sd)
Constructs a current-frame state component backed by the given state data storage.
Definition: subsurfaceStateComponent.h:313
2) Define the next frame class. This will be used for write access.
Definition: subsurfaceStateComponent.h:240
1) Define the interface class that will be used to represent the next and current frames...
Definition: subsurfaceStateComponent.h:139
DtVrfSubsurfaceLayer()
Default constructor. Initializes all values to zero.
Definition: subsurfaceStateComponent.h:22
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual by-value accessor and an undefined virtual setter, both throwing DtUnimp...
Definition: doubleBufferedDataStorage.h:103
DtSubsurfaceStateComponentNextFrame(DtStateData *sd)
Constructs a next-frame state component backed by the given state data storage.
Definition: subsurfaceStateComponent.h:245
DtStateComponentCreator< DtSubsurfaceStateComponentImplementation > DtSubsurfaceStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: subsurfaceStateComponent.h:359
bool operator!=(const DtVrfSubsurfaceLayer &other) const
Inequality comparison.
Definition: subsurfaceStateComponent.h:85
virtual void addSubsurfaceLayer(const DtVrfSubsurfaceLayer &layerToAdd)
Adds a subsurface layer. Must be overridden by a concrete subclass.
Definition: subsurfaceStateComponent.h:173
DtVrfSubsurfaceLayer(double depth, double thickness, double permeability, int priority)
Constructs a subsurface layer with the specified properties.
Definition: subsurfaceStateComponent.h:35
#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
Represents a single subsurface (thermocline) layer defined by depth, thickness, permeability, and priority.
Definition: subsurfaceStateComponent.h:19
#define ACCESSOR_MUTATOR_MEMBER(MemberType, Accessor, MutatorAndMember)
Declares a public accessor (by value and reference), a public mutator, and a protected member field...
Definition: stateComponentImplementationTemplate.h:30
DtSubsurfaceStateComponentData & operator=(const DtSubsurfaceStateComponentData &orig)
Assignment operator.
Definition: subsurfaceStateComponent.h:120
#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
std::multiset< DtVrfSubsurfaceLayer > DtVrfSubsurfaceLayerSet
An ordered multiset of subsurface layers, sorted by depth via operator<.
Definition: subsurfaceStateComponent.h:96
#define THERMOCLINE_SETTER_GETTER(number, Accessor, Setter)
Convenience macro that generates both a getter and a setter for a thermocline layer property...
Definition: subsurfaceStateComponent.h:223
3) Define the current frame class. This will be used for read access.
Definition: subsurfaceStateComponent.h:308
tbb::spin_rw_mutex myMutex
Read-write mutex protecting concurrent access to next-frame state data.
Definition: subsurfaceStateComponent.h:304
DtSubsurfaceStateComponentData(const DtSubsurfaceStateComponentData &orig)
Copy constructor.
Definition: subsurfaceStateComponent.h:112
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
Template for the current-frame (read-only) view of a double-buffered state component. Exposes promoted current-frame data through read-only accessors.
Definition: stateComponentImplementationTemplate.h:176
ACCESSOR_MUTATOR_MEMBER(double, depth, Depth)
DtVrfSubsurfaceLayer & operator=(const DtVrfSubsurfaceLayer &orig)
Assignment operator.
Definition: subsurfaceStateComponent.h:53
void setIsRemoteComponent(bool b)
Sets whether this component represents a remotely controlled entity.
Definition: subsurfaceStateComponent.h:180