SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
slip::block< T, N > Struct Template Reference

This is a linear (one-dimensional) static container. This container statisfies the RandomAccessContainer concepts of the Standard Template Library (STL). More...

#include <Block.hpp>

Inheritance diagram for slip::block< T, N >:
Inheritance graph

Public Types

typedef block< T, N > self
 
typedef T value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef ptrdiff_t difference_type
 
typedef std::size_t size_type
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 
typedef slip::stride_iterator
< pointer
iterator_range
 
typedef slip::stride_iterator
< const_pointer
const_iterator_range
 
typedef std::reverse_iterator
< iterator
reverse_iterator
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 
typedef std::reverse_iterator
< iterator_range
reverse_iterator_range
 
typedef std::reverse_iterator
< const_iterator_range
const_reverse_iterator_range
 
typedef iterator default_iterator
 
typedef const_iterator const_default_iterator
 

Public Member Functions

size_type size () const
 Returns the number of elements in the block. More...
 
size_type max_size () const
 Returns the largest possible block. More...
 
bool empty () const
 Returns true if the block is empty. (Thus size == 0) More...
 
void swap (block &x)
 Swaps data with another block. More...
 
iterators
iterator begin ()
 Returns a read/write iterator that points to the first element in the block. Iteration is done in ordinary element order. More...
 
const_iterator begin () const
 Returns a read-only (constant) iterator that points to the first element in the block. Iteration is done in ordinary element order. More...
 
iterator end ()
 Returns a read/write iterator that points one past the last element in the block. Iteration is done in ordinary element order. More...
 
const_iterator end () const
 Returns a read-only (constant) iterator that points one past the last element in the block. Iteration is done in ordinary element order. More...
 
reverse_iterator rbegin ()
 Returns a read/write reverse iterator that points to the last element in the block. Iteration is done in reverse element order. More...
 
const_reverse_iterator rbegin () const
 Returns a read-only (constant) reverse iterator that points to the last element in the block. Iteration is done in reverse element order. More...
 
reverse_iterator rend ()
 Returns a read/write reverse iterator that points to one before the first element in the block. Iteration is done in reverse element order. More...
 
const_reverse_iterator rend () const
 Returns a read-only (constant) reverse iterator that points to one before the first element in the block. Iteration is done in reverse element order. More...
 
iterator_range begin (const slip::Range< int > &range)
 Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More...
 
const_iterator_range begin (const slip::Range< int > &range) const
 Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More...
 
iterator_range end (const slip::Range< int > &range)
 Returns a read/write iterator_range that points one past the last element in the block. Iteration is done in ordinary element order according to the Range. More...
 
const_iterator_range end (const slip::Range< int > &range) const
 Returns a read-only (constant) iterator_range that points one past the last element in the block. Iteration is done in ordinary element order according to the Range. More...
 
reverse_iterator_range rbegin (const slip::Range< int > &range)
 Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More...
 
const_reverse_iterator_range rbegin (const slip::Range< int > &range) const
 Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More...
 
reverse_iterator_range rend (const slip::Range< int > &range)
 Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More...
 
const_reverse_iterator_range rend (const slip::Range< int > &range) const
 Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More...
 
Assignment methods
block< T, N > & operator= (const block< T, N > &rhs)
 Assigns all the element of the block by the block rhs. More...
 
block< T, N > & operator= (const T &val)
 Assigns all the element of the block by val. More...
 
void fill (const T &value)
 Fills the container range [begin(),begin()+N) with copies of value. More...
 
void fill (const T *value)
 Fills the container range [begin(),begin()+N) with a copy of the value array. More...
 
template<typename InputIterator >
void fill (InputIterator first, InputIterator last)
 Fills the container range [begin(),begin()+N) with a copy of the range [first,last) More...
 
Element access operators
reference operator[] (const size_type n)
 Subscript access to the data contained in the block. More...
 
const_reference operator[] (const size_type n) const
 Subscript access to the data contained in the block. More...
 
reference operator() (const size_type n)
 Subscript access to the data contained in the block. More...
 
