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

#include <Array1D.h>

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

Detailed Description

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

A BRIDGES 1D array type.

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

The class stores an array of E where each entry can be styled.

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

Array1D<std::string> arr(19);
arr [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:

Array1D<std::string> arr(19);
arr.getElement(12).setColor("yellow");
arr.getElement(12).setLabel("Hi there");

The array support range for loop so you can get to all elements in the array using :

Array1D<std::string> arr(19);
for (auto mystring : arr) {
std::cout<<mystring<<"\n";
}
See also
See tutorial at: https://bridgesuncc.github.io/tutorials/Array.html
Parameters
Ethe application data type
Author
Kalpathi Subramanian, Erik Saule
Date
7/16/19

Classes

class  const_iterator
 enabling iterator loops in const contexts More...
 
class  iterator
 enabling range for loops More...
 

Public Member Functions

virtual ~Array1D ()
 
 Array1D (int sz)
 builds an array given size More...
 
E & operator[] (int indx)
 access Array[indx] More...
 
E const & operator[] (int indx) const
 access Array[indx] More...
 
Element< E > & getElement (int indx)
 access the element that stores Array[indx] More...
 
Element< E > const & getElement (int indx) const
 access the element that stores Array[indx] More...
 
void setElement (int indx, const Element< E > &e)
 change the element that stores Array[indx] More...
 
iterator begin ()
 enables range for loops More...
 
iterator end ()
 enables range for loops More...
 
const_iterator begin () const
 enables range for loops More...
 
const_iterator end () const
 enables range for loops 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

◆ ~Array1D()

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

◆ Array1D()

template<typename E >
bridges::datastructure::Array1D< E >::Array1D ( int  sz)
inline

builds an array given size

Parameters
szsize of the array

Member Function Documentation

◆ begin() [1/2]

template<typename E >
iterator bridges::datastructure::Array1D< E >::begin ( )
inline

enables range for loops

◆ begin() [2/2]

template<typename E >
const_iterator bridges::datastructure::Array1D< E >::begin ( ) const
inline

enables range for loops

◆ end() [1/2]

template<typename E >
iterator bridges::datastructure::Array1D< E >::end ( )
inline

enables range for loops

◆ end() [2/2]

template<typename E >
const_iterator bridges::datastructure::Array1D< E >::end ( ) const
inline

enables range for loops

◆ getElement() [1/2]

template<typename E >
Element<E>& bridges::datastructure::Array1D< E >::getElement ( int  indx)
inline

access the element that stores Array[indx]

Parameters
indxindex of the Element<E> to access

◆ getElement() [2/2]

template<typename E >
Element<E> const& bridges::datastructure::Array1D< E >::getElement ( int  indx) const
inline

access the element that stores Array[indx]

Parameters
indxindex of the Element<E> to access

◆ operator[]() [1/2]

template<typename E >
E& bridges::datastructure::Array1D< E >::operator[] ( int  indx)
inline

access Array[indx]

◆ operator[]() [2/2]

template<typename E >
E const& bridges::datastructure::Array1D< E >::operator[] ( int  indx) const
inline

access Array[indx]

◆ setElement()

template<typename E >
void bridges::datastructure::Array1D< E >::setElement ( int  indx,
const Element< E > &  e 
)
inline

change the element that stores Array[indx]

Parameters
indxindex of the Element<E> to change
eelement to change it to

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