HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matrixData.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_GF_MATRIX_DATA_H
8 #define PXR_BASE_GF_MATRIX_DATA_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/base/gf/api.h"
12 
14 
15 /// \class GfMatrixData
16 ///
17 /// A class template used by GfMatrixXX to store values.
18 template <class T, int Rows, int Columns>
19 class GfMatrixData {
20 public:
21 
22  /// Return a pointer to a \a row of data.
23  T *operator[](int row) {
24  return _data + (row * Columns);
25  }
26 
27  /// Return a const pointer to a \a row of data.
28  T const *operator[](int row) const {
29  return _data + (row * Columns);
30  }
31 
32  /// Return a pointer to the start of all the data.
33  T *GetData() {
34  return _data;
35  }
36 
37  /// Return a const pointer to the start of all the data.
38  T const *GetData() const {
39  return _data;
40  }
41 
42 private:
43 
44  T _data[Rows * Columns];
45 };
46 
48 
49 #endif // PXR_BASE_GF_MATRIX_DATA_H
T const * operator[](int row) const
Return a const pointer to a row of data.
Definition: matrixData.h:28
T * operator[](int row)
Return a pointer to a row of data.
Definition: matrixData.h:23
T * GetData()
Return a pointer to the start of all the data.
Definition: matrixData.h:33
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
T const * GetData() const
Return a const pointer to the start of all the data.
Definition: matrixData.h:38
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
GLenum GLenum GLsizei void * row
Definition: glad.h:5135