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/DList.h | 156 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 77 insertions(+), 79 deletions(-) (limited to 'utils/DList.h') diff --git a/utils/DList.h b/utils/DList.h index cba72f1..8483db3 100644 --- a/utils/DList.h +++ b/utils/DList.h @@ -18,26 +18,26 @@ #include "cplus_bugs.h" #include -class CcuAllocator; +class IvlAllocator; -typedef void CcuDListItem; +typedef void IvlDListItem; #ifdef CPLUS_BUG20 -class CcuDListLink; +class IvlDListLink; #endif -class CcuDList { -friend class CcuDListIter; +class IvlDList { +friend class IvlDListIter; #ifndef CPLUS_BUG20 - class CcuDListLink { - static CcuAllocator* DListLinkMem; + class IvlDListLink { + static IvlAllocator* DListLinkMem; public: - CcuDListItem* Entry; - CcuDListLink* Previous; - CcuDListLink* Next; - inline CcuDListLink (CcuDListItem* e, CcuDListLink* p) : Entry (e), Previous (p), Next (p->Next) { Previous->Next = Next->Previous = this; } - inline CcuDListLink (CcuDListItem* e) : Entry (e), Previous (this), Next (this) {} + IvlDListItem* Entry; + IvlDListLink* Previous; + IvlDListLink* Next; + inline IvlDListLink (IvlDListItem* e, IvlDListLink* p) : Entry (e), Previous (p), Next (p->Next) { Previous->Next = Next->Previous = this; } + inline IvlDListLink (IvlDListItem* e) : Entry (e), Previous (this), Next (this) {} void* operator new (size_t); void operator delete (void*); }; @@ -49,112 +49,110 @@ public: private: - CcuDListLink* LastLink; + IvlDListLink* LastLink; dlist_status StatusFlag; - void InsertAfterLink (CcuDListLink*, CcuDListItem*); - CcuDListItem* RemoveLink (CcuDListLink*); + void InsertAfterLink (IvlDListLink*, IvlDListItem*); + IvlDListItem* RemoveLink (IvlDListLink*); public: -inline CcuDList () : LastLink (0), StatusFlag (NoError) { } - CcuDList (CcuDListItem*); - CcuDList (const CcuDList&); - ~CcuDList (); - CcuDList& operator = (const CcuDList&); +inline IvlDList () : LastLink (0), StatusFlag (NoError) { } + IvlDList (IvlDListItem*); + IvlDList (const IvlDList&); + ~IvlDList (); + IvlDList& operator = (const IvlDList&); inline dlist_status GetStatus () const { return StatusFlag; } inline int IsEmpty () const { return !LastLink; } - CcuDListItem* First (); - CcuDListItem* Last (); - CcuDListItem* Nth (int n); + IvlDListItem* First (); + IvlDListItem* Last (); + IvlDListItem* Nth (int n); int Length () const; - int Find (CcuDListItem*) const; + int Find (IvlDListItem*) const; - void Append (CcuDListItem*); - void Prepend (CcuDListItem*); -inline CcuDList& operator << (CcuDListItem* it) { Append (it); return *this; } + void Append (IvlDListItem*); + void Prepend (IvlDListItem*); +inline IvlDList& operator << (IvlDListItem* it) { Append (it); return *this; } - CcuDListItem* RemoveFirst (); - CcuDListItem* RemoveLast (); - int Remove (CcuDListItem*, int = 1); - int Remove (int (*) (CcuDListItem*), int = 1); + IvlDListItem* RemoveFirst (); + IvlDListItem* RemoveLast (); + int Remove (IvlDListItem*, int = 1); + int Remove (int (*) (IvlDListItem*), int = 1); void Clear (); - void InsertAfter (const CcuDListIter&, CcuDListItem*); - void InsertBefore (const CcuDListIter&, CcuDListItem*); - CcuDListItem* RemoveAfter (const CcuDListIter&); - CcuDListItem* RemoveAt (CcuDListIter&); + void InsertAfter (const IvlDListIter&, IvlDListItem*); + void InsertBefore (const IvlDListIter&, IvlDListItem*); + IvlDListItem* RemoveAfter (const IvlDListIter&); + IvlDListItem* RemoveAt (IvlDListIter&); }; -class CcuDListIter { -friend class CcuDList; +class IvlDListIter { +friend class IvlDList; public: enum dlistiter_status { Normal, StartOfList, EndOfList }; private: - const CcuDList* TheList; + const IvlDList* TheList; #ifdef CPLUS_BUG20 - CcuDListLink* CurLink; + IvlDListLink* CurLink; #else - CcuDList::CcuDListLink* CurLink; + IvlDList::IvlDListLink* CurLink; #endif dlistiter_status StatusFlag; public: -inline CcuDListIter (const CcuDList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) {} +inline IvlDListIter (const IvlDList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) {} inline void Reset () { CurLink = 0; StatusFlag = StartOfList; } inline void GotoEnd () { CurLink = TheList->LastLink; StatusFlag = CurLink ? EndOfList : StartOfList; } -inline CcuDListIter& operator = (const CcuDList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; } -inline CcuDListIter& operator = (const CcuDListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; } - CcuDListIter& operator ++ (); - CcuDListIter& operator -- (); - int Find (CcuDListItem*); - int FindBack (CcuDListItem*); - CcuDListItem* operator * () const; +inline IvlDListIter& operator = (const IvlDList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; } +inline IvlDListIter& operator = (const IvlDListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; } + IvlDListIter& operator ++ (); + IvlDListIter& operator -- (); + int Find (IvlDListItem*); + int FindBack (IvlDListItem*); + IvlDListItem* operator * () const; inline dlistiter_status GetStatus () const { return StatusFlag; } inline operator int () const { return StatusFlag == Normal; } }; - #ifndef CPLUS_BUG19 -template class CcuDListIterOf; +template class IvlDListIterOf; -template class CcuDListOf : public CcuDList { +template class IvlDListOf : public IvlDList { public: -inline CcuDListOf () : CcuDList () {} -inline CcuDListOf (ITEM* it) : CcuDList (it) {} -inline ITEM* First () { return (ITEM*) (CcuDList::First ()); } -inline ITEM* Last () { return (ITEM*) (CcuDList::Last ()); } -inline ITEM* Nth (int n) { return (ITEM*) (CcuDList::Nth (n)); } -inline int Find (ITEM* it) const { return CcuDList::Find (it); } - -inline void Append (ITEM* it) { CcuDList::Append (it); } -inline void Prepend (ITEM* it) { CcuDList::Prepend (it); } -inline CcuDListOf & operator << (ITEM* it) { CcuDList::Append (it); return *this; } - -inline ITEM* RemoveFirst () { return (ITEM*) (CcuDList::RemoveFirst ()); } -inline ITEM* RemoveLast () { return (ITEM*) (CcuDList::RemoveLast ()); } -inline int Remove (ITEM* it, int nb = 1) { return CcuDList::Remove (it, nb); } -inline int Remove (int (*p) (ITEM*), int nb = 1) { return CcuDList::Remove ((int (*) (ITEM*)) p, nb); } - -inline void InsertAfter (const CcuDListIterOf & li, ITEM*it) { CcuDList::InsertAfter (li, it); } -inline void InsertBefore (const CcuDListIterOf & li, ITEM* it) { CcuDList::InsertBefore (li, it); } -inline ITEM* RemoveAfter (const CcuDListIterOf & li) { return (ITEM*) CcuDList::RemoveAfter (li); } -inline ITEM* RemoveAt (CcuDListIterOf & li) { return (ITEM*) CcuDList::RemoveAfter (li); } +inline IvlDListOf () : IvlDList () {} +inline IvlDListOf (ITEM* it) : IvlDList (it) {} +inline ITEM* First () { return (ITEM*) (IvlDList::First ()); } +inline ITEM* Last () { return (ITEM*) (IvlDList::Last ()); } +inline ITEM* Nth (int n) { return (ITEM*) (IvlDList::Nth (n)); } +inline int Find (ITEM* it) const { return IvlDList::Find (it); } + +inline void Append (ITEM* it) { IvlDList::Append (it); } +inline void Prepend (ITEM* it) { IvlDList::Prepend (it); } +inline IvlDListOf & operator << (ITEM* it) { IvlDList::Append (it); return *this; } + +inline ITEM* RemoveFirst () { return (ITEM*) (IvlDList::RemoveFirst ()); } +inline ITEM* RemoveLast () { return (ITEM*) (IvlDList::RemoveLast ()); } +inline int Remove (ITEM* it, int nb = 1) { return IvlDList::Remove (it, nb); } +inline int Remove (int (*p) (ITEM*), int nb = 1) { return IvlDList::Remove ((int (*) (ITEM*)) p, nb); } + +inline void InsertAfter (const IvlDListIterOf & li, ITEM*it) { IvlDList::InsertAfter (li, it); } +inline void InsertBefore (const IvlDListIterOf & li, ITEM* it) { IvlDList::InsertBefore (li, it); } +inline ITEM* RemoveAfter (const IvlDListIterOf & li) { return (ITEM*) IvlDList::RemoveAfter (li); } +inline ITEM* RemoveAt (IvlDListIterOf & li) { return (ITEM*) IvlDList::RemoveAfter (li); } }; -template class CcuDListIterOf : public CcuDListIter { +template class IvlDListIterOf : public IvlDListIter { public: -inline CcuDListIterOf (const CcuDListOf & l) : CcuDListIter (l) { } -inline CcuDListIterOf & operator = (const CcuDListOf & l) { return (CcuDListIterOf &) CcuDListIter::operator = (l); } -inline CcuDListIterOf & operator = (const CcuDListIterOf & li) { return (CcuDListIterOf &) CcuDListIter::operator = (li); } -inline ITEM* operator * () const { return (ITEM*) CcuDListIter::operator * (); } -inline int Find (ITEM* it) { return CcuDListIter::Find (it); } -inline int FindBack (ITEM* it) { return CcuDListIter::FindBack (it); } +inline IvlDListIterOf (const IvlDListOf & l) : IvlDListIter (l) { } +inline IvlDListIterOf & operator = (const IvlDListOf & l) { return (IvlDListIterOf &) IvlDListIter::operator = (l); } +inline IvlDListIterOf & operator = (const IvlDListIterOf & li) { return (IvlDListIterOf &) IvlDListIter::operator = (li); } +inline ITEM* operator * () const { return (ITEM*) IvlDListIter::operator * (); } +inline int Find (ITEM* it) { return IvlDListIter::Find (it); } +inline int FindBack (ITEM* it) { return IvlDListIter::FindBack (it); } }; #endif /* CPLUS_BUG19 */ - #endif /* DList_H_ */ -- cgit v1.1