From 325530e630c68c7c10a2f4339f5b43434fcd0329 Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 14:19:35 +0000 Subject: Incorporation into IvyLeague Ccu -> Ivl ccu -> ivl Smart pointers disappear (too dangerous) Imakefile disappears (Makefile now) An empty cplus_bugs.h has been created locally --- utils/IdTable.h | 82 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 42 deletions(-) (limited to 'utils/IdTable.h') diff --git a/utils/IdTable.h b/utils/IdTable.h index e062ce2..aec3424 100644 --- a/utils/IdTable.h +++ b/utils/IdTable.h @@ -20,79 +20,77 @@ #include "word.h" #include "bool.h" -typedef void CcuIdItem; -typedef lword CcuID; -typedef sword CcuIdType; -typedef sword CcuIdIndex; +typedef void IvlIdItem; +typedef lword IvlID; +typedef sword IvlIdType; +typedef sword IvlIdIndex; -class CcuIdTable { -friend class CcuIdIter; -friend class CcuIdCell; +class IvlIdTable { +friend class IvlIdIter; +friend class IvlIdCell; protected: - CcuIdCell* Entries; // the table itself - CcuIdCell* LastCell; // its end - CcuIdIndex FirstFree; // index of first free entry - CcuIdIndex LastFree; // index of end of free list + IvlIdCell* Entries; // the table itself + IvlIdCell* LastCell; // its end + IvlIdIndex FirstFree; // index of first free entry + IvlIdIndex LastFree; // index of end of free list short NumFree; // number of free Entries bool Grow (int); public: - CcuIdTable (int); // initial size should be power of 2 + IvlIdTable (int); // initial size should be power of 2 - CcuID Store (CcuIdItem*, CcuIdType = 0); - CcuIdItem* Get (CcuID, CcuIdType* = 0); - CcuIdItem* Remove (CcuID, bool* = 0, CcuIdType* = 0); - void Change (CcuID, CcuIdItem*, CcuIdType = 0); + IvlID Store (IvlIdItem*, IvlIdType = 0); + IvlIdItem* Get (IvlID, IvlIdType* = 0); + IvlIdItem* Remove (IvlID, bool* = 0, IvlIdType* = 0); + void Change (IvlID, IvlIdItem*, IvlIdType = 0); }; -class CcuIdIter { +class IvlIdIter { public: enum iditer_status { Normal, StartOfTable, EndOfTable }; protected: - const CcuIdTable* TheTable; + const IvlIdTable* TheTable; iditer_status StatusFlag; - CcuIdCell* Entries; - CcuIdCell* CurCell; + IvlIdCell* Entries; + IvlIdCell* CurCell; public: -inline CcuIdIter (const CcuIdTable& t) : TheTable (&t), StatusFlag (StartOfTable) { CurCell = Entries = t.Entries; } +inline IvlIdIter (const IvlIdTable& t) : TheTable (&t), StatusFlag (StartOfTable) { CurCell = Entries = t.Entries; } inline void Reset () { CurCell = Entries = TheTable->Entries; StatusFlag = StartOfTable; } -inline CcuIdIter& operator = (const CcuIdTable& t) { TheTable = &t; StatusFlag = StartOfTable; CurCell = Entries = t.Entries; return *this; } -inline CcuIdIter& operator = (const CcuIdIter& it) { TheTable = it.TheTable; StatusFlag = it.StatusFlag; CurCell = it.CurCell; Entries = it.Entries; return *this; } +inline IvlIdIter& operator = (const IvlIdTable& t) { TheTable = &t; StatusFlag = StartOfTable; CurCell = Entries = t.Entries; return *this; } +inline IvlIdIter& operator = (const IvlIdIter& it) { TheTable = it.TheTable; StatusFlag = it.StatusFlag; CurCell = it.CurCell; Entries = it.Entries; return *this; } - CcuIdIter& operator ++ (); - CcuIdItem* Current () const; -inline CcuIdItem* operator * () const { return Current (); } + IvlIdIter& operator ++ (); + IvlIdItem* Current () const; +inline IvlIdItem* operator * () const { return Current (); } inline operator int () const { return StatusFlag == Normal; } - CcuIdType CurType () const; - CcuID CurId () const; + IvlIdType CurType () const; + IvlID CurId () const; }; -template class CcuIdTableOf : public CcuIdTable { +template class IvlIdTableOf : public IvlIdTable { public: -inline CcuIdTableOf (int sz) : CcuIdTable (sz) {} +inline IvlIdTableOf (int sz) : IvlIdTable (sz) {} -inline CcuID Store (ITEM* it, CcuIdType typ = 0) { return CcuIdTable::Store (it, typ); } -inline ITEM* Get (CcuID id, CcuIdType* typ = 0) { return (ITEM*) CcuIdTable::Get (id, typ); } -inline ITEM* Remove (CcuID id, bool* f = 0, CcuIdType* t = 0) { return (ITEM*) CcuIdTable::Remove (id, f, t); } -inline void Change (CcuID id, ITEM* i, CcuIdType t = 0) { CcuIdTable::Change (id, i, t); } +inline IvlID Store (ITEM* it, IvlIdType typ = 0) { return IvlIdTable::Store (it, typ); } +inline ITEM* Get (IvlID id, IvlIdType* typ = 0) { return (ITEM*) IvlIdTable::Get (id, typ); } +inline ITEM* Remove (IvlID id, bool* f = 0, IvlIdType* t = 0) { return (ITEM*) IvlIdTable::Remove (id, f, t); } +inline void Change (IvlID id, ITEM* i, IvlIdType t = 0) { IvlIdTable::Change (id, i, t); } }; -template class CcuIdIterOf : public CcuIdIter { +template class IvlIdIterOf : public IvlIdIter { public: -inline CcuIdIterOf (CcuIdTableOf & t) : CcuIdIter (t) { } -inline CcuIdIterOf& operator = (const CcuIdTableOf & t) { return (CcuIdIterOf&) CcuIdIter::operator = (t); } -inline CcuIdIterOf& operator = (const CcuIdIterOf& li) { return (CcuIdIterOf&) CcuIdIter::operator = (li); } -inline CcuIdIterOf& operator ++ () { return (CcuIdIterOf&) CcuIdIter::operator ++ (); } -inline ITEM* Current () const { return (ITEM*) CcuIdIter::Current (); } +inline IvlIdIterOf (IvlIdTableOf & t) : IvlIdIter (t) { } +inline IvlIdIterOf& operator = (const IvlIdTableOf & t) { return (IvlIdIterOf&) IvlIdIter::operator = (t); } +inline IvlIdIterOf& operator = (const IvlIdIterOf& li) { return (IvlIdIterOf&) IvlIdIter::operator = (li); } +inline IvlIdIterOf& operator ++ () { return (IvlIdIterOf&) IvlIdIter::operator ++ (); } +inline ITEM* Current () const { return (ITEM*) IvlIdIter::Current (); } inline ITEM* operator * () const { return Current (); } }; - - #endif /* IdTable_H_ */ -- cgit v1.1