AGX Dynamics  2.37.2.0
WireShapeEntity.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_WIRESHAPE_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_WIRESHAPE_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/Vec3.h>
49 #include <agx/Integer.h>
50 
51 
52 namespace agx
53 {
54  namespace Physics
55  {
56  namespace Geometry
57  {
58 
59  class WireShapeModel;
60  class WireShapeData;
61  class WireShapePtr;
62  class WireShapeInstance;
63  class WireShapeSemantics;
64 
65 
67 
72  {
73  public:
74  typedef WireShapePtr PtrT;
75 
76  WireShapeModel(const agx::String& name = "WireShape");
77 
79  static WireShapeModel* instance();
80 
82  static WireShapePtr createInstance();
83 
85  static agxData::EntityStorage* defaultStorage();
86 
88  virtual void shutdownCleanup() override;
89 
90 
91 
92  /* Attributes */
96 
97  protected:
98  virtual ~WireShapeModel();
99  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
100  virtual void configure(agx::TiXmlElement* eEntity) override;
101  virtual void initAttributeAccessors() override;
102  virtual void construct(agxData::EntityPtr instance) override;
103  void construct(agx::Physics::Geometry::WireShapePtr wireShape);
104  };
105 
106 
108  #ifndef AGX_PHYSICS_GEOMETRY_WIRESHAPE_DATA_SET_OVERRIDE
109  #define AGX_PHYSICS_GEOMETRY_WIRESHAPE_DATA_SET
110  class AGXPHYSICS_EXPORT WireShapeData : public agx::Physics::Geometry::CapsuleData
111  {
112  public:
113  WireShapeInstance operator[] (size_t index);
114 
115  public:
117  agxData::Array< agx::Vec3 > previousPoint0;
118  agxData::Array< agx::Vec3 > previousPoint1;
120 
121  public:
122  typedef agx::Vec3 previousPoint0Type;
123  typedef agx::Vec3 previousPoint1Type;
124  typedef agx::UInt32 wireIdType;
125 
126  public:
127  WireShapeData(agxData::EntityStorage* storage);
128  WireShapeData();
129 
130  protected:
131  virtual ~WireShapeData() {}
132  virtual void setNumElements(agx::Index numElements) override;
133 
134  private:
135  WireShapeData& operator= (const WireShapeData&) { return *this; }
136 
137  };
138  #endif
140 
141 
143  class AGXPHYSICS_EXPORT WireShapeSemantics : public agx::Physics::Geometry::CapsuleSemantics
144  {
145  public:
146 
147  // Automatic getters
148  agx::Vec3 const& getPreviousPoint0() const;
149  agx::Vec3 const& getPreviousPoint1() const;
150  agx::UInt32 const& getWireId() const;
151 
152  // Semantics defined by explicit kernels
153 
154  // Automatic setters
155  void setPreviousPoint0(agx::Vec3 const& value);
156  void setPreviousPoint1(agx::Vec3 const& value);
157  void setWireId(agx::UInt32 const& value);
158 
159 
160  protected:
161  friend class WireShapePtr;
162  friend class WireShapeInstance;
163  WireShapeSemantics();
164  };
166 
167 
168 
171  class CALLABLE WireShapePtr : public agx::Physics::Geometry::CapsulePtr
172  {
173  public:
175  typedef WireShapeData DataType;
176  typedef WireShapeInstance InstanceType;
177 
178  public:
183  AGXPHYSICS_EXPORT WireShapePtr& operator= (const agxData::EntityPtr& ptr);
184  AGXPHYSICS_EXPORT WireShapePtr& operator= (const agxData::EntityInstance& instance);
185  AGXPHYSICS_EXPORT WireShapeInstance instance();
186  AGXPHYSICS_EXPORT const WireShapeInstance instance() const;
187 
188  AGXPHYSICS_EXPORT WireShapeSemantics* operator->();
189  AGXPHYSICS_EXPORT const WireShapeSemantics* operator->() const;
190 
191  WireShapeData* getData();
192  const WireShapeData* getData() const;
193 
194 
196  AGXPHYSICS_EXPORT agx::Vec3& previousPoint0();
198  AGXPHYSICS_EXPORT agx::Vec3 const& previousPoint0() const;
199 
201  AGXPHYSICS_EXPORT agx::Vec3& previousPoint1();
203  AGXPHYSICS_EXPORT agx::Vec3 const& previousPoint1() const;
204 
206  AGXPHYSICS_EXPORT agx::UInt32& wireId();
208  AGXPHYSICS_EXPORT agx::UInt32 const& wireId() const;
209 
210  };
211 
212  // Entity is Referenced
214 
215 
217  class AGXPHYSICS_EXPORT WireShapeInstance : public agx::Physics::Geometry::CapsuleInstance
218  {
219  public:
220  WireShapeInstance();
221  WireShapeInstance(WireShapeData* data, agx::Index index);
222  WireShapeInstance(agxData::EntityStorage *storage, agx::Index index);
223  WireShapeInstance(const agxData::EntityInstance& other);
224  WireShapeInstance(const agxData::EntityPtr& ptr);
225 
226  WireShapeData* getData();
227  const WireShapeData* getData() const;
228 
229  public:
231  agx::Vec3& previousPoint0();
233  agx::Vec3 const& previousPoint0() const;
234 
236  agx::Vec3& previousPoint1();
238  agx::Vec3 const& previousPoint1() const;
239 
241  agx::UInt32& wireId();
243  agx::UInt32 const& wireId() const;
244 
245  };
247 
248 
249 
252 
253 
254 
256  /* Implementation */
257  //-----------------------------------------------------------------------------------------------------
258  //-----------------------------------------------------------------------------------------------------
259  inline WireShapeInstance agx::Physics::Geometry::WireShapeData::operator[] (size_t index) { return WireShapeInstance(this, (agx::Index)index); }
260  //-----------------------------------------------------------------------------------------------------
264  {
266  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
268  }
269 
271  {
272  agxAssertN(!instance || instance.isInstanceOf(WireShapeModel::instance()),
273  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
275  }
276 
278  {
281  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
283  return *this;
284  }
285 
287  {
289  agxAssertN(!instance || instance.isInstanceOf(WireShapeModel::instance()),
290  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
292  return *this;
293  }
294 
295  inline WireShapeInstance WireShapePtr::instance() { return agxData::EntityPtr::instance(); }
296  inline const WireShapeInstance WireShapePtr::instance() const { return agxData::EntityPtr::instance(); }
297  AGX_FORCE_INLINE WireShapeSemantics* WireShapePtr::operator->() { return (WireShapeSemantics* )this; }
298  AGX_FORCE_INLINE const WireShapeSemantics* WireShapePtr::operator->() const { return (const WireShapeSemantics* )this; }
299  AGX_FORCE_INLINE WireShapeData* WireShapePtr::getData() { return static_cast<WireShapeData* >(agxData::EntityPtr::getData()); }
300  AGX_FORCE_INLINE const WireShapeData* WireShapePtr::getData() const { return static_cast<const WireShapeData* >(agxData::EntityPtr::getData()); }
301 
302  AGX_FORCE_INLINE agx::Vec3& WireShapePtr::previousPoint0() { verifyIndex(); return getData()->previousPoint0[calculateIndex()]; }
303  AGX_FORCE_INLINE agx::Vec3 const& WireShapePtr::previousPoint0() const { verifyIndex(); return getData()->previousPoint0[calculateIndex()]; }
304 
305  AGX_FORCE_INLINE agx::Vec3& WireShapePtr::previousPoint1() { verifyIndex(); return getData()->previousPoint1[calculateIndex()]; }
306  AGX_FORCE_INLINE agx::Vec3 const& WireShapePtr::previousPoint1() const { verifyIndex(); return getData()->previousPoint1[calculateIndex()]; }
307 
308  AGX_FORCE_INLINE agx::UInt32& WireShapePtr::wireId() { verifyIndex(); return getData()->wireId[calculateIndex()]; }
309  AGX_FORCE_INLINE agx::UInt32 const& WireShapePtr::wireId() const { verifyIndex(); return getData()->wireId[calculateIndex()]; }
310 
311  //-----------------------------------------------------------------------------------------------------
312  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance() {}
313  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(WireShapeData* data, agx::Index index) : agx::Physics::Geometry::CapsuleInstance(data, index) {}
314  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::CapsuleInstance(storage, index) {}
315  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::CapsuleInstance(other)
316  {
318  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
320  }
321 
322  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::CapsuleInstance(ptr)
323  {
325  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
327  }
328 
329 
330  AGX_FORCE_INLINE WireShapeData* WireShapeInstance::getData() { return static_cast<WireShapeData* >(agxData::EntityInstance::getData()); }
331  AGX_FORCE_INLINE const WireShapeData* WireShapeInstance::getData() const { return static_cast<const WireShapeData* >(agxData::EntityInstance::getData()); }
332 
333  AGX_FORCE_INLINE agx::Vec3& WireShapeInstance::previousPoint0() { verifyIndex(); return getData()->previousPoint0[getIndex()]; }
334  AGX_FORCE_INLINE agx::Vec3 const& WireShapeInstance::previousPoint0() const { verifyIndex(); return getData()->previousPoint0[getIndex()]; }
335 
336  AGX_FORCE_INLINE agx::Vec3& WireShapeInstance::previousPoint1() { verifyIndex(); return getData()->previousPoint1[getIndex()]; }
337  AGX_FORCE_INLINE agx::Vec3 const& WireShapeInstance::previousPoint1() const { verifyIndex(); return getData()->previousPoint1[getIndex()]; }
338 
339  AGX_FORCE_INLINE agx::UInt32& WireShapeInstance::wireId() { verifyIndex(); return getData()->wireId[getIndex()]; }
340  AGX_FORCE_INLINE agx::UInt32 const& WireShapeInstance::wireId() const { verifyIndex(); return getData()->wireId[getIndex()]; }
341 
342  //-----------------------------------------------------------------------------------------------------
343  AGX_FORCE_INLINE WireShapeSemantics::WireShapeSemantics() {}
344  //-----------------------------------------------------------------------------------------------------
346  }
347  }
348 }
349 
350 AGX_TYPE_BINDING(agx::Physics::Geometry::WireShapePtr, "Physics.Geometry.WireShapePtr")
351 AGX_TYPE_BINDING(agx::Physics::Geometry::WireShapeInstance, "Physics.Geometry.WireShapeInstance")
352 
353 #ifdef _MSC_VER
354 # pragma warning(pop)
355 #endif
356 
357 #undef AGX_ENTITY_WRAPPER
358 #undef AGX_ENTITY_NAMESPACE
359 #endif
360 
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint1()
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:34
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
AGXPHYSICS_EXPORT agx::UInt32 & wireId()
#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
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
static WireShapeModel * instance()
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
AGXPHYSICS_EXPORT WireShapePtr & operator=(const agxData::EntityPtr &ptr)
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
Pointer to a entity instance of type Physics.Geometry.Capsule.
#define CALLABLE
Definition: Object.h:73
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint0()
AGXPHYSICS_EXPORT WireShapeSemantics * operator->()
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::Vec3 > * previousPoint1Attribute
static agxData::ScalarAttributeT< agx::UInt32 > * wireIdAttribute
Abstract description of the data attributes for the Physics.Geometry.Capsule entity.
Definition: CapsuleEntity.h:70
static agxData::ScalarAttributeT< agx::Vec3 > * previousPoint0Attribute
Abstract description of the data attributes for the Physics.Geometry.WireShape entity.
Pointer to a entity instance of type Physics.Geometry.WireShape.
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
agxData::EntityRef< WireShapePtr > WireShapeRef
AGXPHYSICS_EXPORT WireShapeInstance instance()