SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Friends | List of all members
slip::Pyramid< Container > Class Template Reference

This is container to handle a pyramid of containers. More...

#include <Pyramid.hpp>

Public Types

typedef Container value_type
 
typedef Pyramid< Container > self
 
typedef const Pyramid< Container > const_self
 
typedef value_typereference
 
typedef value_type const & const_reference
 
typedef value_typepointer
 
typedef value_type const * const_pointer
 
typedef ptrdiff_t difference_type
 
typedef std::size_t size_type
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 

Public Member Functions

size_type size () const
 Returns the number of containers in the Pyramid. More...
 
size_type max_size () const
 Returns the maximal size (number of container) in the Pyramid. More...
 
bool empty () const
 Returns true if the Pyramid is empty. (Thus size() == 0) More...
 
void swap (self &rhs)
 Swaps data with another Pyramid. More...
 
void fill (const typename Container::value_type &val)
 Fill all the container of the Pyramid with val. More...
 
Constructors & Destructors
 Pyramid ()
 Constructs a Pyramid with no data and zero levels. More...
 
template<typename Iterator >
 Pyramid (Iterator init_container_first, Iterator init_container_last, const size_type levels)
 Constructs a Pyramid of levels level and copy the finest level (0 level) with the range [init_container_first, init_container_last). All other levels are initialized with the default constructor of the Container elements. More...
 
 Pyramid (const self &rhs)
 Constructs a copy of the Pyramid rhs. More...
 
 ~Pyramid ()
 Destructor of the Pyramid. More...
 
Assignment operators
selfoperator= (const self &rhs)
 Assigns rhs to the Pyramid. More...
 
Accessors
size_type levels () const
 
const slip::Array< size_type > & base_size () const
 
Element access operators
reference operator[] (const size_type n)
 Subscript access to the data contained in the Pyramid. More...
 
const_reference operator[] (const size_type n) const
 Subscript access to the data contained in the Pyramid. More...
 

Friends

class boost::serialization::access
 
i/o operators
std::ostream & operator<< (std::ostream &out, const self &a)
 Write the Pyramid to the ouput stream. More...
 
Comparison operators
bool operator== (const Array< Container > &x, const Array< Container > &y)
 Array equality comparison More...
 
bool operator!= (const Array< Container > &x, const Array< Container > &y)
 Array inequality comparison More...
 

Detailed Description

template<typename Container>
class slip::Pyramid< Container >

This is container to handle a pyramid of containers.

Author
Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>
Version
0.0.2
Date
2014/04/02
Since
1.2.0
Parameters
ContainerType of the element in the Pyramid
Todo:
add iterators, add comparison operators to be complient with the Container concept

Definition at line 485 of file Pyramid.hpp.

Member Typedef Documentation

template<typename Container>
typedef const_pointer slip::Pyramid< Container >::const_iterator

Definition at line 529 of file Pyramid.hpp.

template<typename Container>
typedef value_type const* slip::Pyramid< Container >::const_pointer

Definition at line 522 of file Pyramid.hpp.

template<typename Container>
typedef value_type const& slip::Pyramid< Container >::const_reference

Definition at line 519 of file Pyramid.hpp.

template<typename Container>
typedef const Pyramid<Container> slip::Pyramid< Container >::const_self

Definition at line 516 of file Pyramid.hpp.

template<typename Container>
typedef ptrdiff_t slip::Pyramid< Container >::difference_type

Definition at line 525 of file Pyramid.hpp.

template<typename Container>
typedef pointer slip::Pyramid< Container >::iterator

Definition at line 528 of file Pyramid.hpp.

template<typename Container>
typedef value_type* slip::Pyramid< Container >::pointer

Definition at line 521 of file Pyramid.hpp.

template<typename Container>
typedef value_type& slip::Pyramid< Container >::reference

Definition at line 518 of file Pyramid.hpp.

template<typename Container>
typedef Pyramid<Container> slip::Pyramid< Container >::self

Definition at line 515 of file Pyramid.hpp.

template<typename Container>
typedef std::size_t slip::Pyramid< Container >::size_type

Definition at line 526 of file Pyramid.hpp.

template<typename Container>
typedef Container slip::Pyramid< Container >::value_type

Definition at line 514 of file Pyramid.hpp.

Constructor & Destructor Documentation

template<typename Container>
slip::Pyramid< Container >::Pyramid ( )
inline

