AGX Dynamics  2.35.0.1
BroadPhasePairEntity.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_BROADPHASEPAIR_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_BROADPHASEPAIR_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/Integer.h>
51 
52 namespace agx { namespace Physics { class GeometryContactPtr; }}
53 namespace agx { namespace Physics { class WarmStartingDataPtr; }}
54 
55 namespace agx
56 {
57  namespace Physics
58  {
59 
60  class BroadPhasePairModel;
61  class BroadPhasePairData;
62  class BroadPhasePairPtr;
63  class BroadPhasePairInstance;
64  class BroadPhasePairSemantics;
65 
66 
68 
73  {
74  public:
76 
77  BroadPhasePairModel(const agx::String& name = "BroadPhasePair");
78 
81 
84 
87 
89  virtual void shutdownCleanup() override;
90 
91 
92 
93  /* Attributes */
97 
98  protected:
100  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
101  virtual void configure(agx::TiXmlElement* eEntity) override;
102  virtual void initAttributeAccessors() override;
103  virtual void construct(agxData::EntityPtr instance) override;
105  };
106 
107 
109  #ifndef AGX_PHYSICS_BROADPHASEPAIR_DATA_SET_OVERRIDE
110  #define AGX_PHYSICS_BROADPHASEPAIR_DATA_SET
111  class AGXPHYSICS_EXPORT BroadPhasePairData : public agx::Physics::GeometryPairData
112  {
113  public:
114  BroadPhasePairInstance operator[] (size_t index);
115 
116  public:
121 
122  public:
123  typedef agx::UInt8 stateType;
124  typedef agx::Physics::GeometryContactPtr contactType;
125  typedef agxData::Array< agx::Physics::WarmStartingDataPtr > warmStartingDataType;
126 
127  public:
128  BroadPhasePairData(agxData::EntityStorage* storage);
129  BroadPhasePairData();
130 
131  protected:
132  virtual ~BroadPhasePairData() {}
133  virtual void setNumElements(agx::Index numElements) override;
134 
135  private:
136  BroadPhasePairData& operator= (const BroadPhasePairData&) { return *this; }
137 
138  };
139  #endif
141 
142 
144  class AGXPHYSICS_EXPORT BroadPhasePairSemantics : public agx::Physics::GeometryPairSemantics
145  {
146  public:
147 
148  // Automatic getters
149  agx::UInt8 const& getState() const;
150  agx::Physics::GeometryContactPtr const& getContact() const;
151  agxData::Array< agx::Physics::WarmStartingDataPtr > const& getWarmStartingData() const;
152 
153  // Semantics defined by explicit kernels
154 
155  // Automatic setters
156  void setState(agx::UInt8 const& value);
157  void setContact(agx::Physics::GeometryContactPtr const& value);
158  void setWarmStartingData(agxData::Array< agx::Physics::WarmStartingDataPtr > const& value);
159 
160 
161  protected:
162  friend class BroadPhasePairPtr;
163  friend class BroadPhasePairInstance;
164  BroadPhasePairSemantics();
165  };
167 
168 
169 
173  {
174  public:
176  typedef BroadPhasePairData DataType;
177  typedef BroadPhasePairInstance InstanceType;
178 
179  public:
186  AGXPHYSICS_EXPORT BroadPhasePairInstance instance();
187  AGXPHYSICS_EXPORT const BroadPhasePairInstance instance() const;
188 
189  AGXPHYSICS_EXPORT BroadPhasePairSemantics* operator->();
190  AGXPHYSICS_EXPORT const BroadPhasePairSemantics* operator->() const;
191 
192  BroadPhasePairData* getData();
193  const BroadPhasePairData* getData() const;
194 
195 
200 
205 
210 
212  // Only used by tolua!
213  #ifdef AGX_GENERATED_TOLUA_WRAPPER
214  inline agx::UInt8 const& getState() const { return (*this)->getState(); }
215  inline agx::Physics::GeometryContactPtr const& getContact() const { return (*this)->getContact(); }
216  inline agxData::Array< agx::Physics::WarmStartingDataPtr > const& getWarmStartingData() const { return (*this)->getWarmStartingData(); }
217 
218 
219  inline void setState(agx::UInt8 const& value) { (*this)->setState(value); }
220  inline void setContact(agx::Physics::GeometryContactPtr const& value) { (*this)->setContact(value); }
221  inline void setWarmStartingData(agxData::Array< agx::Physics::WarmStartingDataPtr > const& value) { (*this)->setWarmStartingData(value); }
222  #endif
224 
225  };
226 
227 
229  class AGXPHYSICS_EXPORT BroadPhasePairInstance : public agx::Physics::GeometryPairInstance
230  {
231  public:
232  BroadPhasePairInstance();
233  BroadPhasePairInstance(BroadPhasePairData* data, agx::Index index);
234  BroadPhasePairInstance(agxData::EntityStorage *storage, agx::Index index);
235  BroadPhasePairInstance(const agxData::EntityInstance& other);
236  BroadPhasePairInstance(const agxData::EntityPtr& ptr);
237 
238  BroadPhasePairData* getData();
239  const BroadPhasePairData* getData() const;
240 
241  public:
243  agx::UInt8& state();
245  agx::UInt8 const& state() const;
246 
250  agx::Physics::GeometryContactPtr const& contact() const;
251 
255  agxData::Array< agx::Physics::WarmStartingDataPtr > const& warmStartingData() const;
256 
257  };
259 
260 
261 
264 
265 
266 
268  /* Implementation */
269  //-----------------------------------------------------------------------------------------------------
270  //-----------------------------------------------------------------------------------------------------
271  inline BroadPhasePairInstance agx::Physics::BroadPhasePairData::operator[] (size_t index) { return BroadPhasePairInstance(this, (agx::Index)index); }
272  //-----------------------------------------------------------------------------------------------------
274  AGX_FORCE_INLINE BroadPhasePairPtr::BroadPhasePairPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::GeometryPairPtr(storage, id) {}
275  AGX_FORCE_INLINE BroadPhasePairPtr::BroadPhasePairPtr(const agxData::EntityPtr& ptr) : agx::Physics::GeometryPairPtr(ptr)
276  {
278  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
280  }
281 
282  AGX_FORCE_INLINE BroadPhasePairPtr::BroadPhasePairPtr(const agxData::EntityInstance& instance) : agx::Physics::GeometryPairPtr(instance)
283  {
284  agxAssertN(!instance || instance.isInstanceOf(BroadPhasePairModel::instance()),
285  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
287  }
288 
289  AGX_FORCE_INLINE BroadPhasePairPtr& BroadPhasePairPtr::operator= (const agxData::EntityPtr& ptr)
290  {
292  agxAssertN(!ptr || ptr.isInstanceOf(BroadPhasePairModel::instance()),
293  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
294  EntityPtr::getModel()->fullPath().c_str(), BroadPhasePairModel::instance()->fullPath().c_str());
295  return *this;
296  }
297 
298  AGX_FORCE_INLINE BroadPhasePairPtr& BroadPhasePairPtr::operator= (const agxData::EntityInstance& instance)
299  {
301  agxAssertN(!instance || instance.isInstanceOf(BroadPhasePairModel::instance()),
302  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
303  EntityPtr::getModel()->fullPath().c_str(), BroadPhasePairModel::instance()->fullPath().c_str());
304  return *this;
305  }
306 
307  inline BroadPhasePairInstance BroadPhasePairPtr::instance() { return agxData::EntityPtr::instance(); }
308  inline const BroadPhasePairInstance BroadPhasePairPtr::instance() const { return agxData::EntityPtr::instance(); }
309  AGX_FORCE_INLINE BroadPhasePairSemantics* BroadPhasePairPtr::operator->() { return (BroadPhasePairSemantics* )this; }
310  AGX_FORCE_INLINE const BroadPhasePairSemantics* BroadPhasePairPtr::operator->() const { return (const BroadPhasePairSemantics* )this; }
311  AGX_FORCE_INLINE BroadPhasePairData* BroadPhasePairPtr::getData() { return static_cast<BroadPhasePairData* >(agxData::EntityPtr::getData()); }
312  AGX_FORCE_INLINE const BroadPhasePairData* BroadPhasePairPtr::getData() const { return static_cast<const BroadPhasePairData* >(agxData::EntityPtr::getData()); }
313 
314  AGX_FORCE_INLINE agx::UInt8& BroadPhasePairPtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
315  AGX_FORCE_INLINE agx::UInt8 const& BroadPhasePairPtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
316 
317  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr& BroadPhasePairPtr::contact() { verifyIndex(); return getData()->contact[calculateIndex()]; }
318  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr const& BroadPhasePairPtr::contact() const { verifyIndex(); return getData()->contact[calculateIndex()]; }
319 
320  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr >& BroadPhasePairPtr::warmStartingData() { verifyIndex(); return getData()->warmStartingData[calculateIndex()]; }
321  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr > const& BroadPhasePairPtr::warmStartingData() const { verifyIndex(); return getData()->warmStartingData[calculateIndex()]; }
322 
323  //-----------------------------------------------------------------------------------------------------
324  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance() {}
325  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(BroadPhasePairData* data, agx::Index index) : agx::Physics::GeometryPairInstance(data, index) {}
326  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::GeometryPairInstance(storage, index) {}
327  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(const agxData::EntityInstance& other) : agx::Physics::GeometryPairInstance(other)
328  {
330  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
332  }
333 
334  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(const agxData::EntityPtr& ptr) : agx::Physics::GeometryPairInstance(ptr)
335  {
337  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
339  }
340 
341 
342  AGX_FORCE_INLINE BroadPhasePairData* BroadPhasePairInstance::getData() { return static_cast<BroadPhasePairData* >(agxData::EntityInstance::getData()); }
343  AGX_FORCE_INLINE const BroadPhasePairData* BroadPhasePairInstance::getData() const { return static_cast<const BroadPhasePairData* >(agxData::EntityInstance::getData()); }
344 
345  AGX_FORCE_INLINE agx::UInt8& BroadPhasePairInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
346  AGX_FORCE_INLINE agx::UInt8 const& BroadPhasePairInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
347 
348  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr& BroadPhasePairInstance::contact() { verifyIndex(); return getData()->contact[getIndex()]; }
349  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr const& BroadPhasePairInstance::contact() const { verifyIndex(); return getData()->contact[getIndex()]; }
350 
351  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr >& BroadPhasePairInstance::warmStartingData() { verifyIndex(); return getData()->warmStartingData[getIndex()]; }
352  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr > const& BroadPhasePairInstance::warmStartingData() const { verifyIndex(); return getData()->warmStartingData[getIndex()]; }
353 
354  //-----------------------------------------------------------------------------------------------------
355  AGX_FORCE_INLINE BroadPhasePairSemantics::BroadPhasePairSemantics() {}
356  //-----------------------------------------------------------------------------------------------------
358  }
359 }
360 
361 AGX_TYPE_BINDING(agx::Physics::BroadPhasePairPtr, "Physics.BroadPhasePairPtr")
362 AGX_TYPE_BINDING(agx::Physics::BroadPhasePairInstance, "Physics.BroadPhasePairInstance")
363 
364 #ifdef _MSC_VER
365 # pragma warning(pop)
366 #endif
367 
368 #undef AGX_ENTITY_WRAPPER
369 #undef AGX_ENTITY_NAMESPACE
370 #endif
371 
#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
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.BroadPhasePair entity.
void construct(agx::Physics::BroadPhasePairPtr broadPhasePair)
BroadPhasePairModel(const agx::String &name="BroadPhasePair")
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Physics::GeometryContactPtr > * contactAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void configure(agx::TiXmlElement *eEntity) override
static BroadPhasePairModel * instance()
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
static agxData::EntityStorage * defaultStorage()
static BroadPhasePairPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ArrayAttributeT< agx::Physics::WarmStartingDataPtr > * warmStartingDataAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void initAttributeAccessors() override
Pointer to a entity instance of type Physics.BroadPhasePair.
AGXPHYSICS_EXPORT BroadPhasePairPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::UInt8 const & state() const
AGXPHYSICS_EXPORT const BroadPhasePairSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Physics::GeometryContactPtr const & contact() const
AGXPHYSICS_EXPORT BroadPhasePairPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Physics::GeometryContactPtr & contact()
AGXPHYSICS_EXPORT BroadPhasePairInstance instance()
AGXPHYSICS_EXPORT const BroadPhasePairInstance instance() const
AGXPHYSICS_EXPORT BroadPhasePairPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::UInt8 & state()
AGXPHYSICS_EXPORT BroadPhasePairSemantics * operator->()
AGXPHYSICS_EXPORT BroadPhasePairPtr()
const BroadPhasePairData * getData() const
AGXPHYSICS_EXPORT agxData::Array< agx::Physics::WarmStartingDataPtr > const & warmStartingData() const
BroadPhasePairData * getData()
AGXPHYSICS_EXPORT agxData::Array< agx::Physics::WarmStartingDataPtr > & warmStartingData()
A geometry contact hold contact information between two geometries.
Abstract description of the data attributes for the Physics.GeometryPair entity.
Pointer to a entity instance of type Physics.GeometryPair.
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
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint8_t UInt8
Definition: Integer.h:38
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52