AGX Dynamics  2.37.2.0
GraphNodeEntity.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_GRAPHNODE_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GRAPHNODE_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>
47 #include <agx/Integer.h>
48 
49 namespace agxData { class EntityPtr; }
50 
51 namespace agx
52 {
53  namespace Physics
54  {
55 
56  class GraphNodeModel;
57  class GraphNodeData;
58  class GraphNodePtr;
59  class GraphNodeInstance;
60  class GraphNodeSemantics;
61 
62 
64 
69  {
70  public:
71  typedef GraphNodePtr PtrT;
72 
73  GraphNodeModel(const agx::String& name = "GraphNode");
74 
76  static GraphNodeModel* instance();
77 
79  static GraphNodePtr createInstance();
80 
82  static agxData::EntityStorage* defaultStorage();
83 
85  virtual void shutdownCleanup() override;
86 
87 
88 
89  /* Attributes */
98 
99  protected:
100  virtual ~GraphNodeModel();
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::GraphNodePtr graphNode);
106  };
107 
108 
110  #ifndef AGX_PHYSICS_GRAPHNODE_DATA_SET_OVERRIDE
111  #define AGX_PHYSICS_GRAPHNODE_DATA_SET
112  class AGXPHYSICS_EXPORT GraphNodeData : public agxData::EntityData
113  {
114  public:
115  GraphNodeInstance operator[] (size_t index);
116 
117  public:
127 
128  public:
129  typedef agxData::EntityPtr sourceType;
130  typedef agx::UInt8 typeType;
131  typedef agx::UInt8 stateType;
132  typedef agx::UInt32 colorType;
133  typedef agx::UInt32 tagType;
134  typedef agxData::Array< agx::UInt > edgesType;
135  typedef agx::UInt32 islandType;
136  typedef agx::UInt32 subindexType;
137 
138  public:
139  GraphNodeData(agxData::EntityStorage* storage);
140  GraphNodeData();
141 
142  protected:
143  virtual ~GraphNodeData() {}
144  virtual void setNumElements(agx::Index numElements) override;
145 
146  private:
147  GraphNodeData& operator= (const GraphNodeData&) { return *this; }
148 
149  };
150  #endif
152 
153 
155  class AGXPHYSICS_EXPORT GraphNodeSemantics : protected agxData::EntityPtr
156  {
157  public:
158 
159  // Automatic getters
160  agxData::EntityPtr const& getSource() const;
161  agx::UInt8 const& getType() const;
162  agx::UInt8 const& getState() const;
163  agx::UInt32 const& getColor() const;
164  agx::UInt32 const& getTag() const;
165  agxData::Array< agx::UInt > const& getEdges() const;
166  agx::UInt32 const& getIsland() const;
167  agx::UInt32 const& getSubindex() const;
168 
169  // Semantics defined by explicit kernels
170 
171  // Automatic setters
172  void setSource(agxData::EntityPtr const& value);
173  void setType(agx::UInt8 const& value);
174  void setState(agx::UInt8 const& value);
175  void setColor(agx::UInt32 const& value);
176  void setTag(agx::UInt32 const& value);
177  void setEdges(agxData::Array< agx::UInt > const& value);
178  void setIsland(agx::UInt32 const& value);
179  void setSubindex(agx::UInt32 const& value);
180 
181 
182  protected:
183  friend class GraphNodePtr;
184  friend class GraphNodeInstance;
185  GraphNodeSemantics();
186  };
188 
189 
190 
193  class CALLABLE GraphNodePtr : public agxData::EntityPtr
194  {
195  public:
197  typedef GraphNodeData DataType;
198  typedef GraphNodeInstance InstanceType;
199 
200  public:
205  AGXPHYSICS_EXPORT GraphNodePtr& operator= (const agxData::EntityPtr& ptr);
206  AGXPHYSICS_EXPORT GraphNodePtr& operator= (const agxData::EntityInstance& instance);
207  AGXPHYSICS_EXPORT GraphNodeInstance instance();
208  AGXPHYSICS_EXPORT const GraphNodeInstance instance() const;
209 
210  AGXPHYSICS_EXPORT GraphNodeSemantics* operator->();
211  AGXPHYSICS_EXPORT const GraphNodeSemantics* operator->() const;
212 
213  GraphNodeData* getData();
214  const GraphNodeData* getData() const;
215 
216 
220  AGXPHYSICS_EXPORT agxData::EntityPtr const& source() const;
221 
225  AGXPHYSICS_EXPORT agx::UInt8 const& type() const;
226 
228  AGXPHYSICS_EXPORT agx::UInt8& state();
230  AGXPHYSICS_EXPORT agx::UInt8 const& state() const;
231 
235  AGXPHYSICS_EXPORT agx::UInt32 const& color() const;
236 
240  AGXPHYSICS_EXPORT agx::UInt32 const& tag() const;
241 
245  AGXPHYSICS_EXPORT agxData::Array< agx::UInt > const& edges() const;
246 
248  AGXPHYSICS_EXPORT agx::UInt32& island();
250  AGXPHYSICS_EXPORT agx::UInt32 const& island() const;
251 
253  AGXPHYSICS_EXPORT agx::UInt32& subindex();
255  AGXPHYSICS_EXPORT agx::UInt32 const& subindex() const;
256 
257  };
258 
259 
261  class AGXPHYSICS_EXPORT GraphNodeInstance : public agxData::EntityInstance
262  {
263  public:
264  GraphNodeInstance();
265  GraphNodeInstance(GraphNodeData* data, agx::Index index);
266  GraphNodeInstance(agxData::EntityStorage *storage, agx::Index index);
267  GraphNodeInstance(const agxData::EntityInstance& other);
268  GraphNodeInstance(const agxData::EntityPtr& ptr);
269 
270  GraphNodeData* getData();
271  const GraphNodeData* getData() const;
272 
273  public:
275  agxData::EntityPtr& source();
277  agxData::EntityPtr const& source() const;
278 
280  agx::UInt8& type();
282  agx::UInt8 const& type() const;
283 
285  agx::UInt8& state();
287  agx::UInt8 const& state() const;
288 
290  agx::UInt32& color();
292  agx::UInt32 const& color() const;
293 
295  agx::UInt32& tag();
297  agx::UInt32 const& tag() const;
298 
302  agxData::Array< agx::UInt > const& edges() const;
303 
305  agx::UInt32& island();
307  agx::UInt32 const& island() const;
308 
310  agx::UInt32& subindex();
312  agx::UInt32 const& subindex() const;
313 
314  };
316 
317 
318 
321 
322 
323 
325  /* Implementation */
326  //-----------------------------------------------------------------------------------------------------
327  //-----------------------------------------------------------------------------------------------------
328  inline GraphNodeInstance agx::Physics::GraphNodeData::operator[] (size_t index) { return GraphNodeInstance(this, (agx::Index)index); }
329  //-----------------------------------------------------------------------------------------------------
330  AGX_FORCE_INLINE GraphNodePtr::GraphNodePtr() {}
331  AGX_FORCE_INLINE GraphNodePtr::GraphNodePtr(agxData::EntityStorage* storage, agx::Index id) : agxData::EntityPtr(storage, id) {}
332  AGX_FORCE_INLINE GraphNodePtr::GraphNodePtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
333  {
334  agxAssertN(!ptr || ptr.isInstanceOf(GraphNodeModel::instance()),
335  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
336  EntityPtr::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
337  }
338 
339  AGX_FORCE_INLINE GraphNodePtr::GraphNodePtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
340  {
341  agxAssertN(!instance || instance.isInstanceOf(GraphNodeModel::instance()),
342  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
343  EntityPtr::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
344  }
345 
346  AGX_FORCE_INLINE GraphNodePtr& GraphNodePtr::operator= (const agxData::EntityPtr& ptr)
347  {
349  agxAssertN(!ptr || ptr.isInstanceOf(GraphNodeModel::instance()),
350  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
351  EntityPtr::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
352  return *this;
353  }
354 
355  AGX_FORCE_INLINE GraphNodePtr& GraphNodePtr::operator= (const agxData::EntityInstance& instance)
356  {
358  agxAssertN(!instance || instance.isInstanceOf(GraphNodeModel::instance()),
359  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
360  EntityPtr::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
361  return *this;
362  }
363 
364  inline GraphNodeInstance GraphNodePtr::instance() { return agxData::EntityPtr::instance(); }
365  inline const GraphNodeInstance GraphNodePtr::instance() const { return agxData::EntityPtr::instance(); }
366  AGX_FORCE_INLINE GraphNodeSemantics* GraphNodePtr::operator->() { return (GraphNodeSemantics* )this; }
367  AGX_FORCE_INLINE const GraphNodeSemantics* GraphNodePtr::operator->() const { return (const GraphNodeSemantics* )this; }
368  AGX_FORCE_INLINE GraphNodeData* GraphNodePtr::getData() { return static_cast<GraphNodeData* >(agxData::EntityPtr::getData()); }
369  AGX_FORCE_INLINE const GraphNodeData* GraphNodePtr::getData() const { return static_cast<const GraphNodeData* >(agxData::EntityPtr::getData()); }
370 
371  AGX_FORCE_INLINE agxData::EntityPtr& GraphNodePtr::source() { verifyIndex(); return getData()->source[calculateIndex()]; }
372  AGX_FORCE_INLINE agxData::EntityPtr const& GraphNodePtr::source() const { verifyIndex(); return getData()->source[calculateIndex()]; }
373 
374  AGX_FORCE_INLINE agx::UInt8& GraphNodePtr::type() { verifyIndex(); return getData()->type[calculateIndex()]; }
375  AGX_FORCE_INLINE agx::UInt8 const& GraphNodePtr::type() const { verifyIndex(); return getData()->type[calculateIndex()]; }
376 
377  AGX_FORCE_INLINE agx::UInt8& GraphNodePtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
378  AGX_FORCE_INLINE agx::UInt8 const& GraphNodePtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
379 
380  AGX_FORCE_INLINE agx::UInt32& GraphNodePtr::color() { verifyIndex(); return getData()->color[calculateIndex()]; }
381  AGX_FORCE_INLINE agx::UInt32 const& GraphNodePtr::color() const { verifyIndex(); return getData()->color[calculateIndex()]; }
382 
383  AGX_FORCE_INLINE agx::UInt32& GraphNodePtr::tag() { verifyIndex(); return getData()->tag[calculateIndex()]; }
384  AGX_FORCE_INLINE agx::UInt32 const& GraphNodePtr::tag() const { verifyIndex(); return getData()->tag[calculateIndex()]; }
385 
386  AGX_FORCE_INLINE agxData::Array< agx::UInt >& GraphNodePtr::edges() { verifyIndex(); return getData()->edges[calculateIndex()]; }
387  AGX_FORCE_INLINE agxData::Array< agx::UInt > const& GraphNodePtr::edges() const { verifyIndex(); return getData()->edges[calculateIndex()]; }
388 
389  AGX_FORCE_INLINE agx::UInt32& GraphNodePtr::island() { verifyIndex(); return getData()->island[calculateIndex()]; }
390  AGX_FORCE_INLINE agx::UInt32 const& GraphNodePtr::island() const { verifyIndex(); return getData()->island[calculateIndex()]; }
391 
392  AGX_FORCE_INLINE agx::UInt32& GraphNodePtr::subindex() { verifyIndex(); return getData()->subindex[calculateIndex()]; }
393  AGX_FORCE_INLINE agx::UInt32 const& GraphNodePtr::subindex() const { verifyIndex(); return getData()->subindex[calculateIndex()]; }
394 
395  //-----------------------------------------------------------------------------------------------------
396  AGX_FORCE_INLINE GraphNodeInstance::GraphNodeInstance() {}
397  AGX_FORCE_INLINE GraphNodeInstance::GraphNodeInstance(GraphNodeData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
398  AGX_FORCE_INLINE GraphNodeInstance::GraphNodeInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
399  AGX_FORCE_INLINE GraphNodeInstance::GraphNodeInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
400  {
401  agxAssertN(!other || other.isInstanceOf(GraphNodeModel::instance()),
402  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
403  EntityInstance::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
404  }
405 
406  AGX_FORCE_INLINE GraphNodeInstance::GraphNodeInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
407  {
408  agxAssertN(!ptr || ptr.isInstanceOf(GraphNodeModel::instance()),
409  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
410  EntityInstance::getModel()->fullPath().c_str(), GraphNodeModel::instance()->fullPath().c_str());
411  }
412 
413 
414  AGX_FORCE_INLINE GraphNodeData* GraphNodeInstance::getData() { return static_cast<GraphNodeData* >(agxData::EntityInstance::getData()); }
415  AGX_FORCE_INLINE const GraphNodeData* GraphNodeInstance::getData() const { return static_cast<const GraphNodeData* >(agxData::EntityInstance::getData()); }
416 
417  AGX_FORCE_INLINE agxData::EntityPtr& GraphNodeInstance::source() { verifyIndex(); return getData()->source[getIndex()]; }
418  AGX_FORCE_INLINE agxData::EntityPtr const& GraphNodeInstance::source() const { verifyIndex(); return getData()->source[getIndex()]; }
419 
420  AGX_FORCE_INLINE agx::UInt8& GraphNodeInstance::type() { verifyIndex(); return getData()->type[getIndex()]; }
421  AGX_FORCE_INLINE agx::UInt8 const& GraphNodeInstance::type() const { verifyIndex(); return getData()->type[getIndex()]; }
422 
423  AGX_FORCE_INLINE agx::UInt8& GraphNodeInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
424  AGX_FORCE_INLINE agx::UInt8 const& GraphNodeInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
425 
426  AGX_FORCE_INLINE agx::UInt32& GraphNodeInstance::color() { verifyIndex(); return getData()->color[getIndex()]; }
427  AGX_FORCE_INLINE agx::UInt32 const& GraphNodeInstance::color() const { verifyIndex(); return getData()->color[getIndex()]; }
428 
429  AGX_FORCE_INLINE agx::UInt32& GraphNodeInstance::tag() { verifyIndex(); return getData()->tag[getIndex()]; }
430  AGX_FORCE_INLINE agx::UInt32 const& GraphNodeInstance::tag() const { verifyIndex(); return getData()->tag[getIndex()]; }
431 
432  AGX_FORCE_INLINE agxData::Array< agx::UInt >& GraphNodeInstance::edges() { verifyIndex(); return getData()->edges[getIndex()]; }
433  AGX_FORCE_INLINE agxData::Array< agx::UInt > const& GraphNodeInstance::edges() const { verifyIndex(); return getData()->edges[getIndex()]; }
434 
435  AGX_FORCE_INLINE agx::UInt32& GraphNodeInstance::island() { verifyIndex(); return getData()->island[getIndex()]; }
436  AGX_FORCE_INLINE agx::UInt32 const& GraphNodeInstance::island() const { verifyIndex(); return getData()->island[getIndex()]; }
437 
438  AGX_FORCE_INLINE agx::UInt32& GraphNodeInstance::subindex() { verifyIndex(); return getData()->subindex[getIndex()]; }
439  AGX_FORCE_INLINE agx::UInt32 const& GraphNodeInstance::subindex() const { verifyIndex(); return getData()->subindex[getIndex()]; }
440 
441  //-----------------------------------------------------------------------------------------------------
442  AGX_FORCE_INLINE GraphNodeSemantics::GraphNodeSemantics() {}
443  //-----------------------------------------------------------------------------------------------------
445  }
446 }
447 
448 AGX_TYPE_BINDING(agx::Physics::GraphNodePtr, "Physics.GraphNodePtr")
449 AGX_TYPE_BINDING(agx::Physics::GraphNodeInstance, "Physics.GraphNodeInstance")
450 
451 #ifdef _MSC_VER
452 # pragma warning(pop)
453 #endif
454 
455 #undef AGX_ENTITY_WRAPPER
456 #undef AGX_ENTITY_NAMESPACE
457 #endif
458 
agxData::EntityModel * getModel()
AGXCORE_EXPORT Type * getType(const agx::String &name)
agxData::EntityData * getData()
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
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
uint8_t UInt8
Definition: Integer.h:38
static agxData::ScalarAttributeT< agx::UInt32 > * subindexAttribute
#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
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.GraphNode.
agxData::EntityModel * getModel()
Alias for getData()->getStorage()->getModel()
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
Abstract description of the data attributes for the Physics.GraphNode entity.
GraphNodeInstance InstanceType
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:63
#define CALLABLE
Definition: Object.h:73
static agxData::ScalarAttributeT< agx::UInt32 > * islandAttribute
static agxData::ScalarAttributeT< agxData::EntityPtr > * sourceAttribute
static agxData::ArrayAttributeT< agx::UInt > * edgesAttribute
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::UInt32 > * colorAttribute
static agxData::ScalarAttributeT< agx::UInt8 > * typeAttribute
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
static agxData::ScalarAttributeT< agx::UInt32 > * tagAttribute