AGXDynamics  2.35.0.2
Data.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 having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 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 
17 #ifndef AGX_DATA_H
18 #define AGX_DATA_H
19 
20 #include <agx/Vector.h>
21 
22 
23 namespace agxData
24 {
25  // Forward declarations
26  class AbstractScalar;
27  class AbstractArray;
28 
29  template <typename T>
30  class Scalar;
31 
32  template <typename T>
33  class Array;
34 
35 
40  {
41  public:
42  Data(void *ptr = nullptr);
43 
47  void *ptr();
48  const void *ptr() const;
49 
50 
51  // Convenience methods to static cast to Scalar (implemented in Scalar.h)
52  const AbstractScalar& asScalar() const;
53  AbstractScalar& asScalar();
54 
55  template <typename T>
56  Scalar<T>& asScalar();
57 
58  template <typename T>
59  const Scalar<T>& asScalar() const;
60 
61  // Convenience methods to static cast to Array (implemented in Array.h)
62  const AbstractArray& asArray() const;
63  AbstractArray& asArray();
64 
65  template <typename T>
66  Array<T>& asArray();
67 
68  template <typename T>
69  const Array<T>& asArray() const;
70 
71  protected:
72  void *m_ptr;
73  };
74 
75 
77 
78 
79  /* Implementation */
80 
81  AGX_FORCE_INLINE Data::Data(void *ptr) : m_ptr(ptr) {}
82 
83 
84  AGX_FORCE_INLINE void *Data::ptr() { return m_ptr; }
85  AGX_FORCE_INLINE const void *Data::ptr() const { return m_ptr; }
86 
87 }
88 
89 
90 #endif /* AGX_DATA_H */
91 
AGXCORE_EXPORT
#define AGXCORE_EXPORT
agxData::AbstractArray
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
Definition: Array.h:36
Vector.h
agxData::Scalar
Templated scalar.
Definition: Data.h:30
agxData::AbstractScalar
Abstract representation of a scalar variable.
Definition: Scalar.h:29
agxData::Data
Generic data.
Definition: Data.h:39
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agxData::Data::ptr
void * ptr()
Definition: Data.h:84
agxData
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
agxData::DataPtrVector
agx::VectorPOD< Data * > DataPtrVector
Definition: Data.h:76
agxData::Data::m_ptr
void * m_ptr
Definition: Data.h:72
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agxData::Data::Data
Data(void *ptr=nullptr)
Definition: Data.h:81