AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
Data.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 having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid 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
17#ifndef AGX_DATA_H
18#define AGX_DATA_H
19
20#include <agx/Vector.h>
21
22
23namespace 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
#define AGXCORE_EXPORT
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
Definition: Array.h:37
Abstract representation of a scalar variable.
Definition: Scalar.h:30
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Generic data.
Definition: Data.h:40
void * m_ptr
Definition: Data.h:72
Data(void *ptr=nullptr)
Definition: Data.h:81
void * ptr()
Definition: Data.h:84
Templated scalar.
Definition: Scalar.h:56
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agx::VectorPOD< Data * > DataPtrVector
Definition: Data.h:76