Bridges-C++  3.4.4
Bridges(C++ API)
Classes | Public Member Functions | List of all members
bridges::datastructure::Array3D< E > Class Template Reference

#include <Array3D.h>

Inheritance diagram for bridges::datastructure::Array3D< E >:
bridges::datastructure::Array< E > bridges::datastructure::DataStructure

Detailed Description

template<typename E>
class bridges::datastructure::Array3D< E >

A BRIDGES array type.

This class can be used to create 3D arrays of any type.

The access to the values stored are done directly using bracket operators such as

Array3D<std::string> arr(19, 30, 30);
arr [12][25][12] = "hello!";

Entries in the array can be styled by showing a label and changing the color of an entry. This is achieved by styling the underlying element to a particular entry of the array such as:

Array3D<std::string> arr(19, 30, 3);
arr.getElement(12, 25, 0).setColor("yellow");
arr.getElement(12, 25, 2).setLabel("Hi there");
See also
See tutorial at: https://bridgesuncc.github.io/tutorials/Array.html
Parameters
Ethe application data type
Author
Kalpathi Subramanian
Date
7/16/19

Classes

struct  Bracket_helper
 Bracker_helper class to make [] operators work on array 2d. You should never use it directly. More...
 
struct  Bracket_helper2
 Bracker_helper class to make [][] operators work on array 2d. You should never use it directly. More...
 
struct  Bracket_helper2_const
 helper2 const class is to make [][] operators work on array 2d. You should never use it directly More...
 
struct  Bracket_helper_const
 helper const class is to make [][] operators work on array 2d. You should never use it directly More...
 

Public Member Functions

virtual ~Array3D ()
 
 Array3D (int slices, int rows, int columns)
 
int getNumRows ()
 
int getNumColumns ()
 
int getNumSlices ()
 
Element< E > & getElement (int slice, int row, int col)
 
Element< E > const & getElement (int slice, int row, int col) const
 
void setElement (int slice, int row, int col, Element< E > el)
 
Bracket_helper operator[] (int index)
 enables using the bracket [] operator More...
 
Bracket_helper_const operator[] (int index) const
 helper const class is to make [] operators work on array 2d. You should never use it directly More...
 
- Public Member Functions inherited from bridges::datastructure::Array< E >
virtual const string getDStype () const override
 
virtual const string getDataStructureRepresentation () const override final
 
 Array (const Array &)=delete
 
Arrayoperator= (const Array &)=delete
 
- Public Member Functions inherited from bridges::datastructure::DataStructure
virtual ~DataStructure ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from bridges::datastructure::Array< E >
 Array ()
 
virtual ~Array ()
 
 Array (int sz)
 builds an array given the size More...
 
void setSize (int nd, int *dim)
 Set the size of the array. More...
 
void getDimensions (int *dim)
 Get the dimensions of the array. More...
 
int const * getDimensions () const
 
Element< E > & getElement (int index)
 
Element< E > const & getElement (int index) const
 Get the object at index index - 1D array. More...
 
void setElement (int ind, Element< E > el)
 Set the Element at index ind - 1D array. More...
 

Constructor & Destructor Documentation

◆ ~Array3D()

template<typename E >
virtual bridges::datastructure::Array3D< E >::~Array3D ( )
inlinevirtual

◆ Array3D()

template<typename E >
bridges::datastructure::Array3D< E >::Array3D ( int  slices,
int  rows,
int  columns 
)
inline

builds a 3D array. param slices number of slices (depth) param rows number of rows (height) param columns number of columns (width)

Member Function Documentation

◆ getElement() [1/2]

template<typename E >
Element<E>& bridges::datastructure::Array3D< E >::getElement ( int  slice,
int  row,
int  col 
)
inline

Get the object at (slice, row, col) for 3D arrays

Parameters
slice- slice index
row- row index
col- column index
Returns
Element<E> object at slice, row, col

◆ getElement() [2/2]

template<typename E >
Element<E> const& bridges::datastructure::Array3D< E >::getElement ( int  slice,
int  row,
int  col 
) const
inline

Get the object at (slice, rows, col) for 3D arrays

Parameters
colcolumn index
rowrow index
sliceslice index
Returns
the Element at (slice, rows, col)

◆ getNumColumns()

template<typename E >
int bridges::datastructure::Array3D< E >::getNumColumns ( )
inline

Gets the number of columns of the 3D array

Returns
number of columns

◆ getNumRows()

template<typename E >
int bridges::datastructure::Array3D< E >::getNumRows ( )
inline

Gets the number of rows of the 3D array

Returns
number of rows

◆ getNumSlices()

template<typename E >
int bridges::datastructure::Array3D< E >::getNumSlices ( )
inline

Gets the number of slices of the 3D array

Returns
number of slices

◆ operator[]() [1/2]

template<typename E >
Bracket_helper bridges::datastructure::Array3D< E >::operator[] ( int  index)
inline

enables using the bracket [] operator

◆ operator[]() [2/2]

template<typename E >
Bracket_helper_const bridges::datastructure::Array3D< E >::operator[] ( int  index) const
inline

helper const class is to make [] operators work on array 2d. You should never use it directly

◆ setElement()

template<typename E >
void bridges::datastructure::Array3D< E >::setElement ( int  slice,
int  row,
int  col,
Element< E >  el 
)
inline

Set the object at index slice, row, col - 3D array

Parameters
sliceslice index into the array
colcolumn index into the array
rowrow index into the array
el- Element object

The documentation for this class was generated from the following file: