Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
core::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.fwd.hh>

Collaboration diagram for core::graph::Array0< T >:
Collaboration graph
[legend]

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 ()
 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...
 
T & operator[] (platform::Size index)
 Accessors and mutators. More...
 
T const & operator[] (platform::Size index) const
 
T & operator[] (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

T * array_
 
platform::Size size_
 

Detailed Description

template<class T>
class core::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.

Definition at line 24 of file ArrayPool.fwd.hh.

Constructor & Destructor Documentation

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

Default ctor points at null.

Definition at line 43 of file ArrayPool.hh.

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

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

Definition at line 49 of file ArrayPool.hh.

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

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

Definition at line 55 of file ArrayPool.hh.

template<class T>
core::graph::Array0< T >::~Array0 ( )
inline

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.

Definition at line 72 of file ArrayPool.hh.

Member Function Documentation

template<class T>
bool core::graph::Array0< T >::bounds_check ( platform::Size  index) const
inlineprivate

Definition at line 102 of file ArrayPool.hh.

Referenced by core::graph::Array0< Real >::operator[]().

template<class T>
bool core::graph::Array0< T >::bounds_check ( int  index) const
inlineprivate

Definition at line 107 of file ArrayPool.hh.

template<class T>
Array0< T > const& core::graph::Array0< T >::operator= ( Array0< T > const &  rhs)
inline

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

Definition at line 62 of file ArrayPool.hh.

template<class T>
T& core::graph::Array0< T >::operator[] ( platform::Size  index)
inline

Accessors and mutators.

Definition at line 77 of file ArrayPool.hh.

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

Definition at line 82 of file ArrayPool.hh.

template<class T>
T& core::graph::Array0< T >::operator[] ( int  index)
inline

Definition at line 87 of file ArrayPool.hh.

template<class T>
T const& core::graph::Array0< T >::operator[] ( int  index) const
inline

Definition at line 92 of file ArrayPool.hh.

template<class T>
platform::Size core::graph::Array0< T >::size ( ) const
inline

Definition at line 97 of file ArrayPool.hh.

Member Data Documentation

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

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