VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
articulatedPartStateComponent.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 <vlpi/articulatedPartCollection.h>
12 
14 
15 namespace makVrf
16 {
18  {
20  {
21  }
22 
23  void create()
24  {
25  myarticulatedPartManager = std::shared_ptr<DtArticulatedPartManager>(new DtArticulatedPartManager);
26  myartPartList = std::shared_ptr<DtArticulatedPartCollection>(new DtArticulatedPartCollection);
27  }
28 
30  : myarticulatedPartManager(orig.myarticulatedPartManager)
31  , myartPartList(orig.myartPartList)
32  {
33  }
34 
36  {
37  myarticulatedPartManager = rhs.myarticulatedPartManager;
38  myartPartList = rhs.myartPartList;
39 
40  return *this;
41  }
42 
43  bool initialized() const { return (myarticulatedPartManager.get() != 0); };
44  const DtArticulatedPartManager& articulatedPartManager() const { return *(myarticulatedPartManager.get()); };
45  DtArticulatedPartManager& articulatedPartManager(){ return *(myarticulatedPartManager.get()); };
46 
47  const DtArticulatedPartCollection& artPartList() const { return *(myartPartList.get()); };
48  DtArticulatedPartCollection& artPartList() { return *(myartPartList.get()); };
49 
50  protected:
51  std::shared_ptr<DtArticulatedPartManager> myarticulatedPartManager;
52  std::shared_ptr<DtArticulatedPartCollection> myartPartList;
53  };
54 
56 
60  {
61  public:
63 
65  : DtFrameStateInterface(storage)
66  {
67  }
68 
72  };
73 
76  {
77  public:
79 
81  const DtArticulatedPartStateComponentData& frameState() const { return myData; };
83 
84  const DtArticulatedPartManager& articulatedPartManager() const;
85  DtArticulatedPartManager& articulatedPartManager();
86 
87  const DtArticulatedPartManager& articulatedParts() const;
88  DtArticulatedPartManager& articulatedParts();
89 
90  const DtArticulatedPartCollection& artPartList() const;
91  DtArticulatedPartCollection& artPartList();
92 
93  void setCoordinateSystem(const Coordinate_System*);
94 
96  virtual void makeWritable() {};
97 
99  virtual void makeReadOnly() {};
100 
101  void setPublishOnLegionNetwork(bool b);
102 
103  protected:
107  };
108 
111  {
112  public:
114 
116  const DtArticulatedPartStateComponentData& frameState() const { return myData; };
117 
118  const DtArticulatedPartManager& articulatedPartManager() const;
119  const DtArticulatedPartManager& articulatedParts() const;
120  const DtArticulatedPartCollection& artPartList() const;
121 
124  void setUpdateFromLegionNetwork(bool);
125 
126  protected:
129  {
130  myData = data;
131  }
132 
133  protected:
136  };
137 
141  {
142  public:
144 
145  bool isDoubleBuffered() { return true; };
146  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
147  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
148  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
149 
150  virtual void setCoordinateSystem(const Coordinate_System*);
151 
152  virtual void updateDataStorage() override;
153 
155  {
156  myCurrentFrameState.updateStateData(sd);
157  myNextFrameState.updateStateData(sd);
158  }
159 
160  virtual void setPublishingOnLegionNetwork(bool b) override;
161 
162  virtual void initializeFromParameters(const DtVrfObjectParameters* params);
163 
164  virtual void aboutToBeDeleted() override
165  {
167  myCurrentFrameState.aboutToBeDeleted();
168  myNextFrameState.aboutToBeDeleted();
169  }
170 
171  protected:
173  virtual void createPartsFromDescriptors(const std::list<DtSimArtPartDescriptor*>& descriptors,
174  const std::list<DtSimArtPartDescriptor*>& partDefaultsFromActuators);
175 
176  protected:
179  };
180 
184 }
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:63
virtual const DtFrameStateInterface * nextFrameState() const
Definition: articulatedPartStateComponent.h:148
The articulated part manager maintains a tree of articulated and attached parts for the state reposit...
Definition: articulatedPartManager.h:34
std::shared_ptr< DtArticulatedPartCollection > myartPartList
Definition: articulatedPartStateComponent.h:52
virtual DtFrameStateInterface * nextFrameState()
Definition: articulatedPartStateComponent.h:147
2) Define the next frame class. This will be used for write access.
Definition: articulatedPartStateComponent.h:75
A readable, writable type that holds an articulated part type, attached-to part type, attachment point, and a list of art-part params (DtSimArtPartParamList). The read/write name is not used for anything in particular, and therefore may be used for file readability.
Definition: simArtPartDescriptor.h:28
Definition: stateComponent.h:266
In order to be a well defined state component, you must:
Definition: articulatedPartStateComponent.h:59
DtArticulatedPartManager & articulatedPartManager()
Definition: articulatedPartStateComponent.h:45
#define UNDEFINED_RETURNREF_ACCESSORS(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:40
const DtArticulatedPartStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: articulatedPartStateComponent.h:116
DtArticulatedPartStateComponentNextFrame myNextFrameState
Definition: articulatedPartStateComponent.h:178
DtArticulatedPartStateComponentData()
Definition: articulatedPartStateComponent.h:19
bool isDoubleBuffered()
Definition: articulatedPartStateComponent.h:145
virtual void aboutToBeDeleted() override
Definition: articulatedPartStateComponent.h:164
const DtArticulatedPartStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: articulatedPartStateComponent.h:81
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
DtArticulatedPartStateComponentData myData
Definition: articulatedPartStateComponent.h:105
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:228
DtStateData * myStateData
Definition: articulatedPartStateComponent.h:104
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: articulatedPartStateComponent.h:154
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:379
DtArticulatedPartStateComponentData(const DtArticulatedPartStateComponentData &orig)
Definition: articulatedPartStateComponent.h:29
DtStateComponentCreator< DtArticulatedPartStateComponentImplementation > DtArticulatedPartStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: articulatedPartStateComponent.h:183
virtual void aboutToBeDeleted()
bool initialized() const
Definition: articulatedPartStateComponent.h:43
DtArticulatedPartStateComponentData & frameState()
Definition: articulatedPartStateComponent.h:82
std::shared_ptr< DtArticulatedPartManager > myarticulatedPartManager
Definition: articulatedPartStateComponent.h:48
virtual void makeReadOnly()
Override to make component read-only.
Definition: articulatedPartStateComponent.h:99
const DtFrameStateInterface * currentFrameState() const
Definition: articulatedPartStateComponent.h:146
DtArticulatedPartStateComponentData & operator=(const DtArticulatedPartStateComponentData &rhs)
Definition: articulatedPartStateComponent.h:35
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: articulatedPartStateComponent.h:140
void create()
Definition: articulatedPartStateComponent.h:23
void advanceFrame(const DtArticulatedPartStateComponentData &data)
Definition: articulatedPartStateComponent.h:128
virtual void makeWritable()
Override to make component writable.
Definition: articulatedPartStateComponent.h:96
DtArticulatedPartStateComponentCurrentFrame myCurrentFrameState
Definition: articulatedPartStateComponent.h:177
#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
const DtArticulatedPartManager & articulatedPartManager() const
Definition: articulatedPartStateComponent.h:44
const DtArticulatedPartCollection & artPartList() const
Definition: articulatedPartStateComponent.h:47
bool myPublishOnLegionNetwork
Definition: articulatedPartStateComponent.h:106
Definition: articulatedPartStateComponent.h:17
3) Define the current frame class. This will be used for read access.
Definition: articulatedPartStateComponent.h:110
Contains the DtStateComponent class declaration.
DtArticulatedPartStateComponentData myData
Definition: articulatedPartStateComponent.h:134
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
bool myUpdateFromLegionNetwork
Definition: articulatedPartStateComponent.h:135

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)