Open
Graph Drawing
Framework

 v.2012.07
 

ogdf::Stack< E > Class Template Reference

The parameterized class Stack<E> implements list-based stacks. More...

#include <ogdf/basic/Stack.h>

+ Inheritance diagram for ogdf::Stack< E >:

List of all members.

Public Member Functions

 Stack ()
 The number of elements in the list.
 Stack (const Stack< E > &S)
 Constructs a stack that is a copy of S.
 ~Stack ()
void clear ()
 Makes the stack empty.
bool empty () const
 Returns true iff the stack is empty.
Stack< E > & operator= (const Stack< E > &S)
 Assignment operator.
pop ()
 Removes the top-most element from the stack and returns it.
void print (ostream &os, char delim= ' ') const
void push (const E &x)
 Adds element x as top-most element to the stack.
int size () const
 Returns the number of elements contained in the stack.
const E & top () const
 Returns a reference to the top element.
E & top ()
 Returns a reference to the top element.

Private Attributes

int m_count

Additional Inherited Members

- Private Member Functions inherited from ogdf::StackPure< E >
 StackPure ()
 Constructs an empty stack.
 StackPure (const StackPure< E > &S)
 Constructs a stack that is a copy of S.
 ~StackPure ()
StackPure< E > & operator= (const StackPure< E > &S)
 Assignment operator.

Detailed Description

template<class E>
class ogdf::Stack< E >

The parameterized class Stack<E> implements list-based stacks.

In contrast to StackPure<E>, instances of Stack<E> store the number of elements contained in the stack.

Template Parameters:
Eis the element type.

Definition at line 167 of file Stack.h.


Constructor & Destructor Documentation

template<class E>
ogdf::Stack< E >::Stack ( )
inline

The number of elements in the list.

Constructs an empty stack.

Definition at line 173 of file Stack.h.

template<class E>
ogdf::Stack< E >::Stack ( const Stack< E > &  S)
inline

Constructs a stack that is a copy of S.

Definition at line 176 of file Stack.h.

template<class E>
ogdf::Stack< E >::~Stack ( )
inline

Definition at line 179 of file Stack.h.


Member Function Documentation

template<class E>
void ogdf::Stack< E >::clear ( )
inline

Makes the stack empty.

Reimplemented from ogdf::StackPure< E >.

Definition at line 217 of file Stack.h.

template<class E>
bool ogdf::Stack< E >::empty ( ) const
inline

Returns true iff the stack is empty.

Reimplemented from ogdf::StackPure< E >.

Definition at line 182 of file Stack.h.

template<class E>
Stack<E>& ogdf::Stack< E >::operator= ( const Stack< E > &  S)
inline

Assignment operator.

Definition at line 198 of file Stack.h.

template<class E>
E ogdf::Stack< E >::pop ( )
inline

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

Reimplemented from ogdf::StackPure< E >.

Definition at line 211 of file Stack.h.

template<class E>
void ogdf::Stack< E >::print ( ostream &  os,
char  delim = ' ' 
) const
inline

Reimplemented from ogdf::StackPure< E >.

Definition at line 222 of file Stack.h.

template<class E>
void ogdf::Stack< E >::push ( const E &  x)
inline

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

Reimplemented from ogdf::StackPure< E >.

Definition at line 205 of file Stack.h.

template<class E>
int ogdf::Stack< E >::size ( ) const
inline

Returns the number of elements contained in the stack.

Definition at line 185 of file Stack.h.

template<class E>
const E& ogdf::Stack< E >::top ( ) const
inline

Returns a reference to the top element.

Reimplemented from ogdf::StackPure< E >.

Definition at line 188 of file Stack.h.

template<class E>
E& ogdf::Stack< E >::top ( )
inline

Returns a reference to the top element.

Reimplemented from ogdf::StackPure< E >.

Definition at line 193 of file Stack.h.


Member Data Documentation

template<class E>
int ogdf::Stack< E >::m_count
private

Definition at line 169 of file Stack.h.


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