dtinfo subtree DtMmdb

This commit is contained in:
Ulrich Wilkens
2012-10-14 15:38:27 +02:00
committed by Jon Trulson
parent b92cf08899
commit 8c8363f4a5
184 changed files with 1090 additions and 773 deletions

View File

@@ -31,19 +31,55 @@ template <class T> class Stack: public Destructable
{
public:
Stack (); /* This is a value stack, ie an assignment operator
* for T is assumed */
/* This is a value stack, ie an assignment operator for T is assumed */
Stack ()
{
Items = new CC_TValSlist<T>();
}
~Stack ();
~Stack ()
{
delete Items;
}
public:
T pop ();
void push (const T);
T& top () const;
T pop ()
{
CC_Link<T> *last_elem = (CC_Link<T> *)Items->removeLast();
if ( !last_elem ) {
throw (Exception());
}
T *ret = last_elem->f_element;
delete last_elem;
T ret_value = *ret;
delete ret;
return(ret_value);
}
void push (const T newItem)
{
Items->append ( newItem );
}
T& top () const
{
CC_Link<T> *last_elem = (CC_Link<T> *)Items->last();
if ( !last_elem ) {
throw(Exception());
}
return ( *last_elem->f_element );
}
int entries() const
{
return( Items->entries() ); //ie no. of elements in the stack
}
int empty() const {
return( Items->entries() == 0 );
}