Stack< Type > Class Template Reference

A stack whose storage capacity is variable at run-time. Similar to std::vector. More...

#include <stack.h>

Inheritance diagram for Stack< Type >:
Inheritance graph
[legend]
Collaboration diagram for Stack< Type >:
Collaboration graph
[legend]

Public Types

typedef const_pointer const_iterator

Public Member Functions

 Stack ()
 Stack (const Type &value)
 Stack (const Stack &other)
 ~Stack ()
const_iterator begin () const
const_iterator end () const
bool empty () const
void clear ()
std::size_t size () const
Type operator[] (const std::size_t i) const
void push (const Type &value)
 Pushes value onto the stack at the top element. If reserved storage is insufficient for the new element, this will invalidate all iterators.
void pop ()
 Removes the top element of the stack.
Type & top ()
 Returns the top element of the mutable stack.
const Type & top () const
 Returns the top element of the non-mutable stack.
Type & parent ()
 Returns the element below the top element of the mutable stack.
const Type & parent () const
 Returns the element below the top element of the non-mutable stack.
void swap (Stack &other)
 Swaps the values of this stack and other.
Stackoperator= (const Stack &other)

Private Types

enum  { DEFAULT_CAPACITY = 4 }
typedef DefaultAllocator< Type > Allocator
typedef Type * pointer
typedef const Type * const_pointer

Private Member Functions

void insert (const Type &value)
void insert_overflow (const Type &value)
void destroy ()
void construct (const Stack &other)

Private Attributes

pointer m_data
pointer m_end
std::size_t m_capacity

Detailed Description

template<typename Type>
class Stack< Type >

A stack whose storage capacity is variable at run-time. Similar to std::vector.

Parameters:
Type,: The type to be stored in the stack. Must provide a copy-constructor.

Definition at line 37 of file stack.h.


Member Typedef Documentation

template<typename Type>
typedef DefaultAllocator<Type> Stack< Type >::Allocator [private]

Definition at line 39 of file stack.h.

template<typename Type>
typedef const_pointer Stack< Type >::const_iterator

Definition at line 50 of file stack.h.

template<typename Type>
typedef const Type* Stack< Type >::const_pointer [private]

Definition at line 47 of file stack.h.

template<typename Type>
typedef Type* Stack< Type >::pointer [private]

Definition at line 46 of file stack.h.


Member Enumeration Documentation

template<typename Type>
anonymous enum [private]
Enumerator:
DEFAULT_CAPACITY 

Definition at line 41 of file stack.h.


Constructor & Destructor Documentation

template<typename Type>
Stack< Type >::Stack (  )  [inline]

Definition at line 91 of file stack.h.

template<typename Type>
Stack< Type >::Stack ( const Type &  value  )  [inline]

Definition at line 95 of file stack.h.

template<typename Type>
Stack< Type >::Stack ( const Stack< Type > &  other  )  [inline]

Definition at line 100 of file stack.h.

template<typename Type>
Stack< Type >::~Stack (  )  [inline]

Definition at line 108 of file stack.h.


Member Function Documentation

template<typename Type>
const_iterator Stack< Type >::begin (  )  const [inline]
template<typename Type>
void Stack< Type >::clear (  )  [inline]

Definition at line 127 of file stack.h.

template<typename Type>
void Stack< Type >::construct ( const Stack< Type > &  other  )  [inline, private]
template<typename Type>
void Stack< Type >::destroy (  )  [inline, private]
template<typename Type>
bool Stack< Type >::empty (  )  const [inline]

Definition at line 123 of file stack.h.

template<typename Type>
const_iterator Stack< Type >::end (  )  const [inline]
template<typename Type>
void Stack< Type >::insert ( const Type &  value  )  [inline, private]
template<typename Type>
void Stack< Type >::insert_overflow ( const Type &  value  )  [inline, private]

Definition at line 61 of file stack.h.

Referenced by Stack< NodeReference >::push().

template<typename Type>
Stack& Stack< Type >::operator= ( const Stack< Type > &  other  )  [inline]

Definition at line 183 of file stack.h.

template<typename Type>
Type Stack< Type >::operator[] ( const std::size_t  i  )  const [inline]

Definition at line 137 of file stack.h.

template<typename Type>
const Type& Stack< Type >::parent (  )  const [inline]

Returns the element below the top element of the non-mutable stack.

Definition at line 171 of file stack.h.

template<typename Type>
Type& Stack< Type >::parent (  )  [inline]

Returns the element below the top element of the mutable stack.

Definition at line 166 of file stack.h.

template<typename Type>
void Stack< Type >::pop (  )  [inline]

Removes the top element of the stack.

Definition at line 151 of file stack.h.

Referenced by UninstanceSubgraphWalker::post(), and InstanceSubgraphWalker::post().

template<typename Type>
void Stack< Type >::push ( const Type &  value  )  [inline]

Pushes value onto the stack at the top element. If reserved storage is insufficient for the new element, this will invalidate all iterators.

Definition at line 142 of file stack.h.

Referenced by UninstanceSubgraphWalker::pre(), InstanceSubgraphWalker::pre(), and Stack< NodeReference >::Stack().

template<typename Type>
std::size_t Stack< Type >::size (  )  const [inline]

Definition at line 133 of file stack.h.

Referenced by Stack< NodeReference >::push(), and Stack< NodeReference >::Stack().

template<typename Type>
void Stack< Type >::swap ( Stack< Type > &  other  )  [inline]

Swaps the values of this stack and other.

Definition at line 176 of file stack.h.

Referenced by Stack< NodeReference >::operator=(), and Stack< NodeReference >::swap().

template<typename Type>
const Type& Stack< Type >::top (  )  const [inline]

Returns the top element of the non-mutable stack.

Definition at line 161 of file stack.h.

template<typename Type>
Type& Stack< Type >::top (  )  [inline]

Returns the top element of the mutable stack.

Definition at line 156 of file stack.h.

Referenced by BrushVisibleWalker< Functor >::pre(), and InstanceSubgraphWalker::pre().


Field Documentation

template<typename Type>
std::size_t Stack< Type >::m_capacity [private]
template<typename Type>
pointer Stack< Type >::m_data [private]
template<typename Type>
pointer Stack< Type >::m_end [private]

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

Generated by  doxygen 1.6.2