AGX Dynamics  2.37.2.0
CylinderEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
18 // AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20 
21 #ifndef GENERATED_AGX_PHYSICS_GEOMETRY_CYLINDER_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_CYLINDER_H_PLUGIN
23 
24 #define AGX_ENTITY_WRAPPER 1
25 
26 
27 #ifdef _MSC_VER
28 # pragma warning(push)
29 // warning C4505: 'agxData::VectorAttributeT<T>::print' : unreferenced local function has been removed
30 # pragma warning( disable : 4505 )
31 // warning C4251: 'X' : class 'Y' needs to have dll-interface to be used by clients of class 'Z'
32 # pragma warning( disable : 4251 )
33 // warning C4355: 'this' : used in base member initializer list
34 # pragma warning( disable : 4355 )
35 // marked as __forceinline not inlined
36 # pragma warning( disable: 4714 )
37 #endif
38 
39 #include <agxData/EntityModel.h>
40 #include <agxData/EntityStorage.h>
41 #include <agxData/EntityRef.h>
42 #include <agxData/EntityPtr.h>
43 #include <agxData/EntityInstance.h>
44 #include <agx/Integer.h>
45 #include <agx/Real.h>
46 #include <agx/macros.h>
48 #include <agx/Real.h>
49 
50 
51 namespace agx
52 {
53  namespace Physics
54  {
55  namespace Geometry
56  {
57 
58  class CylinderModel;
59  class CylinderData;
60  class CylinderPtr;
61  class CylinderInstance;
62  class CylinderSemantics;
63 
64 
66 
71  {
72  public:
73  typedef CylinderPtr PtrT;
74 
75  CylinderModel(const agx::String& name = "Cylinder");
76 
78  static CylinderModel* instance();
79 
81  static CylinderPtr createInstance();
82 
84  static agxData::EntityStorage* defaultStorage();
85 
87  virtual void shutdownCleanup() override;
88 
89 
90 
91  /* Attributes */
94 
95  protected:
96  virtual ~CylinderModel();
97  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
98  virtual void configure(agx::TiXmlElement* eEntity) override;
99  virtual void initAttributeAccessors() override;
100  virtual void construct(agxData::EntityPtr instance) override;
101  void construct(agx::Physics::Geometry::CylinderPtr cylinder);
102  };
103 
104 
106  #ifndef AGX_PHYSICS_GEOMETRY_CYLINDER_DATA_SET_OVERRIDE
107  #define AGX_PHYSICS_GEOMETRY_CYLINDER_DATA_SET
108  class AGXPHYSICS_EXPORT CylinderData : public agx::Physics::Geometry::ShapeData
109  {
110  public:
111  CylinderInstance operator[] (size_t index);
112 
113  public:
117 
118  public:
119  typedef agx::Real heightType;
120  typedef agx::Real radiusType;
121 
122  public:
123  CylinderData(agxData::EntityStorage* storage);
124  CylinderData();
125 
126  protected:
127  virtual ~CylinderData() {}
128  virtual void setNumElements(agx::Index numElements) override;
129 
130  private:
131  CylinderData& operator= (const CylinderData&) { return *this; }
132 
133  };
134  #endif
136 
137 
139  class AGXPHYSICS_EXPORT CylinderSemantics : public agx::Physics::Geometry::ShapeSemantics
140  {
141  public:
142 
143  // Automatic getters
144  agx::Real const& getHeight() const;
145  agx::Real const& getRadius() const;
146 
147  // Semantics defined by explicit kernels
148 
149  // Automatic setters
150  void setHeight(agx::Real const& value);
151  void setRadius(agx::Real const& value);
152 
153 
154  protected:
155  friend class CylinderPtr;
156  friend class CylinderInstance;
157  CylinderSemantics();
158  };
160 
161 
162 
165  class CALLABLE CylinderPtr : public agx::Physics::Geometry::ShapePtr
166  {
167  public:
169  typedef CylinderData DataType;
170  typedef CylinderInstance InstanceType;
171 
172  public:
177  AGXPHYSICS_EXPORT CylinderPtr& operator= (const agxData::EntityPtr& ptr);
178  AGXPHYSICS_EXPORT CylinderPtr& operator= (const agxData::EntityInstance& instance);
179  AGXPHYSICS_EXPORT CylinderInstance instance();
180  AGXPHYSICS_EXPORT const CylinderInstance instance() const;
181 
182  AGXPHYSICS_EXPORT CylinderSemantics* operator->();
183  AGXPHYSICS_EXPORT const CylinderSemantics* operator->() const;
184 
185  CylinderData* getData();
186  const CylinderData* getData() const;
187 
188 
190  AGXPHYSICS_EXPORT agx::Real& height();
192  AGXPHYSICS_EXPORT agx::Real const& height() const;
193 
195  AGXPHYSICS_EXPORT agx::Real& radius();
197  AGXPHYSICS_EXPORT agx::Real const& radius() const;
198 
199  };
200 
201  // Entity is Referenced
203 
204 
206  class AGXPHYSICS_EXPORT CylinderInstance : public agx::Physics::Geometry::ShapeInstance
207  {
208  public:
209  CylinderInstance();
210  CylinderInstance(CylinderData* data, agx::Index index);
211  CylinderInstance(agxData::EntityStorage *storage, agx::Index index);
212  CylinderInstance(const agxData::EntityInstance& other);
213  CylinderInstance(const agxData::EntityPtr& ptr);
214 
215  CylinderData* getData();
216  const CylinderData* getData() const;
217 
218  public:
220  agx::Real& height();
222  agx::Real const& height() const;
223 
225  agx::Real& radius();
227  agx::Real const& radius() const;
228 
229  };
231 
232 
233 
236 
237 
238 
240  /* Implementation */
241  //-----------------------------------------------------------------------------------------------------
242  //-----------------------------------------------------------------------------------------------------
243  inline CylinderInstance agx::Physics::Geometry::CylinderData::operator[] (size_t index) { return CylinderInstance(this, (agx::Index)index); }
244  //-----------------------------------------------------------------------------------------------------
248  {
250  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
251  EntityPtr::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
252  }
253 
255  {
256  agxAssertN(!instance || instance.isInstanceOf(CylinderModel::instance()),
257  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
258  EntityPtr::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
259  }
260 
262  {
265  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
266  EntityPtr::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
267  return *this;
268  }
269 
271  {
273  agxAssertN(!instance || instance.isInstanceOf(CylinderModel::instance()),
274  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
275  EntityPtr::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
276  return *this;
277  }
278 
279  inline CylinderInstance CylinderPtr::instance() { return agxData::EntityPtr::instance(); }
280  inline const CylinderInstance CylinderPtr::instance() const { return agxData::EntityPtr::instance(); }
281  AGX_FORCE_INLINE CylinderSemantics* CylinderPtr::operator->() { return (CylinderSemantics* )this; }
282  AGX_FORCE_INLINE const CylinderSemantics* CylinderPtr::operator->() const { return (const CylinderSemantics* )this; }
283  AGX_FORCE_INLINE CylinderData* CylinderPtr::getData() { return static_cast<CylinderData* >(agxData::EntityPtr::getData()); }
284  AGX_FORCE_INLINE const CylinderData* CylinderPtr::getData() const { return static_cast<const CylinderData* >(agxData::EntityPtr::getData()); }
285 
286  AGX_FORCE_INLINE agx::Real& CylinderPtr::height() { verifyIndex(); return getData()->height[calculateIndex()]; }
287  AGX_FORCE_INLINE agx::Real const& CylinderPtr::height() const { verifyIndex(); return getData()->height[calculateIndex()]; }
288 
289  AGX_FORCE_INLINE agx::Real& CylinderPtr::radius() { verifyIndex(); return getData()->radius[calculateIndex()]; }
290  AGX_FORCE_INLINE agx::Real const& CylinderPtr::radius() const { verifyIndex(); return getData()->radius[calculateIndex()]; }
291 
292  //-----------------------------------------------------------------------------------------------------
293  AGX_FORCE_INLINE CylinderInstance::CylinderInstance() {}
294  AGX_FORCE_INLINE CylinderInstance::CylinderInstance(CylinderData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
295  AGX_FORCE_INLINE CylinderInstance::CylinderInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
296  AGX_FORCE_INLINE CylinderInstance::CylinderInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
297  {
299  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
301  }
302 
303  AGX_FORCE_INLINE CylinderInstance::CylinderInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
304  {
306  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
308  }
309 
310 
311  AGX_FORCE_INLINE CylinderData* CylinderInstance::getData() { return static_cast<CylinderData* >(agxData::EntityInstance::getData()); }
312  AGX_FORCE_INLINE const CylinderData* CylinderInstance::getData() const { return static_cast<const CylinderData* >(agxData::EntityInstance::getData()); }
313 
314  AGX_FORCE_INLINE agx::Real& CylinderInstance::height() { verifyIndex(); return getData()->height[getIndex()]; }
315  AGX_FORCE_INLINE agx::Real const& CylinderInstance::height() const { verifyIndex(); return getData()->height[getIndex()]; }
316 
317  AGX_FORCE_INLINE agx::Real& CylinderInstance::radius() { verifyIndex(); return getData()->radius[getIndex()]; }
318  AGX_FORCE_INLINE agx::Real const& CylinderInstance::radius() const { verifyIndex(); return getData()->radius[getIndex()]; }
319 
320  //-----------------------------------------------------------------------------------------------------
321  AGX_FORCE_INLINE CylinderSemantics::CylinderSemantics() {}
322  //-----------------------------------------------------------------------------------------------------
324  }
325  }
326 }
327 
328 AGX_TYPE_BINDING(agx::Physics::Geometry::CylinderPtr, "Physics.Geometry.CylinderPtr")
329 AGX_TYPE_BINDING(agx::Physics::Geometry::CylinderInstance, "Physics.Geometry.CylinderInstance")
330 
331 #ifdef _MSC_VER
332 # pragma warning(pop)
333 #endif
334 
335 #undef AGX_ENTITY_WRAPPER
336 #undef AGX_ENTITY_NAMESPACE
337 #endif
338 
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:75
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:34
AGXPHYSICS_EXPORT CylinderInstance instance()
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agxData::EntityData * getData()
agx::String fullPath() const
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
#define AGXPHYSICS_EXPORT
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:195
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
static agxData::ScalarAttributeT< agx::Real > * heightAttribute
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
Pointer to a entity instance of type Physics.Geometry.Cylinder.
#define AGX_FORCE_INLINE
Definition: Object.h:59
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
AGXPHYSICS_EXPORT CylinderPtr & operator=(const agxData::EntityPtr &ptr)
static agxData::ScalarAttributeT< agx::Real > * radiusAttribute
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXPHYSICS_EXPORT agx::Real & radius()
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
Abstract description of the data attributes for the Physics.Geometry.Cylinder entity.
#define CALLABLE
Definition: Object.h:73
AGXPHYSICS_EXPORT CylinderSemantics * operator->()
bool isInstanceOf(agxData::EntityModel *model) const
AGXPHYSICS_EXPORT agx::Real & height()
static CylinderModel * instance()
agxData::EntityRef< CylinderPtr > CylinderRef
double Real
Definition: Real.h:42
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97