AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
GraphNodeEntity.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_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>
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>
47#include <agx/Integer.h>
48
49namespace agxData { class EntityPtr; }
50
51namespace 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:
72
73 GraphNodeModel(const agx::String& name = "GraphNode");
74
77
80
83
85 virtual void shutdownCleanup() override;
86
87
88
89 /* Attributes */
98
99 protected:
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;
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:
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
221
226
231
236
241
246
251
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 //-----------------------------------------------------------------------------------------------------
332 AGX_FORCE_INLINE GraphNodePtr::GraphNodePtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
333 {
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 {
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 {
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
448AGX_TYPE_BINDING(agx::Physics::GraphNodePtr, "Physics.GraphNodePtr")
449AGX_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
#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()
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:64
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
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.GraphNode entity.
static agxData::ScalarAttributeT< agxData::EntityPtr > * sourceAttribute
static agxData::ScalarAttributeT< agx::UInt32 > * tagAttribute
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::UInt8 > * typeAttribute
static GraphNodeModel * instance()
static agxData::ArrayAttributeT< agx::UInt > * edgesAttribute
static agxData::ScalarAttributeT< agx::UInt32 > * islandAttribute
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
static GraphNodePtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::UInt32 > * colorAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void configure(agx::TiXmlElement *eEntity) override
GraphNodeModel(const agx::String &name="GraphNode")
static agxData::ScalarAttributeT< agx::UInt32 > * subindexAttribute
virtual void initAttributeAccessors() override
void construct(agx::Physics::GraphNodePtr graphNode)
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
Pointer to a entity instance of type Physics.GraphNode.
AGXPHYSICS_EXPORT GraphNodePtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::UInt32 & color()
const GraphNodeData * getData() const
AGXPHYSICS_EXPORT const GraphNodeInstance instance() const
AGXPHYSICS_EXPORT GraphNodeInstance instance()
AGXPHYSICS_EXPORT agx::UInt32 const & color() const
AGXPHYSICS_EXPORT agx::UInt32 & tag()
AGXPHYSICS_EXPORT GraphNodePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::UInt32 const & tag() const
AGXPHYSICS_EXPORT agx::UInt8 & type()
GraphNodeInstance InstanceType
AGXPHYSICS_EXPORT agx::UInt8 & state()
AGXPHYSICS_EXPORT agx::UInt32 const & island() const
AGXPHYSICS_EXPORT agxData::Array< agx::UInt > & edges()
AGXPHYSICS_EXPORT const GraphNodeSemantics * operator->() const
AGXPHYSICS_EXPORT GraphNodePtr()
AGXPHYSICS_EXPORT agx::UInt32 & island()
AGXPHYSICS_EXPORT agx::UInt32 const & subindex() const
GraphNodeData * getData()
AGXPHYSICS_EXPORT GraphNodePtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::UInt8 const & type() const
AGXPHYSICS_EXPORT agxData::EntityPtr const & source() const
AGXPHYSICS_EXPORT agx::UInt8 const & state() const
AGXPHYSICS_EXPORT agxData::Array< agx::UInt > const & edges() const
AGXPHYSICS_EXPORT agx::UInt32 & subindex()
AGXPHYSICS_EXPORT GraphNodeSemantics * operator->()
AGXPHYSICS_EXPORT agxData::EntityPtr & source()
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
AGXCORE_EXPORT Type * getType(const agx::String &name)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
uint8_t UInt8
Definition: Integer.h:30
UInt32 Index
Definition: Integer.h:44