home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 6.4 KB | 199 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 bag forth
- // in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer
- // Software clause at DFARS 252.227-7013.
- //
- // BCMapU.cpp
- //
- // This file contains the definitions for the unbounded map.
-
- #include "BCMapU.h"
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::BC_TUnboundedMap() {}
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- BC_TUnboundedMap(BC_Index (*hash)(const Item&))
- : fRep(hash) {}
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- BC_TUnboundedMap(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>& m)
- : fRep(m.fRep) {}
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::~BC_TUnboundedMap() {}
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TMap<Item, Value>& BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator=(const BC_TMap<Item, Value>& m)
- {
- return BC_TMap<Item, Value>::operator=(m);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_TMap<Item, Value>& BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator=(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>& m)
- {
- fRep = m.fRep;
- return *this;
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator==(const BC_TMap<Item, Value>& m) const
- {
- return BC_TMap<Item, Value>::operator==(m);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator==(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>& m) const
- {
- return (fRep == m.fRep);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator!=(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>& m) const
- {
- return !operator==(m);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- void BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- SetHashFunction(BC_Index (*hash)(const Item&))
- {
- fRep.SetHashFunction(hash);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- void BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::Clear()
- {
- fRep.Clear();
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Bind(const Item& item, const Value& value)
- {
- return fRep.Bind(item, value);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Rebind(const Item& item, const Value& value)
- {
- return fRep.Rebind(item, value);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Unbind(const Item& item)
- {
- return fRep.Unbind(item);
- }
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Index BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::Extent() const
- {
- return fRep.Extent();
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::IsEmpty() const
- {
- return (fRep.Extent() == 0);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- IsBound(const Item& item) const
- {
- return fRep.IsBound(item);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- const Value* BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- ValueOf(const Item& item) const
- {
- return fRep.ValueOf(item);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- Value* BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::ValueOf(const Item& item)
- {
- return (Value*)(fRep.ValueOf(item));
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- void* BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::operator new(size_t s)
- {
- return StorageManager::Allocate(s);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- void BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- operator delete(void* p, size_t s)
- {
- StorageManager::Deallocate(p, s);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- void BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::Purge()
- {
- fRep.Clear();
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Attach(const Item& item, const Value& value)
- {
- return fRep.Bind(item, value);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Index BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- NumberOfBuckets() const
- {
- return Buckets;
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Index BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Cardinality() const
- {
- return fRep.Extent();
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Index BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Length(BC_Index bucket) const
- {
- return fRep.Bucket(bucket)->Length();
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- BC_Boolean BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- Exists(const Item& item) const
- {
- return fRep.IsBound(item);
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- const Item& BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- ItemAt(BC_Index bucket, BC_Index index) const
- {
- return (*fRep.Bucket(bucket))[index].fItem;
- }
-
- template<class Item, class Value, BC_Index Buckets, class StorageManager>
- const Value& BC_TUnboundedMap<Item, Value, Buckets, StorageManager>::
- ValueAt(BC_Index bucket, BC_Index index) const
- {
- return (*fRep.Bucket(bucket))[index].fValue;
- }
-