const_reference operator() (const size_type n) const
 Subscript access to the data contained in the block. More...
 

Public Attributes

data [N]
 Data array storage of the block. More...
 

Static Public Attributes

static const std::size_t SIZE = N
 
static const std::size_t DIM = 1
 

Friends

class boost::serialization::access
 
i/o operators
std::ostream & operator<< (std::ostream &out, const block< T, N > &b)
 Write the block to an ouput stream. More...
 
Comparison operators
bool operator== (const block< T, N > &x, const block< T, N > &y)
 Block equality comparison. More...
 
bool operator!= (const block< T, N > &x, const block< T, N > &y)
 Block inequality comparison. More...
 
bool operator< (const block< T, N > &x, const block< T, N > &y)
 Less than comparison operator (block ordering relation) More...
 
bool operator> (const block< T, N > &x, const block< T, N > &y)
 More than comparison operator. More...
 
bool operator<= (const block< T, N > &x, const block< T, N > &y)
 Less than equal comparison operator. More...
 
bool operator>= (const block< T, N > &x, const block< T, N > &y)
 More than equal comparison operator. More...
 

Detailed Description

template<class T, std::size_t N>
struct slip::block< T, N >

This is a linear (one-dimensional) static container. This container statisfies the RandomAccessContainer concepts of the Standard Template Library (STL).

Author
Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>
Version
0.0.3
Date
2014/03/15
Since
1.0.0
Parameters
TType of the element in the block
Nnumber of element in the block
Examples:
color_edge_detection.cpp, edge_detection.cpp, and statistics_example.cpp.

Definition at line 94 of file Block.hpp.

Member Typedef Documentation

template<class T, std::size_t N>
typedef const_iterator slip::block< T, N >::const_default_iterator

Definition at line 170 of file Block.hpp.

template<class T, std::size_t N>
typedef const_pointer slip::block< T, N >::const_iterator

Definition at line 157 of file Block.hpp.

template<class T, std::size_t N>
typedef slip::stride_iterator<const_pointer> slip::block< T, N >::const_iterator_range

Definition at line 160 of file Block.hpp.

template<class T, std::size_t N>
typedef const value_type* slip::block< T, N >::const_pointer

Definition at line 149 of file Block.hpp.

template<class T, std::size_t N>
typedef const value_type& slip::block< T, N >::const_reference

Definition at line 151 of file Block.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<const_iterator> slip::block< T, N >::const_reverse_iterator

Definition at line 163 of file Block.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<const_iterator_range> slip::block< T, N >::const_reverse_iterator_range

Definition at line 166 of file Block.hpp.

template<class T, std::size_t N>
typedef iterator slip::block< T, N >::default_iterator

Definition at line 169 of file Block.hpp.

template<class T, std::size_t N>
typedef ptrdiff_t slip::block< T, N >::difference_type

Definition at line 153 of file Block.hpp.

template<class T, std::size_t N>
typedef pointer slip::block< T, N >::iterator

Definition at line 156 of file Block.hpp.

template<class T, std::size_t N>
typedef slip::stride_iterator<pointer> slip::block< T, N >::iterator_range

Definition at line 159 of file Block.hpp.

template<class T, std::size_t N>
typedef value_type* slip::block< T, N >::pointer

Definition at line 148 of file Block.hpp.

template<class T, std::size_t N>
typedef value_type& slip::block< T, N >::reference

Definition at line 150 of file Block.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<iterator> slip::block< T, N >::reverse_iterator

Definition at line 162 of file Block.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<iterator_range> slip::block< T, N >::reverse_iterator_range

Definition at line 165 of file Block.hpp.

template<class T, std::size_t N>
typedef block<T,N> slip::block< T, N >::self

Definition at line 146 of file Block.hpp.

template<class T, std::size_t N>
typedef std::size_t slip::block< T, N >::size_type

Definition at line 154 of file Block.hpp.

template<class T, std::size_t N>
typedef T slip::block< T, N >::value_type

Definition at line 147 of file Block.hpp.

Member Function Documentation

template<class T, std::size_t N>
iterator slip::block< T, N >::begin ( )
inline

