AGX Dynamics  2.35.0.1
WireShapeEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
80 
83 
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;
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:
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 
199 
204 
209 
211  // Only used by tolua!
212  #ifdef AGX_GENERATED_TOLUA_WRAPPER
213  inline agx::Vec3 const& getPreviousPoint0() const { return (*this)->getPreviousPoint0(); }
214  inline agx::Vec3 const& getPreviousPoint1() const { return (*this)->getPreviousPoint1(); }
215  inline agx::UInt32 const& getWireId() const { return (*this)->getWireId(); }
216 
217 
218  inline void setPreviousPoint0(agx::Vec3 const& value) { (*this)->setPreviousPoint0(value); }
219  inline void setPreviousPoint1(agx::Vec3 const& value) { (*this)->setPreviousPoint1(value); }
220  inline void setWireId(agx::UInt32 const& value) { (*this)->setWireId(value); }
221  #endif
223 
224  };
225 
226  // Entity is Referenced
228 
229 
231  class AGXPHYSICS_EXPORT WireShapeInstance : public agx::Physics::Geometry::CapsuleInstance
232  {
233  public:
234  WireShapeInstance();
235  WireShapeInstance(WireShapeData* data, agx::Index index);
236  WireShapeInstance(agxData::EntityStorage *storage, agx::Index index);
237  WireShapeInstance(const agxData::EntityInstance& other);
238  WireShapeInstance(const agxData::EntityPtr& ptr);
239 
240  WireShapeData* getData();
241  const WireShapeData* getData() const;
242 
243  public:
245  agx::Vec3& previousPoint0();
247  agx::Vec3 const& previousPoint0() const;
248 
250  agx::Vec3& previousPoint1();
252  agx::Vec3 const& previousPoint1() const;
253 
255  agx::UInt32& wireId();
257  agx::UInt32 const& wireId() const;
258 
259  };
261 
262 
263 
266 
267 
268 
270  /* Implementation */
271  //-----------------------------------------------------------------------------------------------------
272  //-----------------------------------------------------------------------------------------------------
273  inline WireShapeInstance agx::Physics::Geometry::WireShapeData::operator[] (size_t index) { return WireShapeInstance(this, (agx::Index)index); }
274  //-----------------------------------------------------------------------------------------------------
276  AGX_FORCE_INLINE WireShapePtr::WireShapePtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::CapsulePtr(storage, id) {}
277  AGX_FORCE_INLINE WireShapePtr::WireShapePtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::CapsulePtr(ptr)
278  {
280  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
282  }
283 
284  AGX_FORCE_INLINE WireShapePtr::WireShapePtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::CapsulePtr(instance)
285  {
286  agxAssertN(!instance || instance.isInstanceOf(WireShapeModel::instance()),
287  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
289  }
290 
291  AGX_FORCE_INLINE WireShapePtr& WireShapePtr::operator= (const agxData::EntityPtr& ptr)
292  {
294  agxAssertN(!ptr || ptr.isInstanceOf(WireShapeModel::instance()),
295  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
296  EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
297  return *this;
298  }
299 
300  AGX_FORCE_INLINE WireShapePtr& WireShapePtr::operator= (const agxData::EntityInstance& instance)
301  {
303  agxAssertN(!instance || instance.isInstanceOf(WireShapeModel::instance()),
304  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
305  EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
306  return *this;
307  }
308 
309  inline WireShapeInstance WireShapePtr::instance() { return agxData::EntityPtr::instance(); }
310  inline const WireShapeInstance WireShapePtr::instance() const { return agxData::EntityPtr::instance(); }
311  AGX_FORCE_INLINE WireShapeSemantics* WireShapePtr::operator->() { return (WireShapeSemantics* )this; }
312  AGX_FORCE_INLINE const WireShapeSemantics* WireShapePtr::operator->() const { return (const WireShapeSemantics* )this; }
313  AGX_FORCE_INLINE WireShapeData* WireShapePtr::getData() { return static_cast<WireShapeData* >(agxData::EntityPtr::getData()); }
314  AGX_FORCE_INLINE const WireShapeData* WireShapePtr::getData() const { return static_cast<const WireShapeData* >(agxData::EntityPtr::getData()); }
315 
316  AGX_FORCE_INLINE agx::Vec3& WireShapePtr::previousPoint0() { verifyIndex(); return getData()->previousPoint0[calculateIndex()]; }
317  AGX_FORCE_INLINE agx::Vec3 const& WireShapePtr::previousPoint0() const { verifyIndex(); return getData()->previousPoint0[calculateIndex()]; }
318 
319  AGX_FORCE_INLINE agx::Vec3& WireShapePtr::previousPoint1() { verifyIndex(); return getData()->previousPoint1[calculateIndex()]; }
320  AGX_FORCE_INLINE agx::Vec3 const& WireShapePtr::previousPoint1() const { verifyIndex(); return getData()->previousPoint1[calculateIndex()]; }
321 
322  AGX_FORCE_INLINE agx::UInt32& WireShapePtr::wireId() { verifyIndex(); return getData()->wireId[calculateIndex()]; }
323  AGX_FORCE_INLINE agx::UInt32 const& WireShapePtr::wireId() const { verifyIndex(); return getData()->wireId[calculateIndex()]; }
324 
325  //-----------------------------------------------------------------------------------------------------
326  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance() {}
327  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(WireShapeData* data, agx::Index index) : agx::Physics::Geometry::CapsuleInstance(data, index) {}
328  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::CapsuleInstance(storage, index) {}
329  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::CapsuleInstance(other)
330  {
332  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
334  }
335 
336  AGX_FORCE_INLINE WireShapeInstance::WireShapeInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::CapsuleInstance(ptr)
337  {
339  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
341  }
342 
343 
344  AGX_FORCE_INLINE WireShapeData* WireShapeInstance::getData() { return static_cast<WireShapeData* >(agxData::EntityInstance::getData()); }
345  AGX_FORCE_INLINE const WireShapeData* WireShapeInstance::getData() const { return static_cast<const WireShapeData* >(agxData::EntityInstance::getData()); }
346 
347  AGX_FORCE_INLINE agx::Vec3& WireShapeInstance::previousPoint0() { verifyIndex(); return getData()->previousPoint0[getIndex()]; }
348  AGX_FORCE_INLINE agx::Vec3 const& WireShapeInstance::previousPoint0() const { verifyIndex(); return getData()->previousPoint0[getIndex()]; }
349 
350  AGX_FORCE_INLINE agx::Vec3& WireShapeInstance::previousPoint1() { verifyIndex(); return getData()->previousPoint1[getIndex()]; }
351  AGX_FORCE_INLINE agx::Vec3 const& WireShapeInstance::previousPoint1() const { verifyIndex(); return getData()->previousPoint1[getIndex()]; }
352 
353  AGX_FORCE_INLINE agx::UInt32& WireShapeInstance::wireId() { verifyIndex(); return getData()->wireId[getIndex()]; }
354  AGX_FORCE_INLINE agx::UInt32 const& WireShapeInstance::wireId() const { verifyIndex(); return getData()->wireId[getIndex()]; }
355 
356  //-----------------------------------------------------------------------------------------------------
357  AGX_FORCE_INLINE WireShapeSemantics::WireShapeSemantics() {}
358  //-----------------------------------------------------------------------------------------------------
360  }
361  }
362 }
363 
364 AGX_TYPE_BINDING(agx::Physics::Geometry::WireShapePtr, "Physics.Geometry.WireShapePtr")
365 AGX_TYPE_BINDING(agx::Physics::Geometry::WireShapeInstance, "Physics.Geometry.WireShapeInstance")
366 
367 #ifdef _MSC_VER
368 # pragma warning(pop)
369 #endif
370 
371 #undef AGX_ENTITY_WRAPPER
372 #undef AGX_ENTITY_NAMESPACE
373 #endif
374 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
EntityPtr & operator=(const EntityPtr &other)=default
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.Capsule entity.
Definition: CapsuleEntity.h:71
Pointer to a entity instance of type Physics.Geometry.Capsule.
Abstract description of the data attributes for the Physics.Geometry.WireShape entity.
WireShapeModel(const agx::String &name="WireShape")
virtual void initAttributeAccessors() override
static WireShapePtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::UInt32 > * wireIdAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * previousPoint0Attribute
virtual void construct(agxData::EntityPtr instance) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
void construct(agx::Physics::Geometry::WireShapePtr wireShape)
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::Vec3 > * previousPoint1Attribute
static agxData::EntityStorage * defaultStorage()
static WireShapeModel * instance()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
Pointer to a entity instance of type Physics.Geometry.WireShape.
AGXPHYSICS_EXPORT WireShapePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT WireShapeSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint0()
AGXPHYSICS_EXPORT WireShapePtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT const WireShapeSemantics * operator->() const
AGXPHYSICS_EXPORT WireShapeInstance instance()
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint1()
AGXPHYSICS_EXPORT agx::Vec3 const & previousPoint0() const
AGXPHYSICS_EXPORT const WireShapeInstance instance() const
AGXPHYSICS_EXPORT agx::UInt32 & wireId()
const WireShapeData * getData() const
AGXPHYSICS_EXPORT agx::UInt32 const & wireId() const
AGXPHYSICS_EXPORT WireShapePtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Vec3 const & previousPoint1() const
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:97
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< WireShapePtr > WireShapeRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52