Open
Graph Drawing
Framework

 v.2007.11
 

ogdf::BoundedStack< E, INDEX > Class Template Reference

The parameterized class BoundedStack<E> implements stacks with bounded size. More...

#include <BoundedStack.h>

List of all members.

Public Member Functions

 BoundedStack ()
 Constructs an empty bounded stack for no elements at all.
 BoundedStack (INDEX n)
 Constructs an empty bounded stack for at most n elements.
 BoundedStack (const BoundedStack< E > &S)
 Constructs a bounded stack that is a copy of S.
 ~BoundedStack ()
const E & top () const
 Returns top element.
E & top ()
 Returns top element.
INDEX size () const
 Returns current size of the stack.
bool empty ()
 Returns true iff the stack is empty.
bool full ()
 Returns true iff the stack is full.
bool valid () const
 Returns true iff the stack was initialized.
INDEX capacity () const
 Returns the capacity of the bounded stack.
void init ()
 Reinitializes the stack for no elements at all (actually frees memory).
void init (INDEX n)
 Reinitializes the stack for n elements.
BoundedStack< E > & operator= (const BoundedStack &S)
 Assignment operator.
void push (const E &x)
 Adds element x as top-most element to the stack.
pop ()
 Removes the top-most element from the stack and returns it.
void clear ()
 Makes the stack empty.

Private Member Functions

void copy (const BoundedStack< E > &S)

Private Attributes

E * m_pTop
 Pointer to top element.
E * m_pStart
 Pointer to first element.
E * m_pStop
 Pointer to one past last element.

Friends

void print (ostream &, const BoundedStack< E, INDEX > &, char)


Detailed Description

template<class E, class INDEX = int>
class ogdf::BoundedStack< E, INDEX >

The parameterized class BoundedStack<E> implements stacks with bounded size.

Definition at line 72 of file BoundedStack.h.


Constructor & Destructor Documentation

template<class E, class INDEX = int>
ogdf::BoundedStack< E, INDEX >::BoundedStack (  )  [inline]

Constructs an empty bounded stack for no elements at all.

The default constructor does not allocate any space for elements; before using the stack, it is required to initialize the stack with init().

Definition at line 86 of file BoundedStack.h.

template<class E, class INDEX = int>
ogdf::BoundedStack< E, INDEX >::BoundedStack ( INDEX  n  )  [inline, explicit]

Constructs an empty bounded stack for at most n elements.

Definition at line 91 of file BoundedStack.h.

template<class E, class INDEX = int>
ogdf::BoundedStack< E, INDEX >::BoundedStack ( const BoundedStack< E > &  S  )  [inline]

Constructs a bounded stack that is a copy of S.

Definition at line 100 of file BoundedStack.h.

template<class E, class INDEX = int>
ogdf::BoundedStack< E, INDEX >::~BoundedStack (  )  [inline]

Definition at line 105 of file BoundedStack.h.


Member Function Documentation

template<class E, class INDEX = int>
const E& ogdf::BoundedStack< E, INDEX >::top (  )  const [inline]

Returns top element.

Definition at line 110 of file BoundedStack.h.

template<class E, class INDEX = int>
E& ogdf::BoundedStack< E, INDEX >::top (  )  [inline]

Returns top element.

Definition at line 116 of file BoundedStack.h.

template<class E, class INDEX = int>
INDEX ogdf::BoundedStack< E, INDEX >::size (  )  const [inline]

Returns current size of the stack.

Definition at line 122 of file BoundedStack.h.

template<class E, class INDEX = int>
bool ogdf::BoundedStack< E, INDEX >::empty (  )  [inline]

Returns true iff the stack is empty.

Definition at line 125 of file BoundedStack.h.

template<class E, class INDEX = int>
bool ogdf::BoundedStack< E, INDEX >::full (  )  [inline]

Returns true iff the stack is full.

Definition at line 128 of file BoundedStack.h.

template<class E, class INDEX = int>
bool ogdf::BoundedStack< E, INDEX >::valid (  )  const [inline]

Returns true iff the stack was initialized.

Definition at line 131 of file BoundedStack.h.

template<class E, class INDEX = int>
INDEX ogdf::BoundedStack< E, INDEX >::capacity (  )  const [inline]

Returns the capacity of the bounded stack.

Definition at line 134 of file BoundedStack.h.

template<class E, class INDEX = int>
void ogdf::BoundedStack< E, INDEX >::init (  )  [inline]

Reinitializes the stack for no elements at all (actually frees memory).

Definition at line 137 of file BoundedStack.h.

template<class E, class INDEX = int>
void ogdf::BoundedStack< E, INDEX >::init ( INDEX  n  )  [inline]

Reinitializes the stack for n elements.

Definition at line 143 of file BoundedStack.h.

template<class E, class INDEX = int>
BoundedStack<E>& ogdf::BoundedStack< E, INDEX >::operator= ( const BoundedStack< E, INDEX > &  S  )  [inline]

Assignment operator.

Definition at line 155 of file BoundedStack.h.

template<class E, class INDEX = int>
void ogdf::BoundedStack< E, INDEX >::push ( const E &  x  )  [inline]

Adds element x as top-most element to the stack.

Definition at line 162 of file BoundedStack.h.

template<class E, class INDEX = int>
E ogdf::BoundedStack< E, INDEX >::pop (  )  [inline]

Removes the top-most element from the stack and returns it.

Definition at line 168 of file BoundedStack.h.

template<class E, class INDEX = int>
void ogdf::BoundedStack< E, INDEX >::clear (  )  [inline]

Makes the stack empty.

Definition at line 174 of file BoundedStack.h.

template<class E, class INDEX = int>
void ogdf::BoundedStack< E, INDEX >::copy ( const BoundedStack< E > &  S  )  [inline, private]

Definition at line 177 of file BoundedStack.h.


Friends And Related Function Documentation

template<class E, class INDEX = int>
void print ( ostream &  os,
const BoundedStack< E, INDEX > &  S,
char  delim = ' ' 
) [friend]


Member Data Documentation

template<class E, class INDEX = int>
E* ogdf::BoundedStack< E, INDEX >::m_pTop [private]

Pointer to top element.

Definition at line 76 of file BoundedStack.h.

template<class E, class INDEX = int>
E* ogdf::BoundedStack< E, INDEX >::m_pStart [private]

Pointer to first element.

Definition at line 77 of file BoundedStack.h.

template<class E, class INDEX = int>
E* ogdf::BoundedStack< E, INDEX >::m_pStop [private]

Pointer to one past last element.

Definition at line 78 of file BoundedStack.h.


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

© 1999-2007 by oreas GmbH, © 2005-2007 by University Dortmund and University Cologne.

Generated on Thu Nov 22 19:40:07 2007 by doxygen 1.5.4.