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, A > Class Template Reference

class stack uses external allocator class for ALL internal memory allocations only 4 byte size for empty stack object More...

#include <stack.h>

Inheritance diagram for _stack< T, A >:

base_stack< T >

List of all members.

Public Member Functions

 _stack ()
 constructor
 ~_stack ()
 destructor
 _stack (const _stack< T, A > &x)
 copy constructor copies only pointers to head element NO reallocation or copy of memory
_stack< T, A > & operator= (const _stack< T, A > &x)
 assign operator copy only pointers to head element NO reallocation or copy of memory
size_t size ()
 gets size - expensive operation use empty instead
TYPENAME _stack< T, A >::iterator push (A &allocator_, const T &x)
 inserts new object to the top of stack
bool pop ()
 removes first element from stack no memory deallocation
bool pop (node_allocator< TYPENAME base_stack< T >::_node > &allocator_)
 removes first element from stack memory deallocation on external allocator

Protected Member Functions

TYPENAME _stack< T, A >::_node_buynode (byte_allocator &allocator_, const T &x)
 allocates node on byte_allocator
TYPENAME _stack< T, A >::_node_buynode (node_allocator< TYPENAME base_stack< T >::_node > &allocator_, const T &x)
 allocates node on node_allocator
void _freenode (node_allocator< TYPENAME base_stack< T >::_node > &allocator_, TYPENAME _stack< T, A >::_node *p)
 deallocates node on node_allocator


Detailed Description

template<class T, class A = byte_allocator>
class _stack< T, A >

class stack uses external allocator class for ALL internal memory allocations only 4 byte size for empty stack object

Definition at line 300 of file stack.h.


Constructor & Destructor Documentation

template<class T, class A>
_stack< T, A >::_stack (  )  [inline]

constructor

Definition at line 149 of file stack.hpp.

template<class T, class A>
_stack< T, A >::~_stack (  )  [inline]

destructor

Definition at line 158 of file stack.hpp.

References base_stack< T >::clear().

template<class T, class A>
_stack< T, A >::_stack ( const _stack< T, A > &  x  )  [inline]

copy constructor copies only pointers to head element NO reallocation or copy of memory

Definition at line 168 of file stack.hpp.


Member Function Documentation

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

assign operator copy only pointers to head element NO reallocation or copy of memory

Definition at line 177 of file stack.hpp.

References base_stack< T >::_head, base_stack< T >::_node_::_next, base_stack< T >::clear(), and base_stack< T >::empty().

template<class T, class A>
size_t _stack< T, A >::size (  )  [inline]

gets size - expensive operation use empty instead

Definition at line 192 of file stack.hpp.

References base_stack< T >::begin(), base_stack< T >::end(), and TYPENAME.

Referenced by xml_persistor::persistElement(), and xml_persistor::restore_stack().

template<class T, class A>
bool _stack< T, A >::pop (  )  [inline]

template<class T, class A>
bool _stack< T, A >::pop ( node_allocator< TYPENAME base_stack< T >::_node > &  allocator_  )  [inline]

removes first element from stack memory deallocation on external allocator

Parameters:
allocator_  external allocator

Definition at line 237 of file stack.hpp.

References _stack< T, A >::_freenode(), base_stack< T >::_head, base_stack< T >::_node_::_next, base_stack< T >::empty(), and TYPENAME.

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

allocates node on byte_allocator

Parameters:
allocator_  external allocator
x  input value

Definition at line 252 of file stack.hpp.

References byte_allocator::allocate(), and TYPENAME.

Referenced by _stack< T, A >::push().

template<class T, class A>
TYPENAME _stack< T, A >::_node * _stack< T, A >::_buynode ( node_allocator< TYPENAME base_stack< T >::_node > &  allocator_,
const T &  x 
) [inline, protected]

allocates node on node_allocator

Parameters:
allocator_  external allocator
x  input value

Definition at line 264 of file stack.hpp.

References TYPENAME.

template<class T, class A>
void _stack< T, A >::_freenode ( node_allocator< TYPENAME base_stack< T >::_node > &  allocator_,
TYPENAME _stack< T, A >::_node p 
) [inline, protected]

deallocates node on node_allocator

Parameters:
allocator_  external allocator
p  pointer to node

Definition at line 275 of file stack.hpp.

Referenced by _stack< T, A >::pop().


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


© Copyright Terimber 2003-.