AGX Dynamics  2.37.2.0
BroadPhasePairEntity.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_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 
80  static BroadPhasePairModel* instance();
81 
83  static BroadPhasePairPtr createInstance();
84 
86  static agxData::EntityStorage* defaultStorage();
87 
89  virtual void shutdownCleanup() override;
90 
91 
92 
93  /* Attributes */
97 
98  protected:
99  virtual ~BroadPhasePairModel();
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;
104  void construct(agx::Physics::BroadPhasePairPtr broadPhasePair);
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:
185  AGXPHYSICS_EXPORT BroadPhasePairPtr& operator= (const agxData::EntityInstance& instance);
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 
197  AGXPHYSICS_EXPORT agx::UInt8& state();
199  AGXPHYSICS_EXPORT agx::UInt8 const& state() const;
200 
205 
210 
211  };
212 
213 
215  class AGXPHYSICS_EXPORT BroadPhasePairInstance : public agx::Physics::GeometryPairInstance
216  {
217  public:
218  BroadPhasePairInstance();
219  BroadPhasePairInstance(BroadPhasePairData* data, agx::Index index);
220  BroadPhasePairInstance(agxData::EntityStorage *storage, agx::Index index);
221  BroadPhasePairInstance(const agxData::EntityInstance& other);
222  BroadPhasePairInstance(const agxData::EntityPtr& ptr);
223 
224  BroadPhasePairData* getData();
225  const BroadPhasePairData* getData() const;
226 
227  public:
229  agx::UInt8& state();
231  agx::UInt8 const& state() const;
232 
236  agx::Physics::GeometryContactPtr const& contact() const;
237 
241  agxData::Array< agx::Physics::WarmStartingDataPtr > const& warmStartingData() const;
242 
243  };
245 
246 
247 
250 
251 
252 
254  /* Implementation */
255  //-----------------------------------------------------------------------------------------------------
256  //-----------------------------------------------------------------------------------------------------
257  inline BroadPhasePairInstance agx::Physics::BroadPhasePairData::operator[] (size_t index) { return BroadPhasePairInstance(this, (agx::Index)index); }
258  //-----------------------------------------------------------------------------------------------------
262  {
264  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
266  }
267 
269  {
270  agxAssertN(!instance || instance.isInstanceOf(BroadPhasePairModel::instance()),
271  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
273  }
274 
276  {
279  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
281  return *this;
282  }
283 
285  {
287  agxAssertN(!instance || instance.isInstanceOf(BroadPhasePairModel::instance()),
288  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
290  return *this;
291  }
292 
293  inline BroadPhasePairInstance BroadPhasePairPtr::instance() { return agxData::EntityPtr::instance(); }
294  inline const BroadPhasePairInstance BroadPhasePairPtr::instance() const { return agxData::EntityPtr::instance(); }
295  AGX_FORCE_INLINE BroadPhasePairSemantics* BroadPhasePairPtr::operator->() { return (BroadPhasePairSemantics* )this; }
296  AGX_FORCE_INLINE const BroadPhasePairSemantics* BroadPhasePairPtr::operator->() const { return (const BroadPhasePairSemantics* )this; }
297  AGX_FORCE_INLINE BroadPhasePairData* BroadPhasePairPtr::getData() { return static_cast<BroadPhasePairData* >(agxData::EntityPtr::getData()); }
298  AGX_FORCE_INLINE const BroadPhasePairData* BroadPhasePairPtr::getData() const { return static_cast<const BroadPhasePairData* >(agxData::EntityPtr::getData()); }
299 
300  AGX_FORCE_INLINE agx::UInt8& BroadPhasePairPtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
301  AGX_FORCE_INLINE agx::UInt8 const& BroadPhasePairPtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
302 
303  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr& BroadPhasePairPtr::contact() { verifyIndex(); return getData()->contact[calculateIndex()]; }
304  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr const& BroadPhasePairPtr::contact() const { verifyIndex(); return getData()->contact[calculateIndex()]; }
305 
306  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr >& BroadPhasePairPtr::warmStartingData() { verifyIndex(); return getData()->warmStartingData[calculateIndex()]; }
307  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr > const& BroadPhasePairPtr::warmStartingData() const { verifyIndex(); return getData()->warmStartingData[calculateIndex()]; }
308 
309  //-----------------------------------------------------------------------------------------------------
310  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance() {}
311  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(BroadPhasePairData* data, agx::Index index) : agx::Physics::GeometryPairInstance(data, index) {}
312  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::GeometryPairInstance(storage, index) {}
313  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(const agxData::EntityInstance& other) : agx::Physics::GeometryPairInstance(other)
314  {
316  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
318  }
319 
320  AGX_FORCE_INLINE BroadPhasePairInstance::BroadPhasePairInstance(const agxData::EntityPtr& ptr) : agx::Physics::GeometryPairInstance(ptr)
321  {
323  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
325  }
326 
327 
328  AGX_FORCE_INLINE BroadPhasePairData* BroadPhasePairInstance::getData() { return static_cast<BroadPhasePairData* >(agxData::EntityInstance::getData()); }
329  AGX_FORCE_INLINE const BroadPhasePairData* BroadPhasePairInstance::getData() const { return static_cast<const BroadPhasePairData* >(agxData::EntityInstance::getData()); }
330 
331  AGX_FORCE_INLINE agx::UInt8& BroadPhasePairInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
332  AGX_FORCE_INLINE agx::UInt8 const& BroadPhasePairInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
333 
334  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr& BroadPhasePairInstance::contact() { verifyIndex(); return getData()->contact[getIndex()]; }
335  AGX_FORCE_INLINE agx::Physics::GeometryContactPtr const& BroadPhasePairInstance::contact() const { verifyIndex(); return getData()->contact[getIndex()]; }
336 
337  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr >& BroadPhasePairInstance::warmStartingData() { verifyIndex(); return getData()->warmStartingData[getIndex()]; }
338  AGX_FORCE_INLINE agxData::Array< agx::Physics::WarmStartingDataPtr > const& BroadPhasePairInstance::warmStartingData() const { verifyIndex(); return getData()->warmStartingData[getIndex()]; }
339 
340  //-----------------------------------------------------------------------------------------------------
341  AGX_FORCE_INLINE BroadPhasePairSemantics::BroadPhasePairSemantics() {}
342  //-----------------------------------------------------------------------------------------------------
344  }
345 }
346 
347 AGX_TYPE_BINDING(agx::Physics::BroadPhasePairPtr, "Physics.BroadPhasePairPtr")
348 AGX_TYPE_BINDING(agx::Physics::BroadPhasePairInstance, "Physics.BroadPhasePairInstance")
349 
350 #ifdef _MSC_VER
351 # pragma warning(pop)
352 #endif
353 
354 #undef AGX_ENTITY_WRAPPER
355 #undef AGX_ENTITY_NAMESPACE
356 #endif
357 
AGXPHYSICS_EXPORT BroadPhasePairPtr & operator=(const agxData::EntityPtr &ptr)
agxData::EntityData * getData()
AGXPHYSICS_EXPORT BroadPhasePairPtr()
static agxData::ArrayAttributeT< agx::Physics::WarmStartingDataPtr > * warmStartingDataAttribute
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
static BroadPhasePairModel * instance()
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
Pointer to a entity instance of type Physics.BroadPhasePair.
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agxData::EntityData * getData()
AGXPHYSICS_EXPORT agxData::Array< agx::Physics::WarmStartingDataPtr > & warmStartingData()
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
uint8_t UInt8
Definition: Integer.h:38
#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
AGXPHYSICS_EXPORT BroadPhasePairInstance instance()
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
#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
Pointer to a entity instance of type Physics.GeometryPair.
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.
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
BroadPhasePairData * getData()
#define CALLABLE
Definition: Object.h:73
AGXPHYSICS_EXPORT agx::UInt8 & state()
A geometry contact hold contact information between two geometries.
Abstract description of the data attributes for the Physics.GeometryPair entity.
AGXPHYSICS_EXPORT agx::Physics::GeometryContactPtr & contact()
bool isInstanceOf(agxData::EntityModel *model) const
Abstract description of the data attributes for the Physics.BroadPhasePair entity.
AGXPHYSICS_EXPORT BroadPhasePairSemantics * operator->()
static agxData::ScalarAttributeT< agx::Physics::GeometryContactPtr > * contactAttribute
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97