AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
CylinderEntity.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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>
41#include <agxData/EntityRef.h>
42#include <agxData/EntityPtr.h>
44#include <agx/Integer.h>
45#include <agx/Real.h>
46#include <agx/macros.h>
48#include <agx/Real.h>
49
50
51namespace 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:
74
75 CylinderModel(const agx::String& name = "Cylinder");
76
79
82
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;
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:
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
193
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 //-----------------------------------------------------------------------------------------------------
246 AGX_FORCE_INLINE CylinderPtr::CylinderPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::ShapePtr(storage, id) {}
247 AGX_FORCE_INLINE CylinderPtr::CylinderPtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapePtr(ptr)
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
254 AGX_FORCE_INLINE CylinderPtr::CylinderPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::ShapePtr(instance)
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
261 AGX_FORCE_INLINE CylinderPtr& CylinderPtr::operator= (const agxData::EntityPtr& ptr)
262 {
264 agxAssertN(!ptr || ptr.isInstanceOf(CylinderModel::instance()),
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
270 AGX_FORCE_INLINE CylinderPtr& CylinderPtr::operator= (const agxData::EntityInstance& instance)
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\'",
300 EntityInstance::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
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\'",
307 EntityInstance::getModel()->fullPath().c_str(), CylinderModel::instance()->fullPath().c_str());
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
328AGX_TYPE_BINDING(agx::Physics::Geometry::CylinderPtr, "Physics.Geometry.CylinderPtr")
329AGX_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
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
#define AGXPHYSICS_EXPORT
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Entity instance provides access to a single instance in an EntityStorage.
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:35
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
Abstract description of the data attributes for the Physics.Geometry.Cylinder entity.
static CylinderPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void initAttributeAccessors() override
void construct(agx::Physics::Geometry::CylinderPtr cylinder)
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Real > * radiusAttribute
static CylinderModel * instance()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::Real > * heightAttribute
CylinderModel(const agx::String &name="Cylinder")
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::EntityStorage * defaultStorage()
Pointer to a entity instance of type Physics.Geometry.Cylinder.
const CylinderData * getData() const
AGXPHYSICS_EXPORT const CylinderSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Real const & height() const
AGXPHYSICS_EXPORT agx::Real & height()
AGXPHYSICS_EXPORT CylinderPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT CylinderSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real & radius()
AGXPHYSICS_EXPORT agx::Real const & radius() const
AGXPHYSICS_EXPORT CylinderPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const CylinderInstance instance() const
AGXPHYSICS_EXPORT CylinderInstance instance()
AGXPHYSICS_EXPORT CylinderPtr(const agxData::EntityPtr &ptr)
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:76
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:196
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define agxAssertN(expr, format,...)
Definition: debug.h:145
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< CylinderPtr > CylinderRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41
UInt32 Index
Definition: Integer.h:44