rutz::dynamic_block< T > Class Template Reference

A dynamically-allocated array whose size may be changed at runtime. More...

#include <rutz/arrays.h>

List of all members.

Public Types

typedef T value_type
 STL value type.
typedef T * pointer
 STL pointer type.
typedef const T * const_pointer
 STL const pointer type.
typedef T & reference
 STL reference type.
typedef const T & const_reference
 STL const reference type.
typedef pointer iterator
 STL iterator type.
typedef const_pointer const_iterator
 STL const iterator type.
typedef size_t size_type
 STL size type.
typedef ptrdiff_t difference_type
 STL iterator difference type.

Public Member Functions

 dynamic_block (size_type n=0)
 Construct with a given size.
 dynamic_block (const dynamic_block< T > &other)
 Copy construct.
dynamic_block< T > & operator= (const dynamic_block< T > &other)
 Assignment operator.
 ~dynamic_block ()
 Destructor.
iterator begin ()
 Iterator to array start.
iterator end ()
 Iterator to array one-past-the-end.
const_iterator begin () const
 Const iterator to array start.
const_iterator end () const
 Const iterator to array one-past-the-end.
reference operator[] (size_type n)
 Unchecked non-const array index.
const_reference operator[] (size_type n) const
 Unchecked const array index.
reference at (size_type n)
 Checked non-const array index (rutz::out_of_range on bounds error).
const_reference at (size_type n) const
 Checked const array index (rutz::out_of_range on bounds error).
size_type size () const
 Size of array.
size_type max_size () const
 Maximum size of array type.
bool is_empty () const
 Query whether size is zero.
void swap (dynamic_block &other)
 Swap with another dynamic_block.
void resize (size_type new_size)
 Resize to a new size.
template<class RandomAccessIterator >
void assign (RandomAccessIterator start, RandomAccessIterator finish)
 Assign from a given iterator range.

Detailed Description

template<class T>
class rutz::dynamic_block< T >

A dynamically-allocated array whose size may be changed at runtime.

Definition at line 350 of file arrays.h.


Member Typedef Documentation

template<class T>
typedef const_pointer rutz::dynamic_block< T >::const_iterator

STL const iterator type.

Definition at line 361 of file arrays.h.

template<class T>
typedef const T* rutz::dynamic_block< T >::const_pointer

STL const pointer type.

Definition at line 356 of file arrays.h.

template<class T>
typedef const T& rutz::dynamic_block< T >::const_reference

STL const reference type.

Definition at line 358 of file arrays.h.

template<class T>
typedef ptrdiff_t rutz::dynamic_block< T >::difference_type

STL iterator difference type.

Definition at line 364 of file arrays.h.

template<class T>
typedef pointer rutz::dynamic_block< T >::iterator

STL iterator type.

Definition at line 360 of file arrays.h.

template<class T>
typedef T* rutz::dynamic_block< T >::pointer

STL pointer type.

Definition at line 355 of file arrays.h.

template<class T>
typedef T& rutz::dynamic_block< T >::reference

STL reference type.

Definition at line 357 of file arrays.h.

template<class T>
typedef size_t rutz::dynamic_block< T >::size_type

STL size type.

Definition at line 363 of file arrays.h.

template<class T>
typedef T rutz::dynamic_block< T >::value_type

STL value type.

Definition at line 353 of file arrays.h.


Constructor & Destructor Documentation

template<class T>
rutz::dynamic_block< T >::dynamic_block ( size_type  n = 0  )  [inline]

Construct with a given size.

Definition at line 367 of file arrays.h.

template<class T>
rutz::dynamic_block< T >::dynamic_block ( const dynamic_block< T > &  other  )  [inline]

Copy construct.

Definition at line 370 of file arrays.h.

template<class T>
rutz::dynamic_block< T >::~dynamic_block (  )  [inline]

Destructor.

Definition at line 385 of file arrays.h.


Member Function Documentation

template<class T>
template<class RandomAccessIterator >
void rutz::dynamic_block< T >::assign ( RandomAccessIterator  start,
RandomAccessIterator  finish 
) [inline]

Assign from a given iterator range.

Definition at line 444 of file arrays.h.

References rutz::dynamic_block< T >::begin(), and rutz::dynamic_block< T >::resize().

template<class T>
const_reference rutz::dynamic_block< T >::at ( size_type  n  )  const [inline]

Checked const array index (rutz::out_of_range on bounds error).

Definition at line 408 of file arrays.h.

template<class T>
reference rutz::dynamic_block< T >::at ( size_type  n  )  [inline]

Checked non-const array index (rutz::out_of_range on bounds error).

Definition at line 400 of file arrays.h.

template<class T>
const_iterator rutz::dynamic_block< T >::begin (  )  const [inline]

Const iterator to array start.

Definition at line 390 of file arrays.h.

template<class T>
iterator rutz::dynamic_block< T >::begin (  )  [inline]

Iterator to array start.

Definition at line 387 of file arrays.h.

Referenced by rutz::dynamic_block< T >::assign().

template<class T>
const_iterator rutz::dynamic_block< T >::end (  )  const [inline]

Const iterator to array one-past-the-end.

Definition at line 391 of file arrays.h.

template<class T>
iterator rutz::dynamic_block< T >::end (  )  [inline]

Iterator to array one-past-the-end.

Definition at line 388 of file arrays.h.

template<class T>
bool rutz::dynamic_block< T >::is_empty (  )  const [inline]

Query whether size is zero.

Definition at line 422 of file arrays.h.

template<class T>
size_type rutz::dynamic_block< T >::max_size (  )  const [inline]

Maximum size of array type.

Definition at line 419 of file arrays.h.

template<class T>
dynamic_block<T>& rutz::dynamic_block< T >::operator= ( const dynamic_block< T > &  other  )  [inline]

Assignment operator.

Definition at line 377 of file arrays.h.

References rutz::dynamic_block< T >::swap().

template<class T>
const_reference rutz::dynamic_block< T >::operator[] ( size_type  n  )  const [inline]

Unchecked const array index.

Definition at line 397 of file arrays.h.

template<class T>
reference rutz::dynamic_block< T >::operator[] ( size_type  n  )  [inline]

Unchecked non-const array index.

Definition at line 394 of file arrays.h.

template<class T>
void rutz::dynamic_block< T >::resize ( size_type  new_size  )  [inline]

Resize to a new size.

Definition at line 435 of file arrays.h.

References rutz::dynamic_block< T >::swap().

Referenced by rutz::dynamic_block< T >::assign(), and rutz::unixcall::getcwd().

template<class T>
size_type rutz::dynamic_block< T >::size (  )  const [inline]

Size of array.

Definition at line 416 of file arrays.h.

Referenced by rutz::unixcall::getcwd().

template<class T>
void rutz::dynamic_block< T >::swap ( dynamic_block< T > &  other  )  [inline]

Swap with another dynamic_block.

This is fast since it only requires swapping the interal pointers to the dynamically-allocated arrays; no element-wise swap is needed.

Definition at line 428 of file arrays.h.

Referenced by rutz::dynamic_block< T >::operator=(), and rutz::dynamic_block< T >::resize().


The documentation for this class was generated from the following file:
Generated on Sun May 8 08:44:43 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3