Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
utility::graph::Array0< T > Class Template Reference

Class Array0 is a c-style array wrapper that does bounds checking in debug mode. It indexes from 0 just like regular c-arrays. Class Array0 does not manage it's own memory. It does not allocate memory if you want to make it larger, nor does it deallocate memory when you destroy it. Bounds checking only ensures that the user does not go outside of the memory Array0 thinks it's in charge of. If the user should happen to point the array0 at memory that has not been allocated, Array0 is not responsible for segmentation fault that will likely occur. Garbage in, garbage out. More...

#include <ArrayPool.hh>

Public Member Functions

 Array0 ()
 Default ctor points at null. More...
 
 Array0 (T *mem_begin, platform::Size size)
 Array and size constructor – point this Array0 at a block of memory. More...
 
 Array0 (Array0< T > const &other)
 Copy constructor – point this Array0 at a block of memory. More...
 
Array0< T > const & operator= (Array0< T > const &rhs)
 Assignment operator – point this Array0 at a different block of memory. More...
 
 ~Array0 ()=default
 The destructor does not deallocate the memory that this Array0 points at. That is the responsibility of some other class. Array0 is for bounds checking only. More...
 
Toperator[] (platform::Size index)
 Accessors and mutators. More...
 
T const & operator[] (platform::Size index) const
 
Toperator[] (int index)
 
T const & operator[] (int index) const
 
platform::Size size () const
 

Private Member Functions

bool bounds_check (platform::Size index) const
 
bool bounds_check (int index) const
 

Private Attributes

Tarray_
 
platform::Size size_
 

Detailed Description

template<class T>
class utility::graph::Array0< T >

Class Array0 is a c-style array wrapper that does bounds checking in debug mode. It indexes from 0 just like regular c-arrays. Class Array0 does not manage it's own memory. It does not allocate memory if you want to make it larger, nor does it deallocate memory when you destroy it. Bounds checking only ensures that the user does not go outside of the memory Array0 thinks it's in charge of. If the user should happen to point the array0 at memory that has not been allocated, Array0 is not responsible for segmentation fault that will likely occur. Garbage in, garbage out.

Constructor & Destructor Documentation

template<class T >
utility::graph::Array0< T >::Array0 ( )
inline

Default ctor points at null.

template<class T >
utility::graph::Array0< T >::Array0 ( T mem_begin,
platform::Size  size 
)
inline

Array and size constructor – point this Array0 at a block of memory.

template<class T >
utility::graph::Array0< T >::Array0 ( Array0< T > const &  other)
inline

Copy constructor – point this Array0 at a block of memory.

template<class T >
utility::graph::Array0< T >::~Array0 ( )
default

The destructor does not deallocate the memory that this Array0 points at. That is the responsibility of some other class. Array0 is for bounds checking only.

Member Function Documentation

template<class T >
bool utility::graph::Array0< T >::bounds_check ( platform::Size  index) const
inlineprivate
template<class T >
bool utility::graph::Array0< T >::bounds_check ( int  index) const
inlineprivate
template<class T >
Array0< T > const& utility::graph::Array0< T >::operator= ( Array0< T > const &  rhs)
inline

Assignment operator – point this Array0 at a different block of memory.

References utility::graph::Array0< T >::array_, and utility::graph::Array0< T >::size_.

template<class T >
T& utility::graph::Array0< T >::operator[] ( platform::Size  index)
inline
template<class T >
T const& utility::graph::Array0< T >::operator[] ( platform::Size  index) const
inline
template<class T >
T& utility::graph::Array0< T >::operator[] ( int  index)
inline
template<class T >
T const& utility::graph::Array0< T >::operator[] ( int  index) const
inline
template<class T >
platform::Size utility::graph::Array0< T >::size ( ) const
inline

Member Data Documentation

template<class T >
T* utility::graph::Array0< T >::array_
private
template<class T >
platform::Size utility::graph::Array0< T >::size_
private

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