Constructs a Pyramid with no data and zero levels.

Definition at line 539 of file Pyramid.hpp.

template<typename Container>
template<typename Iterator >
slip::Pyramid< Container >::Pyramid ( Iterator  init_container_first,
Iterator  init_container_last,
const size_type  levels 
)
inline

Constructs a Pyramid of levels level and copy the finest level (0 level) with the range [init_container_first, init_container_last). All other levels are initialized with the default constructor of the Container elements.

Parameters
init_container_firstinitial container
init_container_lastinitial container
levels
Precondition
sizes of the range should be powers of 2
slip::power(2,levels-1) <= sizes
Example:
slip::Array2d<float> init2d(16,16);
slip::iota(init2d.begin(),init2d.end(),1.0,1.0);
slip::Pyramid<slip::Array2d<float> > pyd2d(init2d.upper_left(),
init2d.bottom_right(),
3);
std::cout<<pyd2d<<std::endl;

Definition at line 567 of file Pyramid.hpp.

template<typename Container>
slip::Pyramid< Container >::Pyramid ( const self rhs)
inline

Constructs a copy of the Pyramid rhs.

Definition at line 597 of file Pyramid.hpp.

template<typename Container>
slip::Pyramid< Container >::~Pyramid ( )
inline

Destructor of the Pyramid.

Definition at line 613 of file Pyramid.hpp.

Member Function Documentation

template<typename Container>
const slip::Array<size_type>& slip::Pyramid< Container >::base_size ( ) const
inline

Definition at line 665 of file Pyramid.hpp.

template<typename Container>
bool slip::Pyramid< Container >::empty ( ) const
inline

Returns true if the Pyramid is empty. (Thus size() == 0)

Definition at line 744 of file Pyramid.hpp.

template<typename Container>
void slip::Pyramid< Container >::fill ( const typename Container::value_type &  val)
inline

Fill all the container of the Pyramid with val.

Parameters
valValue to fill

Definition at line 766 of file Pyramid.hpp.

template<typename Container>
size_type slip::Pyramid< Container >::levels ( ) const
inline

Definition at line 660 of file Pyramid.hpp.

template<typename Container>
size_type slip::Pyramid< Container >::max_size ( ) const
inline

Returns the maximal size (number of container) in the Pyramid.

Definition at line 736 of file Pyramid.hpp.

template<typename Container>
self& slip::Pyramid< Container >::operator= ( const self rhs)
inline

Assigns rhs to the Pyramid.

Parameters
rhsPyramid to get the values from.
Returns

Definition at line 631 of file Pyramid.hpp.

template<typename Container>
reference slip::Pyramid< Container >::operator[] ( const size_type  n)
inline

Subscript access to the data contained in the Pyramid.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.
Precondition
n < levels()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

Definition at line 687 of file Pyramid.hpp.

template<typename Container>
const_reference slip::Pyramid< Container >::operator[] ( const size_type  n) const
inline

Subscript access to the data contained in the Pyramid.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Precondition
n < levels()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

Definition at line 705 of file Pyramid.hpp.

template<typename Container>
size_type slip::Pyramid< Container >::size ( ) const
inline

Returns the number of containers in the Pyramid.

Definition at line 729 of file Pyramid.hpp.

template<typename Container>
void slip::Pyramid< Container >::swap ( self rhs)
inline

Swaps data with another Pyramid.

Parameters
rhsA Pyramid of the same element type

Definition at line 753 of file Pyramid.hpp.

Friends And Related Function Documentation

template<typename Container>
friend class boost::serialization::access
friend

Definition at line 819 of file Pyramid.hpp.

template<typename Container>
bool operator!= ( const Array< Container > &  x,
const Array< Container > &  y 
)
friend

Array inequality comparison

Parameters
xA Array
yA Array of the same type of x
Returns
true if !(x == y)
template<typename Container>
std::ostream& operator<< ( std::ostream &  out,
const self a 
)
friend

Write the Pyramid to the ouput stream.

Parameters
outoutput std::ostream
aPyramid to write to the output stream

Definition at line 868 of file Pyramid.hpp.

template<typename Container>
bool operator== ( const Array< Container > &  x,
const Array< Container > &  y 
)
friend

Array equality comparison

Parameters
xA Array
yA Array of the same type of x
Returns
true iff the size and the elements of the Arrays are equal

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