Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

stack< T > Class Template Reference

class stack uses internal allocator class for ALL internal memory allocations forward iterators are supported More...

#include <stack.h>

Inheritance diagram for stack< T >:

base_stack< T >

List of all members.

Public Member Functions

 stack (size_t size=os_def_size)
 constructor
 ~stack ()
 destructor
 stack (const stack< T > &x)
 copy constructor
stack< T > & operator= (const stack< T > &x)
 assigns operator
size_t size () const
 returns stack size
TYPENAME stack< T >::iterator push (const T &x)
 inserts new object to the front of stack
bool pop ()
 removes top element from stack
void clear ()
 clears stack call object destructors

Protected Member Functions

TYPENAME stack< T >::_node_buynode (const T &x)
 allocates node on internal allocator
void _freenode (TYPENAME stack< T >::_node *p)
 deallocates node on internal allocator

Protected Attributes

size_t _length
 keep length
node_allocator< TYPENAME
base_stack< T >::_node
_allocator
 internal allocator


Detailed Description

template<class T>
class stack< T >

class stack uses internal allocator class for ALL internal memory allocations forward iterators are supported

Definition at line 367 of file stack.h.


Constructor & Destructor Documentation

template<class T>
stack< T >::stack ( size_t  size = os_def_size  )  [inline]

constructor

Parameters:
size  default node_allocator chunk

Definition at line 286 of file stack.hpp.

template<class T>
stack< T >::~stack (  )  [inline]

destructor

Definition at line 295 of file stack.hpp.

References stack< T >::clear().

template<class T>
stack< T >::stack ( const stack< T > &  x  )  [inline]

copy constructor

Definition at line 304 of file stack.hpp.


Member Function Documentation

template<class T>
stack< T > & stack< T >::operator= ( const stack< T > &  x  )  [inline]

template<class T>
size_t stack< T >::size (  )  const [inline]

returns stack size

Definition at line 336 of file stack.hpp.

References stack< T >::_length.

template<class T>
TYPENAME stack< T >::iterator stack< T >::push ( const T &  x  )  [inline]

inserts new object to the front of stack

Parameters:
x  input value

Definition at line 348 of file stack.hpp.

References stack< T >::_buynode(), base_stack< T >::_head, stack< T >::_length, base_stack< T >::_node_::_next, base_stack< T >::end(), and TYPENAME.

Referenced by stack< T >::operator=(), and unique_key_generator::save().

template<class T>
bool stack< T >::pop (  )  [inline]

template<class T>
void stack< T >::clear (  )  [inline]

template<class T>
TYPENAME stack< T >::_node * stack< T >::_buynode ( const T &  x  )  [inline, protected]

allocates node on internal allocator

Parameters:
x  input value

Definition at line 403 of file stack.hpp.

References stack< T >::_allocator, node_allocator< T >::allocate(), and TYPENAME.

Referenced by stack< T >::push().

template<class T>
void stack< T >::_freenode ( TYPENAME stack< T >::_node p  )  [inline, protected]

deallocates node on internal allocator

Parameters:
p  pointer to node

Definition at line 414 of file stack.hpp.

References stack< T >::_allocator, and rep_allocator::deallocate().

Referenced by stack< T >::clear(), and stack< T >::pop().


Member Data Documentation

template<class T>
size_t stack< T >::_length [protected]

keep length

Definition at line 414 of file stack.h.

Referenced by stack< T >::clear(), stack< T >::pop(), stack< T >::push(), and stack< T >::size().

template<class T>
node_allocator< TYPENAME base_stack< T >::_node > stack< T >::_allocator [protected]

internal allocator

Definition at line 415 of file stack.h.

Referenced by stack< T >::_buynode(), stack< T >::_freenode(), stack< T >::clear(), and stack< T >::operator=().


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


© Copyright Terimber 2003-.