Open
Graph Drawing
Framework

 v.2010.10
 

Public Types | Public Member Functions | Private Attributes

ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ > Class Template Reference

Indexed 2-dimensional arrays using hashing for element access. More...

#include <ogdf/basic/HashArray2D.h>

Inheritance diagram for ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >:
ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >

List of all members.

Public Types

typedef HashConstIterator2D
< I1_, I2_, E_, Hash1_, Hash2_ > 
const_iterator
 The type of const-iterators for 2D-hash arrays.

Public Member Functions

 HashArray2D ()
 Creates a 2D-hash array.
 HashArray2D (const E_ &defaultValue, const Hash1_ &hashFunc1=Hash1_(), const Hash2_ &hashFunc2=Hash2_())
 Creates a 2D-hash array and sets the default value to x.
 HashArray2D (const HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ > &A)
 Copy constructor.
HashArray2Doperator= (const HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ > &A)
 Assignment operator.
 ~HashArray2D ()
const E_ & operator() (const I1_ &i, const I2_ &j) const
 Returns a const reference to entry (i,j).
E_ & operator() (const I1_ &i, const I2_ &j)
 Returns a reference to entry (i,j).
bool isDefined (const I1_ &i, const I2_ &j) const
 Returns true iff entry (i,j) is defined.
void undefine (const I1_ &i, const I2_ &j)
 Undefines the entry at index (i,j).
HashConstIterator2D< I1_, I2_,
E_, Hash1_, Hash2_ > 
begin () const
 Returns an iterator pointing to the first element.
int size () const
 Returns the number of defined elements in the table.
int empty () const
 Returns if any indices are defined.
void clear ()
 Undefines all indices.

Private Attributes

E_ m_defaultValue
 The default value of the array.

Detailed Description

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
class ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >

Indexed 2-dimensional arrays using hashing for element access.

A 2D-hash array can be used like a usual 2-dimensional array but with a general index type. The class uses five template parameters:

Definition at line 88 of file HashArray2D.h.


Member Typedef Documentation

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
typedef HashConstIterator2D<I1_,I2_,E_,Hash1_,Hash2_> ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::const_iterator

The type of const-iterators for 2D-hash arrays.

Reimplemented from ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >.

Definition at line 93 of file HashArray2D.h.


Constructor & Destructor Documentation

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::HashArray2D (  )  [inline]

Creates a 2D-hash array.

Definition at line 96 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::HashArray2D ( const E_ &  defaultValue,
const Hash1_ &  hashFunc1 = Hash1_(),
const Hash2_ &  hashFunc2 = Hash2_() 
) [inline]

Creates a 2D-hash array and sets the default value to x.

Definition at line 99 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::HashArray2D ( const HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ > &  A  )  [inline]

Copy constructor.

Definition at line 107 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::~HashArray2D (  )  [inline]

Definition at line 119 of file HashArray2D.h.


Member Function Documentation

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
HashConstIterator2D<I1_,I2_,E_,Hash1_,Hash2_> ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::begin (  )  const [inline]

Returns an iterator pointing to the first element.

Reimplemented from ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >.

Definition at line 150 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
void ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::clear (  )  [inline]

Undefines all indices.

Reimplemented from ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >.

Definition at line 167 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
int ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::empty (  )  const [inline]

Returns if any indices are defined.

Reimplemented from ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >.

Definition at line 161 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
bool ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::isDefined ( const I1_ &  i,
const I2_ &  j 
) const [inline]

Returns true iff entry (i,j) is defined.

Definition at line 140 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
const E_& ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::operator() ( const I1_ &  i,
const I2_ &  j 
) const [inline]

Returns a const reference to entry (i,j).

Definition at line 122 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
E_& ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::operator() ( const I1_ &  i,
const I2_ &  j 
) [inline]

Returns a reference to entry (i,j).

Definition at line 130 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
HashArray2D& ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::operator= ( const HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ > &  A  )  [inline]

Assignment operator.

Definition at line 112 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
int ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::size (  )  const [inline]

Returns the number of defined elements in the table.

Reimplemented from ogdf::Hashing< Tuple2< I1_, I2_ >, E_, HashFuncTuple< I1_, I2_, Hash1_, Hash2_ > >.

Definition at line 156 of file HashArray2D.h.

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
void ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::undefine ( const I1_ &  i,
const I2_ &  j 
) [inline]

Undefines the entry at index (i,j).

Definition at line 145 of file HashArray2D.h.


Member Data Documentation

template<class I1_, class I2_, class E_, class Hash1_ = DefHashFunc<I1_>, class Hash2_ = DefHashFunc<I2_>>
E_ ogdf::HashArray2D< I1_, I2_, E_, Hash1_, Hash2_ >::m_defaultValue [private]

The default value of the array.

Definition at line 172 of file HashArray2D.h.


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