Returns a read/write iterator that points to the first element in the block. Iteration is done in ordinary element order.

Returns
begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 189 of file Block.hpp.

template<class T, std::size_t N>
const_iterator slip::block< T, N >::begin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the block. Iteration is done in ordinary element order.

Returns
const begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 200 of file Block.hpp.

template<class T, std::size_t N>
iterator_range slip::block< T, N >::begin ( const slip::Range< int > &  range)
inline

Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 281 of file Block.hpp.

template<class T, std::size_t N>
const_iterator_range slip::block< T, N >::begin ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 309 of file Block.hpp.

template<class T, std::size_t N>
bool slip::block< T, N >::empty ( ) const
inline

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

Definition at line 679 of file Block.hpp.

template<class T, std::size_t N>
iterator slip::block< T, N >::end ( )
inline

Returns a read/write iterator that points one past the last element in the block. Iteration is done in ordinary element order.

Returns
end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 210 of file Block.hpp.

template<class T, std::size_t N>
const_iterator slip::block< T, N >::end ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the block. Iteration is done in ordinary element order.

Returns
const end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 220 of file Block.hpp.

template<class T, std::size_t N>
iterator_range slip::block< T, N >::end ( const slip::Range< int > &  range)
inline

Returns a read/write iterator_range that points one past the last element in the block. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 336 of file Block.hpp.

template<class T, std::size_t N>
const_iterator_range slip::block< T, N >::end ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) iterator_range that points one past the last element in the block. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 359 of file Block.hpp.

template<class T, std::size_t N>
void slip::block< T, N >::fill ( const T &  value)
inline

Fills the container range [begin(),begin()+N) with copies of value.

Parameters
valueA reference-to-const of arbitrary type.

Definition at line 512 of file Block.hpp.

template<class T, std::size_t N>
void slip::block< T, N >::fill ( const T *  value)
inline

Fills the container range [begin(),begin()+N) with a copy of the value array.

Parameters
valueA pointer of arbitrary type.

Definition at line 522 of file Block.hpp.

template<class T, std::size_t N>
template<typename InputIterator >
void slip::block< T, N >::fill ( InputIterator  first,
InputIterator  last 
)
inline

Fills the container range [begin(),begin()+N) with a copy of the range [first,last)

Parameters
firstAn input iterator.
lastAn input iterator.

Definition at line 536 of file Block.hpp.

template<class T, std::size_t N>
size_type slip::block< T, N >::max_size ( ) const
inline

Returns the largest possible block.

Definition at line 674 of file Block.hpp.

template<class T, std::size_t N>
reference slip::block< T, N >::operator() ( const size_type  n)
inline

Subscript access to the data contained in the block.

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

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 646 of file Block.hpp.

template<class T, std::size_t N>
const_reference slip::block< T, N >::operator() ( const size_type  n) const
inline

Subscript access to the data contained in the block.

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

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 660 of file Block.hpp.

template<class T, std::size_t N>
block<T,N>& slip::block< T, N >::operator= ( const block< T, N > &  rhs)
inline

Assigns all the element of the block by the block rhs.

Parameters
rhsblock<T,N>
Returns
reference to corresponding block

Definition at line 488 of file Block.hpp.

template<class T, std::size_t N>
block<T,N>& slip::block< T, N >::operator= ( const T &  val)
inline

Assigns all the element of the block by val.

Parameters
valaffectation value
Returns
reference to corresponding block

Definition at line 502 of file Block.hpp.

template<class T, std::size_t N>
reference slip::block< T, N >::operator[] ( const size_type  n)
inline

Subscript access to the data contained in the block.

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

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 620 of file Block.hpp.

template<class T, std::size_t N>
const_reference slip::block< T, N >::operator[] ( const size_type  n) const
inline

Subscript access to the data contained in the block.

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

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 633 of file Block.hpp.

template<class T, std::size_t N>
reverse_iterator slip::block< T, N >::rbegin ( )
inline

Returns a read/write reverse iterator that points to the last element in the block. Iteration is done in reverse element order.

