home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.5 KB | 139 lines | [TEXT/MPS ] |
- // The C++ Booch Components (Version 2.1)
- // (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
- //
- // Restricted Rights Legend
- // Use, duplication, or disclosure is subject to restrictions as set forth
- // in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer
- // Software clause at DFARS 252.227-7013.
- //
- // BCStacU.cpp
- //
- // This file contains the definitions for the unbounded stack.
-
- #include "BCStacU.h"
-
- template<class Item, class StorageManager>
- BC_TUnboundedStack<Item, StorageManager>::BC_TUnboundedStack() {}
-
- template<class Item, class StorageManager>
- BC_TUnboundedStack<Item, StorageManager>::
- BC_TUnboundedStack(const BC_TUnboundedStack<Item, StorageManager>& s)
- : fRep(s.fRep) {}
-
- template<class Item, class StorageManager>
- BC_TUnboundedStack<Item, StorageManager>::~BC_TUnboundedStack() {}
-
- template<class Item, class StorageManager>
- BC_TStack<Item>& BC_TUnboundedStack<Item, StorageManager>::
- operator=(const BC_TStack<Item>& s)
- {
- return BC_TStack<Item>::operator=(s);
- }
-
- template<class Item, class StorageManager>
- BC_TStack<Item>& BC_TUnboundedStack<Item, StorageManager>::
- operator=(const BC_TUnboundedStack<Item, StorageManager>& s)
- {
- fRep = s.fRep;
- return *this;
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TUnboundedStack<Item, StorageManager>::
- operator==(const BC_TStack<Item>& s) const
- {
- return BC_TStack<Item>::operator==(s);
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TUnboundedStack<Item, StorageManager>::
- operator==(const BC_TUnboundedStack<Item, StorageManager>& s) const
- {
- return (fRep == s.fRep);
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TUnboundedStack<Item, StorageManager>::
- operator!=(const BC_TUnboundedStack<Item, StorageManager>& s) const
- {
- return !operator==(s);
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::Clear()
- {
- fRep.Clear();
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::Push(const Item& item)
- {
- fRep.Insert(item);
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::Pop()
- {
- fRep.Remove(0);
- }
-
- template<class Item, class StorageManager>
- BC_Index BC_TUnboundedStack<Item, StorageManager>::Depth() const
- {
- return fRep.Length();
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TUnboundedStack<Item, StorageManager>::IsEmpty() const
- {
- return (fRep.Length() == 0);
- }
-
- template<class Item, class StorageManager>
- const Item& BC_TUnboundedStack<Item, StorageManager>::Top() const
- {
- return fRep.First();
- }
-
- template<class Item, class StorageManager>
- Item& BC_TUnboundedStack<Item, StorageManager>::Top()
- {
- return fRep.First();
- }
-
- template<class Item, class StorageManager>
- void* BC_TUnboundedStack<Item, StorageManager>::operator new(size_t s)
- {
- return StorageManager::Allocate(s);
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::operator delete(void* p, size_t s)
- {
- StorageManager::Deallocate(p, s);
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::Purge()
- {
- fRep.Clear();
- }
-
- template<class Item, class StorageManager>
- void BC_TUnboundedStack<Item, StorageManager>::Add(const Item& item)
- {
- fRep.Append(item);
- }
-
- template<class Item, class StorageManager>
- BC_Index BC_TUnboundedStack<Item, StorageManager>::Cardinality() const
- {
- return fRep.Length();
- }
-
- template<class Item, class StorageManager>
- const Item& BC_TUnboundedStack<Item, StorageManager>::ItemAt(BC_Index index) const
- {
- return fRep.ItemAt(index);
- }
-