AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
WireShapeEntity.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_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>
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/Vec3.h>
49#include <agx/Integer.h>
50
51
52namespace 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:
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
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 //-----------------------------------------------------------------------------------------------------
262 AGX_FORCE_INLINE WireShapePtr::WireShapePtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::CapsulePtr(storage, id) {}
263 AGX_FORCE_INLINE WireShapePtr::WireShapePtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::CapsulePtr(ptr)
264 {
266 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
267 EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
268 }
269
270 AGX_FORCE_INLINE WireShapePtr::WireShapePtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::CapsulePtr(instance)
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\'",
274 EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
275 }
276
277 AGX_FORCE_INLINE WireShapePtr& WireShapePtr::operator= (const agxData::EntityPtr& ptr)
278 {
280 agxAssertN(!ptr || ptr.isInstanceOf(WireShapeModel::instance()),
281 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
282 EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
283 return *this;
284 }
285
286 AGX_FORCE_INLINE WireShapePtr& WireShapePtr::operator= (const agxData::EntityInstance& instance)
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\'",
291 EntityPtr::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
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\'",
319 EntityInstance::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
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\'",
326 EntityInstance::getModel()->fullPath().c_str(), WireShapeModel::instance()->fullPath().c_str());
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
350AGX_TYPE_BINDING(agx::Physics::Geometry::WireShapePtr, "Physics.Geometry.WireShapePtr")
351AGX_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
#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.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 agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::EntityStorage * defaultStorage()
static WireShapeModel * instance()
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
Pointer to a entity instance of type Physics.Geometry.WireShape.
AGXPHYSICS_EXPORT WireShapePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::UInt32 & wireId()
AGXPHYSICS_EXPORT WireShapePtr(const agxData::EntityPtr &ptr)
const WireShapeData * getData() const
AGXPHYSICS_EXPORT WireShapeInstance instance()
AGXPHYSICS_EXPORT const WireShapeSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint0()
AGXPHYSICS_EXPORT agx::Vec3 const & previousPoint0() const
AGXPHYSICS_EXPORT agx::Vec3 const & previousPoint1() const
AGXPHYSICS_EXPORT const WireShapeInstance instance() const
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint1()
AGXPHYSICS_EXPORT WireShapeSemantics * operator->()
AGXPHYSICS_EXPORT agx::UInt32 const & wireId() const
AGXPHYSICS_EXPORT WireShapePtr(const agxData::EntityInstance &instance)
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< WireShapePtr > WireShapeRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
UInt32 Index
Definition: Integer.h:44