Returns
reverse begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 230 of file Block.hpp.

template<class T, std::size_t N>
const_reverse_iterator slip::block< T, N >::rbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the block. Iteration is done in reverse element order.

Returns
const reverse begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 240 of file Block.hpp.

template<class T, std::size_t N>
reverse_iterator_range slip::block< T, N >::rbegin ( const slip::Range< int > &  range)
inline

Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 383 of file Block.hpp.

template<class T, std::size_t N>
const_reverse_iterator_range slip::block< T, N >::rbegin ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
cons_treverse__iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 406 of file Block.hpp.

template<class T, std::size_t N>
reverse_iterator slip::block< T, N >::rend ( )
inline

Returns a read/write reverse iterator that points to one before the first element in the block. Iteration is done in reverse element order.

Returns
reverse end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 250 of file Block.hpp.

template<class T, std::size_t N>
const_reverse_iterator slip::block< T, N >::rend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the block. Iteration is done in reverse element order.

Returns
const reverse end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 261 of file Block.hpp.

template<class T, std::size_t N>
reverse_iterator_range slip::block< T, N >::rend ( const slip::Range< int > &  range)
inline

Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 429 of file Block.hpp.

template<class T, std::size_t N>
const_reverse_iterator_range slip::block< T, N >::rend ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_reverse_iterator_range value
Precondition
The range must be inside the whole range of the block.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 452 of file Block.hpp.

template<class T, std::size_t N>
size_type slip::block< T, N >::size ( ) const
inline

Returns the number of elements in the block.

Definition at line 669 of file Block.hpp.

template<class T, std::size_t N>
void slip::block< T, N >::swap ( block< T, N > &  x)
inline

Swaps data with another block.

Parameters
xA block of the same element type
Precondition
[x.begin(),x.begin()+(end() - begin())) is a valid range
[begin(),end()) do not overlap [x.begin(),x.begin()+(end() - begin()))

Definition at line 688 of file Block.hpp.

Friends And Related Function Documentation

template<class T, std::size_t N>
friend class boost::serialization::access
friend

Definition at line 697 of file Block.hpp.

template<class T, std::size_t N>
bool operator!= ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

Block inequality comparison.

Parameters
xA block
yA block of the same type of x
Returns
true if !(x == y)

Definition at line 745 of file Block.hpp.

template<class T, std::size_t N>
bool operator< ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

Less than comparison operator (block ordering relation)

Parameters
xA block
yA block of the same type of x
Returns
true iff x is lexicographically less than y

Definition at line 756 of file Block.hpp.

template<class T, std::size_t N>
std::ostream& operator<< ( std::ostream &  out,
const block< T, N > &  b 
)
friend

Write the block to an ouput stream.

Parameters
outoutput std::ostream
bblock to write to an output stream

Definition at line 718 of file Block.hpp.

template<class T, std::size_t N>
bool operator<= ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

Less than equal comparison operator.

Parameters
xA block
yA block of the same type of x
Returns
true iff !(y > x)

Definition at line 775 of file Block.hpp.

template<class T, std::size_t N>
bool operator== ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

Block equality comparison.

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

Definition at line 736 of file Block.hpp.

template<class T, std::size_t N>
bool operator> ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

More than comparison operator.

Parameters
xA block
yA block of the same type of x
Returns
true iff y > x

Definition at line 766 of file Block.hpp.

template<class T, std::size_t N>
bool operator>= ( const block< T, N > &  x,
const block< T, N > &  y 
)
friend

More than equal comparison operator.

Parameters
xA block
yA block of the same type of x
Returns
true iff !(x < y)

Definition at line 784 of file Block.hpp.

Member Data Documentation

template<class T, std::size_t N>
T slip::block< T, N >::data[N]

Data array storage of the block.

Definition at line 694 of file Block.hpp.

template<class T, std::size_t N>
const std::size_t slip::block< T, N >::DIM = 1
static

Definition at line 173 of file Block.hpp.

template<class T, std::size_t N>
const std::size_t slip::block< T, N >::SIZE = N
static

Definition at line 172 of file Block.hpp.


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