Open
Graph Drawing
Framework

 v.2010.10
 

Public Member Functions | Private Member Functions | Private Attributes

ogdf::Array2D< E > Class Template Reference

The parameterized class Array2D<E> implements dynamic two-dimensional arrays. More...

#include <ogdf/basic/Array2D.h>

List of all members.

Public Member Functions

 Array2D ()
 Creates a two-dimensional array with empty index set.
 Array2D (int a, int b, int c, int d)
 Creates a two-dimensional array with index set [a..b]*[c..d].
 Array2D (int a, int b, int c, int d, const E &x)
 Creates a two-dimensional array with index set [a..b]*[c..d] and initailizes all elements with x.
 Array2D (const Array2D< E > &array2)
 Creates a two-dimensional array that is a copy of A.
 ~Array2D ()
int low1 () const
 Returns the minimal array index in dimension 1.
int high1 () const
 Returns the maximal array index in dimension 1.
int low2 () const
 Returns the minimal array index in dimension 2.
int high2 () const
 Returns the maximal array index in dimension 2.
int size () const
 Returns the size (number of elements) of the array.
int size1 () const
 Returns the length of the index interval (number of entries) in dimension 1.
int size2 () const
 Returns the length of the index interval (number of entries) in dimension 2.
float det ()
 Returns the determinant of the matrix.
const E & operator() (int i, int j) const
 Returns a reference to the element with index (i,j).
E & operator() (int i, int j)
 Returns a reference to the element with index (i,j).
void init ()
 Reinitializes the array to an array with empty index set.
void init (int a, int b, int c, int d)
 Reinitializes the array to an array with index set [a..b]*[c,d].
void init (int a, int b, int c, int d, const E &x)
 Reinitializes the array to an array with index set [a..b]*[c,d] and initializes all entries with x.
Array2D< E > & operator= (const Array2D< E > &array2)
 Assignment operator.
void fill (const E &x)
 Sets all elements to x.

Private Member Functions

void construct (int a, int b, int c, int d)
void initialize ()
void initialize (const E &x)
void deconstruct ()
void copy (const Array2D< E > &array2)

Private Attributes

E * m_vpStart
 The virtual start of the array (address of A[0,0]).
int m_a
 The lowest index in dimension 1.
int m_lenDim2
 The number of elements in dimension 2.
E * m_pStart
 The real start of the array (address of A[low1,low2]).
E * m_pStop
 Successor of last element (address of A[high1,high2+1]).
int m_b
 The highest index in dimension 1.
int m_c
 The lowest index in dimension 2.
int m_d
 The highest index in dimension 2.

Detailed Description

template<class E>
class ogdf::Array2D< E >

The parameterized class Array2D<E> implements dynamic two-dimensional arrays.

Definition at line 69 of file Array2D.h.


Constructor & Destructor Documentation

template<class E>
ogdf::Array2D< E >::Array2D (  )  [inline]

Creates a two-dimensional array with empty index set.

Definition at line 75 of file Array2D.h.

template<class E>
ogdf::Array2D< E >::Array2D ( int  a,
int  b,
int  c,
int  d 
) [inline]

Creates a two-dimensional array with index set [a..b]*[c..d].

Definition at line 78 of file Array2D.h.

template<class E>
ogdf::Array2D< E >::Array2D ( int  a,
int  b,
int  c,
int  d,
const E &  x 
) [inline]

Creates a two-dimensional array with index set [a..b]*[c..d] and initailizes all elements with x.

Definition at line 83 of file Array2D.h.

template<class E>
ogdf::Array2D< E >::Array2D ( const Array2D< E > &  array2  )  [inline]

Creates a two-dimensional array that is a copy of A.

Definition at line 88 of file Array2D.h.

template<class E>
ogdf::Array2D< E >::~Array2D (  )  [inline]

Definition at line 93 of file Array2D.h.


Member Function Documentation

template<class E >
void ogdf::Array2D< E >::construct ( int  a,
int  b,
int  c,
int  d 
) [private]

Definition at line 189 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::copy ( const Array2D< E > &  array2  )  [private]

Definition at line 258 of file Array2D.h.

template<class E >
void ogdf::Array2D< E >::deconstruct (  )  [private]

Definition at line 247 of file Array2D.h.

template<class E >
float ogdf::Array2D< E >::det (  ) 

Returns the determinant of the matrix.

Note:
use only for square matrices and floating point values

Definition at line 273 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::fill ( const E &  x  )  [inline]

Sets all elements to x.

Definition at line 159 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::high1 (  )  const [inline]

Returns the maximal array index in dimension 1.

Definition at line 101 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::high2 (  )  const [inline]

Returns the maximal array index in dimension 2.

Definition at line 107 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::init (  )  [inline]

Reinitializes the array to an array with empty index set.

Definition at line 135 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::init ( int  a,
int  b,
int  c,
int  d,
const E &  x 
) [inline]

Reinitializes the array to an array with index set [a..b]*[c,d] and initializes all entries with x.

Definition at line 145 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::init ( int  a,
int  b,
int  c,
int  d 
) [inline]

Reinitializes the array to an array with index set [a..b]*[c,d].

Definition at line 138 of file Array2D.h.

template<class E >
void ogdf::Array2D< E >::initialize (  )  [private]

Definition at line 215 of file Array2D.h.

template<class E>
void ogdf::Array2D< E >::initialize ( const E &  x  )  [private]

Definition at line 231 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::low1 (  )  const [inline]

Returns the minimal array index in dimension 1.

Definition at line 98 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::low2 (  )  const [inline]

Returns the minimal array index in dimension 2.

Definition at line 104 of file Array2D.h.

template<class E>
E& ogdf::Array2D< E >::operator() ( int  i,
int  j 
) [inline]

Returns a reference to the element with index (i,j).

Definition at line 129 of file Array2D.h.

template<class E>
const E& ogdf::Array2D< E >::operator() ( int  i,
int  j 
) const [inline]

Returns a reference to the element with index (i,j).

Definition at line 123 of file Array2D.h.

template<class E>
Array2D<E>& ogdf::Array2D< E >::operator= ( const Array2D< E > &  array2  )  [inline]

Assignment operator.

Definition at line 152 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::size (  )  const [inline]

Returns the size (number of elements) of the array.

Definition at line 110 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::size1 (  )  const [inline]

Returns the length of the index interval (number of entries) in dimension 1.

Definition at line 113 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::size2 (  )  const [inline]

Returns the length of the index interval (number of entries) in dimension 2.

Definition at line 116 of file Array2D.h.


Member Data Documentation

template<class E>
int ogdf::Array2D< E >::m_a [private]

The lowest index in dimension 1.

Definition at line 167 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::m_b [private]

The highest index in dimension 1.

Definition at line 171 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::m_c [private]

The lowest index in dimension 2.

Definition at line 172 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::m_d [private]

The highest index in dimension 2.

Definition at line 173 of file Array2D.h.

template<class E>
int ogdf::Array2D< E >::m_lenDim2 [private]

The number of elements in dimension 2.

Definition at line 168 of file Array2D.h.

template<class E>
E* ogdf::Array2D< E >::m_pStart [private]

The real start of the array (address of A[low1,low2]).

Definition at line 169 of file Array2D.h.

template<class E>
E* ogdf::Array2D< E >::m_pStop [private]

Successor of last element (address of A[high1,high2+1]).

Definition at line 170 of file Array2D.h.

template<class E>
E* ogdf::Array2D< E >::m_vpStart [private]

The virtual start of the array (address of A[0,0]).

Definition at line 166 of file Array2D.h.


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