AGX Dynamics  2.37.3.2
ShapeGroupEntity.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_SHAPEGROUP_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_SHAPEGROUP_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/Integer.h>
50 #include <agx/AffineMatrix4x4.h>
51 
52 namespace agx { namespace Physics { namespace Geometry { class ShapePtr; }}}
53 
54 namespace agx
55 {
56  namespace Physics
57  {
58  namespace Geometry
59  {
60 
61  class ShapeGroupModel;
62  class ShapeGroupData;
63  class ShapeGroupPtr;
64  class ShapeGroupInstance;
65  class ShapeGroupSemantics;
66 
67 
69 
74  {
75  public:
77 
78  ShapeGroupModel(const agx::String& name = "ShapeGroup");
79 
81  static ShapeGroupModel* instance();
82 
84  static ShapeGroupPtr createInstance();
85 
87  static agxData::EntityStorage* defaultStorage();
88 
90  virtual void shutdownCleanup() override;
91 
92 
93 
94  /* Attributes */
98 
99  protected:
100  virtual ~ShapeGroupModel();
101  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
102  virtual void configure(agx::TiXmlElement* eEntity) override;
103  virtual void initAttributeAccessors() override;
104  virtual void construct(agxData::EntityPtr instance) override;
105  void construct(agx::Physics::Geometry::ShapeGroupPtr shapeGroup);
106  };
107 
108 
110  #ifndef AGX_PHYSICS_GEOMETRY_SHAPEGROUP_DATA_SET_OVERRIDE
111  #define AGX_PHYSICS_GEOMETRY_SHAPEGROUP_DATA_SET
112  class AGXPHYSICS_EXPORT ShapeGroupData : public agx::Physics::Geometry::ShapeData
113  {
114  public:
115  ShapeGroupInstance operator[] (size_t index);
116 
117  public:
122 
123  public:
124  typedef agx::UInt tagType;
125  typedef agx::Vector< agx::Physics::Geometry::ShapePtr > childShapesType;
126  typedef agx::Vector< agx::AffineMatrix4x4 > childTransformsType;
127 
128  public:
129  ShapeGroupData(agxData::EntityStorage* storage);
130  ShapeGroupData();
131 
132  protected:
133  virtual ~ShapeGroupData() {}
134  virtual void setNumElements(agx::Index numElements) override;
135 
136  private:
137  ShapeGroupData& operator= (const ShapeGroupData&) { return *this; }
138 
139  };
140  #endif
142 
143 
145  class AGXPHYSICS_EXPORT ShapeGroupSemantics : public agx::Physics::Geometry::ShapeSemantics
146  {
147  public:
148 
149  // Automatic getters
150  agx::UInt const& getTag() const;
151  agx::Vector< agx::Physics::Geometry::ShapePtr > const& getChildShapes() const;
152  agx::Vector< agx::AffineMatrix4x4 > const& getChildTransforms() const;
153 
154  // Semantics defined by explicit kernels
155 
156  // Automatic setters
157  void setTag(agx::UInt const& value);
158  void setChildShapes(agx::Vector< agx::Physics::Geometry::ShapePtr > const& value);
159  void setChildTransforms(agx::Vector< agx::AffineMatrix4x4 > const& value);
160 
161 
162  protected:
163  friend class ShapeGroupPtr;
164  friend class ShapeGroupInstance;
165  ShapeGroupSemantics();
166  };
168 
169 
170 
173  class CALLABLE ShapeGroupPtr : public agx::Physics::Geometry::ShapePtr
174  {
175  public:
177  typedef ShapeGroupData DataType;
178  typedef ShapeGroupInstance InstanceType;
179 
180  public:
185  AGXPHYSICS_EXPORT ShapeGroupPtr& operator= (const agxData::EntityPtr& ptr);
186  AGXPHYSICS_EXPORT ShapeGroupPtr& operator= (const agxData::EntityInstance& instance);
187  AGXPHYSICS_EXPORT ShapeGroupInstance instance();
188  AGXPHYSICS_EXPORT const ShapeGroupInstance instance() const;
189 
190  AGXPHYSICS_EXPORT ShapeGroupSemantics* operator->();
191  AGXPHYSICS_EXPORT const ShapeGroupSemantics* operator->() const;
192 
193  ShapeGroupData* getData();
194  const ShapeGroupData* getData() const;
195 
196 
200  AGXPHYSICS_EXPORT agx::UInt const& tag() const;
201 
206 
210  AGXPHYSICS_EXPORT agx::Vector< agx::AffineMatrix4x4 > const& childTransforms() const;
211 
212  };
213 
214  // Entity is Referenced
216 
217 
219  class AGXPHYSICS_EXPORT ShapeGroupInstance : public agx::Physics::Geometry::ShapeInstance
220  {
221  public:
222  ShapeGroupInstance();
223  ShapeGroupInstance(ShapeGroupData* data, agx::Index index);
224  ShapeGroupInstance(agxData::EntityStorage *storage, agx::Index index);
225  ShapeGroupInstance(const agxData::EntityInstance& other);
226  ShapeGroupInstance(const agxData::EntityPtr& ptr);
227 
228  ShapeGroupData* getData();
229  const ShapeGroupData* getData() const;
230 
231  public:
233  agx::UInt& tag();
235  agx::UInt const& tag() const;
236 
240  agx::Vector< agx::Physics::Geometry::ShapePtr > const& childShapes() const;
241 
243  agx::Vector< agx::AffineMatrix4x4 >& childTransforms();
245  agx::Vector< agx::AffineMatrix4x4 > const& childTransforms() const;
246 
247  };
249 
250 
251 
254 
255 
256 
258  /* Implementation */
259  //-----------------------------------------------------------------------------------------------------
260  //-----------------------------------------------------------------------------------------------------
261  inline ShapeGroupInstance agx::Physics::Geometry::ShapeGroupData::operator[] (size_t index) { return ShapeGroupInstance(this, (agx::Index)index); }
262  //-----------------------------------------------------------------------------------------------------
266  {
268  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
270  }
271 
273  {
274  agxAssertN(!instance || instance.isInstanceOf(ShapeGroupModel::instance()),
275  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
277  }
278 
280  {
283  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
285  return *this;
286  }
287 
289  {
291  agxAssertN(!instance || instance.isInstanceOf(ShapeGroupModel::instance()),
292  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
294  return *this;
295  }
296 
297  inline ShapeGroupInstance ShapeGroupPtr::instance() { return agxData::EntityPtr::instance(); }
298  inline const ShapeGroupInstance ShapeGroupPtr::instance() const { return agxData::EntityPtr::instance(); }
299  AGX_FORCE_INLINE ShapeGroupSemantics* ShapeGroupPtr::operator->() { return (ShapeGroupSemantics* )this; }
300  AGX_FORCE_INLINE const ShapeGroupSemantics* ShapeGroupPtr::operator->() const { return (const ShapeGroupSemantics* )this; }
301  AGX_FORCE_INLINE ShapeGroupData* ShapeGroupPtr::getData() { return static_cast<ShapeGroupData* >(agxData::EntityPtr::getData()); }
302  AGX_FORCE_INLINE const ShapeGroupData* ShapeGroupPtr::getData() const { return static_cast<const ShapeGroupData* >(agxData::EntityPtr::getData()); }
303 
304  AGX_FORCE_INLINE agx::UInt& ShapeGroupPtr::tag() { verifyIndex(); return getData()->tag[calculateIndex()]; }
305  AGX_FORCE_INLINE agx::UInt const& ShapeGroupPtr::tag() const { verifyIndex(); return getData()->tag[calculateIndex()]; }
306 
307  AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr >& ShapeGroupPtr::childShapes() { verifyIndex(); return getData()->childShapes[calculateIndex()]; }
308  AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr > const& ShapeGroupPtr::childShapes() const { verifyIndex(); return getData()->childShapes[calculateIndex()]; }
309 
310  AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 >& ShapeGroupPtr::childTransforms() { verifyIndex(); return getData()->childTransforms[calculateIndex()]; }
311  AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 > const& ShapeGroupPtr::childTransforms() const { verifyIndex(); return getData()->childTransforms[calculateIndex()]; }
312 
313  //-----------------------------------------------------------------------------------------------------
314  AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance() {}
315  AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(ShapeGroupData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
316  AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
317  AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
318  {
320  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
322  }
323 
324  AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
325  {
327  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
329  }
330 
331 
332  AGX_FORCE_INLINE ShapeGroupData* ShapeGroupInstance::getData() { return static_cast<ShapeGroupData* >(agxData::EntityInstance::getData()); }
333  AGX_FORCE_INLINE const ShapeGroupData* ShapeGroupInstance::getData() const { return static_cast<const ShapeGroupData* >(agxData::EntityInstance::getData()); }
334 
335  AGX_FORCE_INLINE agx::UInt& ShapeGroupInstance::tag() { verifyIndex(); return getData()->tag[getIndex()]; }
336  AGX_FORCE_INLINE agx::UInt const& ShapeGroupInstance::tag() const { verifyIndex(); return getData()->tag[getIndex()]; }
337 
338  AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr >& ShapeGroupInstance::childShapes() { verifyIndex(); return getData()->childShapes[getIndex()]; }
339  AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr > const& ShapeGroupInstance::childShapes() const { verifyIndex(); return getData()->childShapes[getIndex()]; }
340 
341  AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 >& ShapeGroupInstance::childTransforms() { verifyIndex(); return getData()->childTransforms[getIndex()]; }
342  AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 > const& ShapeGroupInstance::childTransforms() const { verifyIndex(); return getData()->childTransforms[getIndex()]; }
343 
344  //-----------------------------------------------------------------------------------------------------
345  AGX_FORCE_INLINE ShapeGroupSemantics::ShapeGroupSemantics() {}
346  //-----------------------------------------------------------------------------------------------------
348  }
349  }
350 }
351 
352 AGX_TYPE_BINDING(agx::Physics::Geometry::ShapeGroupPtr, "Physics.Geometry.ShapeGroupPtr")
353 AGX_TYPE_BINDING(agx::Physics::Geometry::ShapeGroupInstance, "Physics.Geometry.ShapeGroupInstance")
354 
355 #ifdef _MSC_VER
356 # pragma warning(pop)
357 #endif
358 
359 #undef AGX_ENTITY_WRAPPER
360 #undef AGX_ENTITY_NAMESPACE
361 #endif
362 
static ShapeGroupModel * instance()
agxData::EntityData * getData()
AGXPHYSICS_EXPORT agx::UInt & tag()
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
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
AGXPHYSICS_EXPORT agx::Vector< agx::Physics::Geometry::ShapePtr > & childShapes()
agxData::EntityRef< ShapeGroupPtr > ShapeGroupRef
Abstract description of the data attributes for the Physics.Geometry.ShapeGroup entity.
#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
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
#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
Templated vector class.
Definition: Vector.h:52
uint32_t UInt
Definition: Integer.h:34
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.
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
AGXPHYSICS_EXPORT ShapeGroupPtr & operator=(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Vector< agx::AffineMatrix4x4 > & childTransforms()
#define CALLABLE
Definition: Object.h:73
static agxData::ScalarAttributeT< agx::UInt > * tagAttribute
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::Vector< agx::AffineMatrix4x4 > > * childTransformsAttribute
static agxData::ScalarAttributeT< agx::Vector< agx::Physics::Geometry::ShapePtr > > * childShapesAttribute
AGXPHYSICS_EXPORT ShapeGroupInstance instance()
AGXPHYSICS_EXPORT ShapeGroupSemantics * operator->()
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
Pointer to a entity instance of type Physics.Geometry.ShapeGroup.