8 namespace datastructure {
44 int num_slices, num_rows, num_cols;
48 num_slices = num_rows = num_cols = 0;
61 Array3D(
int slices,
int rows,
int columns)
62 : num_slices(slices), num_rows(rows), num_cols(columns) {
63 int dim[] = {slices, rows, columns};
126 setElement(slice * num_rows * num_cols + row * num_cols + col, el);
140 return arr.getElement(
x,
y, z).getValue();
174 return arr.getElement(
x,
y, z).getValue();
A BRIDGES array type.
Definition: Array3D.h:42
Bracket_helper operator[](int index)
enables using the bracket [] operator
Definition: Array3D.h:159
Element< E > & getElement(int slice, int row, int col)
Definition: Array3D.h:98
int getNumRows()
Definition: Array3D.h:70
Element< E > const & getElement(int slice, int row, int col) const
Definition: Array3D.h:112
void setElement(int slice, int row, int col, Element< E > el)
Definition: Array3D.h:125
int getNumColumns()
Definition: Array3D.h:77
int getNumSlices()
Definition: Array3D.h:84
Array3D(int slices, int rows, int columns)
Definition: Array3D.h:61
virtual ~Array3D()
Definition: Array3D.h:52
The foundation of BRIDGES array types. It is not meant to be used directly by students.
Definition: Array.h:21
void setSize(int nd, int *dim)
Set the size of the array.
Definition: Array.h:57
Element< E > & getElement(int index)
Definition: Array.h:108
This is the fundamental building block for all data structures in BRIDGES.
Definition: Element.h:51
Support for drawing Bar charts.
Definition: alltypes.h:4
helper2 const class is to make [][] operators work on array 2d. You should never use it directly
Definition: Array3D.h:167
Bracket_helper2_const(Array3D< E > &a, int x, int y)
Definition: Array3D.h:171
E const & operator[](int z) const
Definition: Array3D.h:173
int y
Definition: Array3D.h:170
Array3D< E > const & arr
Definition: Array3D.h:168
int x
Definition: Array3D.h:169
Bracker_helper class to make [][] operators work on array 2d. You should never use it directly.
Definition: Array3D.h:133
int y
Definition: Array3D.h:136
Array3D< E > & arr
Definition: Array3D.h:134
E & operator[](int z)
Definition: Array3D.h:139
Bracket_helper2(Array3D< E > &a, int x, int y)
Definition: Array3D.h:137
int x
Definition: Array3D.h:135
helper const class is to make [][] operators work on array 2d. You should never use it directly
Definition: Array3D.h:183
Bracket_helper2_const operator[](int y) const
Definition: Array3D.h:188
Bracket_helper_const(Array3D< E > &a, int x)
Definition: Array3D.h:186
int x
Definition: Array3D.h:185
Array3D< E > const & arr
Definition: Array3D.h:184
Bracker_helper class to make [] operators work on array 2d. You should never use it directly.
Definition: Array3D.h:148
Bracket_helper(Array3D< E > &a, int x)
Definition: Array3D.h:151
Array3D< E > & arr
Definition: Array3D.h:149
int x
Definition: Array3D.h:150
Bracket_helper2 operator[](int y)
Definition: Array3D.h:153