Main Page
Namespaces
Classes
Files
File List
File Members
include
LowLevel
GteLexicoArray2.h
Go to the documentation of this file.
1
// David Eberly, Geometric Tools, Redmond WA 98052
2
// Copyright (c) 1998-2017
3
// Distributed under the Boost Software License, Version 1.0.
4
// http://www.boost.org/LICENSE_1_0.txt
5
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6
// File Version: 3.0.0 (2016/06/19)
7
8
#pragma once
9
10
#include <
GTEngineDEF.h
>
11
12
namespace
gte
13
{
14
15
// A template class to provide 2D array access that conforms to row-major
16
// order (RowMajor = true) or column-major order (RowMajor = false). The
17
template
<
bool
RowMajor,
typename
Real,
int
... Dimensions>
18
class
LexicoArray2
{};
19
20
// The array dimensions are known only at run time.
21
template
<
typename
Real>
22
class
LexicoArray2
<true, Real>
23
{
24
public
:
25
inline
LexicoArray2
(
int
numRows,
int
numCols, Real*
matrix
);
26
27
inline
int
GetNumRows()
const
;
28
inline
int
GetNumCols()
const
;
29
inline
Real& operator()(
int
r
,
int
c
);
30
inline
Real
const
& operator()(
int
r,
int
c)
const
;
31
32
private
:
33
int
mNumRows
, mNumCols;
34
Real*
mMatrix
;
35
};
36
37
template
<
typename
Real>
38
class
LexicoArray2
<false, Real>
39
{
40
public
:
41
inline
LexicoArray2
(
int
numRows,
int
numCols, Real*
matrix
);
42
43
inline
int
GetNumRows()
const
;
44
inline
int
GetNumCols()
const
;
45
inline
Real& operator()(
int
r
,
int
c
);
46
inline
Real
const
& operator()(
int
r,
int
c)
const
;
47
48
private
:
49
int
mNumRows
, mNumCols;
50
Real*
mMatrix
;
51
};
52
53
// The array dimensions are known at compile time.
54
template
<
typename
Real,
int
NumRows,
int
NumCols>
55
class
LexicoArray2
<true, Real, NumRows, NumCols>
56
{
57
public
:
58
inline
LexicoArray2
(Real*
matrix
);
59
60
inline
int
GetNumRows()
const
;
61
inline
int
GetNumCols()
const
;
62
inline
Real& operator()(
int
r
,
int
c
);
63
inline
Real
const
& operator()(
int
r,
int
c)
const
;
64
65
private
:
66
Real*
mMatrix
;
67
};
68
69
template
<
typename
Real,
int
NumRows,
int
NumCols>
70
class
LexicoArray2
<false, Real, NumRows, NumCols>
71
{
72
public
:
73
inline
LexicoArray2
(Real*
matrix
);
74
75
inline
int
GetNumRows()
const
;
76
inline
int
GetNumCols()
const
;
77
inline
Real& operator()(
int
r
,
int
c
);
78
inline
Real
const
& operator()(
int
r,
int
c)
const
;
79
80
private
:
81
Real*
mMatrix
;
82
};
83
84
85
template
<
typename
Real>
inline
86
LexicoArray2<true, Real>::LexicoArray2
(
int
numRows,
int
numCols, Real*
matrix
)
87
:
88
mNumRows(numRows),
89
mNumCols(numCols),
90
mMatrix(matrix)
91
{
92
}
93
94
template
<
typename
Real>
inline
95
int
LexicoArray2<true, Real>::GetNumRows
()
const
96
{
97
return
mNumRows;
98
}
99
100
template
<
typename
Real>
inline
101
int
LexicoArray2<true, Real>::GetNumCols
()
const
102
{
103
return
mNumCols;
104
}
105
106
template
<
typename
Real>
inline
107
Real&
LexicoArray2<true, Real>::operator()
(
int
r
,
int
c
)
108
{
109
return
mMatrix[c + mNumCols*
r
];
110
}
111
112
template
<
typename
Real>
inline
113
Real
const
&
LexicoArray2<true, Real>::operator()
(
int
r
,
int
c
)
const
114
{
115
return
mMatrix[c + mNumCols*
r
];
116
}
117
118
119
120
template
<
typename
Real>
inline
121
LexicoArray2<false, Real>::LexicoArray2
(
int
numRows,
int
numCols, Real*
matrix
)
122
:
123
mNumRows(numRows),
124
mNumCols(numCols),
125
mMatrix(matrix)
126
{
127
}
128
129
template
<
typename
Real>
inline
130
int
LexicoArray2<false, Real>::GetNumRows
()
const
131
{
132
return
mNumRows;
133
}
134
135
template
<
typename
Real>
inline
136
int
LexicoArray2<false, Real>::GetNumCols
()
const
137
{
138
return
mNumCols;
139
}
140
141
template
<
typename
Real>
inline
142
Real&
LexicoArray2<false, Real>::operator()
(
int
r
,
int
c
)
143
{
144
return
mMatrix[r + mNumRows*
c
];
145
}
146
147
template
<
typename
Real>
inline
148
Real
const
&
LexicoArray2<false, Real>::operator()
(
int
r
,
int
c
)
const
149
{
150
return
mMatrix[r + mNumRows*
c
];
151
}
152
153
154
155
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
156
LexicoArray2<true, Real, NumRows, NumCols>::LexicoArray2
(Real*
matrix
)
157
:
158
mMatrix(matrix)
159
{
160
}
161
162
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
163
int
LexicoArray2<true, Real, NumRows, NumCols>::GetNumRows
()
const
164
{
165
return
NumRows;
166
}
167
168
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
169
int
LexicoArray2<true, Real, NumRows, NumCols>::GetNumCols
()
const
170
{
171
return
NumCols;
172
}
173
174
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
175
Real&
LexicoArray2<true, Real, NumRows, NumCols>::operator()
(
int
r
,
int
c
)
176
{
177
return
mMatrix[c + NumCols*
r
];
178
}
179
180
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
181
Real
const
&
LexicoArray2<true, Real, NumRows, NumCols>::operator()
(
int
r
,
int
c
)
const
182
{
183
return
mMatrix[c + NumCols*
r
];
184
}
185
186
187
188
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
189
LexicoArray2<false, Real, NumRows, NumCols>::LexicoArray2
(Real*
matrix
)
190
:
191
mMatrix(matrix)
192
{
193
}
194
195
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
196
int
LexicoArray2<false, Real, NumRows, NumCols>::GetNumRows
()
const
197
{
198
return
NumRows;
199
}
200
201
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
202
int
LexicoArray2<false, Real, NumRows, NumCols>::GetNumCols
()
const
203
{
204
return
NumCols;
205
}
206
207
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
208
Real&
LexicoArray2<false, Real, NumRows, NumCols>::operator()
(
int
r
,
int
c
)
209
{
210
return
mMatrix[r + NumRows*
c
];
211
}
212
213
template
<
typename
Real,
int
NumRows,
int
NumCols>
inline
214
Real
const
&
LexicoArray2<false, Real, NumRows, NumCols>::operator()
(
int
r
,
int
c
)
const
215
{
216
return
mMatrix[r + NumRows*
c
];
217
}
218
219
}
matrix
GLuint GLenum matrix
Definition:
glext.h:10574
GTEngineDEF.h
gte::LexicoArray2< false, Real >::mNumRows
int mNumRows
Definition:
GteLexicoArray2.h:49
gte::LexicoArray2< true, Real >::mMatrix
Real * mMatrix
Definition:
GteLexicoArray2.h:34
c
const GLubyte * c
Definition:
glext.h:11671
gte::LexicoArray2
Definition:
GteLexicoArray2.h:18
gte
Definition:
GLX/GteWICFileIO.h:16
gte::LexicoArray2< true, Real >::mNumRows
int mNumRows
Definition:
GteLexicoArray2.h:33
gte::LexicoArray2< false, Real, NumRows, NumCols >::mMatrix
Real * mMatrix
Definition:
GteLexicoArray2.h:81
gte::LexicoArray2< false, Real >::mMatrix
Real * mMatrix
Definition:
GteLexicoArray2.h:50
r
GLboolean r
Definition:
glcorearb.h:1217
gte::LexicoArray2< true, Real, NumRows, NumCols >::mMatrix
Real * mMatrix
Definition:
GteLexicoArray2.h:66
geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00