AGX Dynamics  2.37.3.2
LineEntity.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_LINE_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_LINE_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/Line.h>
49 
50 
51 namespace agx
52 {
53  namespace Physics
54  {
55  namespace Geometry
56  {
57 
58  class LineModel;
59  class LineData;
60  class LinePtr;
61  class LineInstance;
62  class LineSemantics;
63 
64 
66 
71  {
72  public:
73  typedef LinePtr PtrT;
74 
75  LineModel(const agx::String& name = "Line");
76 
78  static LineModel* instance();
79 
81  static LinePtr createInstance();
82 
84  static agxData::EntityStorage* defaultStorage();
85 
87  virtual void shutdownCleanup() override;
88 
89 
90 
91  /* Attributes */
93 
94  protected:
95  virtual ~LineModel();
96  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
97  virtual void configure(agx::TiXmlElement* eEntity) override;
98  virtual void initAttributeAccessors() override;
99  virtual void construct(agxData::EntityPtr instance) override;
100  void construct(agx::Physics::Geometry::LinePtr line);
101  };
102 
103 
105  #ifndef AGX_PHYSICS_GEOMETRY_LINE_DATA_SET_OVERRIDE
106  #define AGX_PHYSICS_GEOMETRY_LINE_DATA_SET
107  class AGXPHYSICS_EXPORT LineData : public agx::Physics::Geometry::ShapeData
108  {
109  public:
110  LineInstance operator[] (size_t index);
111 
112  public:
113  agxData::Array< LinePtr >& instance;
115 
116  public:
117  typedef agx::Line lineType;
118 
119  public:
120  LineData(agxData::EntityStorage* storage);
121  LineData();
122 
123  protected:
124  virtual ~LineData() {}
125  virtual void setNumElements(agx::Index numElements) override;
126 
127  private:
128  LineData& operator= (const LineData&) { return *this; }
129 
130  };
131  #endif
133 
134 
136  class AGXPHYSICS_EXPORT LineSemantics : public agx::Physics::Geometry::ShapeSemantics
137  {
138  public:
139 
140  // Automatic getters
141  agx::Line const& getLine() const;
142 
143  // Semantics defined by explicit kernels
144 
145  // Automatic setters
146  void setLine(agx::Line const& value);
147 
148 
149  protected:
150  friend class LinePtr;
151  friend class LineInstance;
152  LineSemantics();
153  };
155 
156 
157 
160  class CALLABLE LinePtr : public agx::Physics::Geometry::ShapePtr
161  {
162  public:
164  typedef LineData DataType;
165  typedef LineInstance InstanceType;
166 
167  public:
172  AGXPHYSICS_EXPORT LinePtr& operator= (const agxData::EntityPtr& ptr);
173  AGXPHYSICS_EXPORT LinePtr& operator= (const agxData::EntityInstance& instance);
174  AGXPHYSICS_EXPORT LineInstance instance();
175  AGXPHYSICS_EXPORT const LineInstance instance() const;
176 
177  AGXPHYSICS_EXPORT LineSemantics* operator->();
178  AGXPHYSICS_EXPORT const LineSemantics* operator->() const;
179 
180  LineData* getData();
181  const LineData* getData() const;
182 
183 
187  AGXPHYSICS_EXPORT agx::Line const& line() const;
188 
189  };
190 
191  // Entity is Referenced
193 
194 
196  class AGXPHYSICS_EXPORT LineInstance : public agx::Physics::Geometry::ShapeInstance
197  {
198  public:
199  LineInstance();
200  LineInstance(LineData* data, agx::Index index);
201  LineInstance(agxData::EntityStorage *storage, agx::Index index);
202  LineInstance(const agxData::EntityInstance& other);
203  LineInstance(const agxData::EntityPtr& ptr);
204 
205  LineData* getData();
206  const LineData* getData() const;
207 
208  public:
210  agx::Line& line();
212  agx::Line const& line() const;
213 
214  };
216 
217 
218 
220  typedef agxData::Array<LinePtr> LinePtrArray;
221 
222 
223 
225  /* Implementation */
226  //-----------------------------------------------------------------------------------------------------
227  //-----------------------------------------------------------------------------------------------------
228  inline LineInstance agx::Physics::Geometry::LineData::operator[] (size_t index) { return LineInstance(this, (agx::Index)index); }
229  //-----------------------------------------------------------------------------------------------------
233  {
235  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
236  EntityPtr::getModel()->fullPath().c_str(), LineModel::instance()->fullPath().c_str());
237  }
238 
240  {
241  agxAssertN(!instance || instance.isInstanceOf(LineModel::instance()),
242  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
243  EntityPtr::getModel()->fullPath().c_str(), LineModel::instance()->fullPath().c_str());
244  }
245 
247  {
250  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
251  EntityPtr::getModel()->fullPath().c_str(), LineModel::instance()->fullPath().c_str());
252  return *this;
253  }
254 
256  {
258  agxAssertN(!instance || instance.isInstanceOf(LineModel::instance()),
259  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
260  EntityPtr::getModel()->fullPath().c_str(), LineModel::instance()->fullPath().c_str());
261  return *this;
262  }
263 
264  inline LineInstance LinePtr::instance() { return agxData::EntityPtr::instance(); }
265  inline const LineInstance LinePtr::instance() const { return agxData::EntityPtr::instance(); }
266  AGX_FORCE_INLINE LineSemantics* LinePtr::operator->() { return (LineSemantics* )this; }
267  AGX_FORCE_INLINE const LineSemantics* LinePtr::operator->() const { return (const LineSemantics* )this; }
268  AGX_FORCE_INLINE LineData* LinePtr::getData() { return static_cast<LineData* >(agxData::EntityPtr::getData()); }
269  AGX_FORCE_INLINE const LineData* LinePtr::getData() const { return static_cast<const LineData* >(agxData::EntityPtr::getData()); }
270 
271  AGX_FORCE_INLINE agx::Line& LinePtr::line() { verifyIndex(); return getData()->line[calculateIndex()]; }
272  AGX_FORCE_INLINE agx::Line const& LinePtr::line() const { verifyIndex(); return getData()->line[calculateIndex()]; }
273 
274  //-----------------------------------------------------------------------------------------------------
275  AGX_FORCE_INLINE LineInstance::LineInstance() {}
276  AGX_FORCE_INLINE LineInstance::LineInstance(LineData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
277  AGX_FORCE_INLINE LineInstance::LineInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
278  AGX_FORCE_INLINE LineInstance::LineInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
279  {
280  agxAssertN(!other || other.isInstanceOf(LineModel::instance()),
281  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
283  }
284 
285  AGX_FORCE_INLINE LineInstance::LineInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
286  {
288  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
290  }
291 
292 
293  AGX_FORCE_INLINE LineData* LineInstance::getData() { return static_cast<LineData* >(agxData::EntityInstance::getData()); }
294  AGX_FORCE_INLINE const LineData* LineInstance::getData() const { return static_cast<const LineData* >(agxData::EntityInstance::getData()); }
295 
296  AGX_FORCE_INLINE agx::Line& LineInstance::line() { verifyIndex(); return getData()->line[getIndex()]; }
297  AGX_FORCE_INLINE agx::Line const& LineInstance::line() const { verifyIndex(); return getData()->line[getIndex()]; }
298 
299  //-----------------------------------------------------------------------------------------------------
300  AGX_FORCE_INLINE LineSemantics::LineSemantics() {}
301  //-----------------------------------------------------------------------------------------------------
303  }
304  }
305 }
306 
307 AGX_TYPE_BINDING(agx::Physics::Geometry::LinePtr, "Physics.Geometry.LinePtr")
308 AGX_TYPE_BINDING(agx::Physics::Geometry::LineInstance, "Physics.Geometry.LineInstance")
309 
310 #ifdef _MSC_VER
311 # pragma warning(pop)
312 #endif
313 
314 #undef AGX_ENTITY_WRAPPER
315 #undef AGX_ENTITY_NAMESPACE
316 #endif
317 
agxData::EntityData * getData()
AGXPHYSICS_EXPORT LineInstance instance()
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
AGXPHYSICS_EXPORT LinePtr & operator=(const agxData::EntityPtr &ptr)
#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
agxData::EntityRef< LinePtr > LineRef
Definition: LineEntity.h:192
#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
AGXPHYSICS_EXPORT agx::Line & line()
AGXPHYSICS_EXPORT LineSemantics * operator->()
Abstract description of the data attributes for the Physics.Geometry.Line entity. ...
Definition: LineEntity.h:70
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.
Pointer to a entity instance of type Physics.Geometry.Line.
Definition: LineEntity.h:160
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
AGXPHYSICS_EXPORT LinePtr()
#define CALLABLE
Definition: Object.h:73
static agxData::ScalarAttributeT< agx::Line > * lineAttribute
Definition: LineEntity.h:92
bool isInstanceOf(agxData::EntityModel *model) const
static LineModel * instance()
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97