summaryrefslogtreecommitdiff
path: root/utils/List.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/List.h')
-rw-r--r--utils/List.h205
1 files changed, 104 insertions, 101 deletions
diff --git a/utils/List.h b/utils/List.h
index 5067da6..def2919 100644
--- a/utils/List.h
+++ b/utils/List.h
@@ -18,26 +18,26 @@
#include "cplus_bugs.h"
#include <sys/types.h>
-class CcuAllocator;
+class IvlAllocator;
-typedef void CcuListItem;
-typedef void* CcuListIndex;
+typedef void IvlListItem;
+typedef void* IvlListIndex;
#ifdef CPLUS_BUG20
-class CcuListLink;
+class IvlListLink;
#endif
-class CcuList {
-friend class CcuListIter;
+class IvlList {
+friend class IvlListIter;
#ifndef CPLUS_BUG20
- class CcuListLink {
- static CcuAllocator* ListLinkMem;
+ class IvlListLink {
+ static IvlAllocator* ListLinkMem;
public:
- CcuListItem* Entry;
- CcuListLink* Next;
- inline CcuListLink (CcuListItem* e, CcuListLink* n = 0) { Entry = e; Next = n ? n : this; }
- CcuListLink* Previous ();
+ IvlListItem* Entry;
+ IvlListLink* Next;
+ inline IvlListLink (IvlListItem* e, IvlListLink* n = 0) { Entry = e; Next = n ? n : this; }
+ IvlListLink* Previous ();
void* operator new (size_t);
void operator delete (void*);
};
@@ -49,155 +49,158 @@ public:
private:
- CcuListLink* LastLink;
+ IvlListLink* LastLink;
list_status StatusFlag;
- CcuListIndex InsertAfterLink (CcuListLink*, CcuListItem*);
- CcuListIndex InsertBeforeLink (CcuListLink*, CcuListItem*);
- CcuListItem* RemoveAfterLink (CcuListLink*);
+ IvlListIndex InsertAfterLink (IvlListLink*, IvlListItem*);
+ IvlListIndex InsertBeforeLink (IvlListLink*, IvlListItem*);
+ IvlListItem* RemoveAfterLink (IvlListLink*);
public:
-inline CcuList () : LastLink (0), StatusFlag (NoError) { }
- CcuList (CcuListItem*);
- CcuList (const CcuList&);
- ~CcuList ();
- CcuList& operator = (const CcuList&);
+inline IvlList () : LastLink (0), StatusFlag (NoError) { }
+ IvlList (IvlListItem*);
+ IvlList (const IvlList&);
+ ~IvlList ();
+ IvlList& operator = (const IvlList&);
inline list_status GetStatus () const { return StatusFlag; }
inline int IsEmpty () const { return !LastLink; }
- CcuListItem* First ();
- CcuListItem* Last ();
- CcuListItem* Nth (int n);
+ IvlListItem* First ();
+ IvlListItem* Last ();
+ IvlListItem* Nth (int n);
int Length () const;
- int Find (CcuListItem*, int* = 0) const;
+ int Find (IvlListItem*, int* = 0) const;
- CcuListIndex Append (CcuListItem*);
- CcuListIndex Prepend (CcuListItem*);
-inline CcuList& operator << (CcuListItem* it) { Append (it); return *this; }
+ IvlListIndex Append (IvlListItem*);
+ IvlListIndex Prepend (IvlListItem*);
+inline IvlList& operator << (IvlListItem* it) { Append (it); return *this; }
- CcuListItem* RemoveFirst ();
- CcuListItem* RemoveLast ();
- int Remove (CcuListItem*, int = 1);
- int Remove (int (*) (CcuListItem*), int = 1);
+ IvlListItem* RemoveFirst ();
+ IvlListItem* RemoveLast ();
+ int Remove (IvlListItem*, int = 1);
+ int Remove (int (*) (IvlListItem*), int = 1);
void Clear ();
- CcuListIndex InsertAfter (const CcuListIter&, CcuListItem*);
- CcuListIndex InsertBefore (const CcuListIter&, CcuListItem*);
- CcuListItem* RemoveAfter (const CcuListIter&);
+ IvlListIndex InsertAfter (const IvlListIter&, IvlListItem*);
+ IvlListIndex InsertBefore (const IvlListIter&, IvlListItem*);
+ IvlListItem* RemoveAfter (const IvlListIter&);
};
-class CcuListIter {
-friend class CcuList;
+class IvlListIter {
+friend class IvlList;
public:
enum listiter_status { Normal, StartOfList, EndOfList };
private:
- const CcuList* TheList;
+ const IvlList* TheList;
#ifdef CPLUS_BUG20
- CcuListLink* CurLink;
+ IvlListLink* CurLink;
#else
- CcuList::CcuListLink* CurLink;
+ IvlList::IvlListLink* CurLink;
#endif
listiter_status StatusFlag;
public:
-inline CcuListIter (const CcuList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) { }
- CcuListIter (const CcuList&, CcuListIndex);
+inline IvlListIter (const IvlList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) { }
+ IvlListIter (const IvlList&, IvlListIndex);
inline void Reset () { CurLink = 0; StatusFlag = StartOfList; }
-inline CcuListIter& operator = (const CcuList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; }
-inline CcuListIter& operator = (const CcuListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; }
- CcuListIter& operator ++ ();
+inline IvlListIter& operator = (const IvlList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; }
+inline IvlListIter& operator = (const IvlListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; }
+ IvlListIter& operator ++ ();
#ifndef CPLUS_BUG16
- CcuListIter& operator ++ (int);
+ IvlListIter& operator ++ (int);
#endif
- CcuListItem* operator * () const;
- int Find (CcuListItem*);
+ IvlListItem* operator * () const;
+ int Find (IvlListItem*);
inline listiter_status GetStatus () const { return StatusFlag; }
inline operator int () const { return StatusFlag == Normal; }
};
#ifndef CPLUS_BUG19
-template <class ITEM> class CcuListIterOf;
+template <class ITEM> class IvlListIterOf;
-template <class ITEM> class CcuListOf : public CcuList {
+template <class ITEM> class IvlListOf : public IvlList {
public:
-inline CcuListOf () : CcuList () {}
-inline CcuListOf (ITEM* it) : CcuList (it) {}
-inline ITEM* First () { return (ITEM*) (CcuList::First ()); }
-inline ITEM* Last () { return (ITEM*) (CcuList::Last ()); }
-inline ITEM* Nth (int n) { return (ITEM*) (CcuList::Nth (n)); }
-inline int Find (ITEM* it, int* r = 0) const { return CcuList::Find (it, r); }
-
-inline CcuListIndex Append (ITEM* it) { return CcuList::Append (it); }
-inline CcuListIndex Prepend (ITEM* it) { return CcuList::Prepend (it); }
-inline CcuListOf<ITEM>& operator << (ITEM* it) { CcuList::Append (it); return *this; }
-
-inline ITEM* RemoveFirst () { return (ITEM*) (CcuList::RemoveFirst ()); }
-inline ITEM* RemoveLast () { return (ITEM*) (CcuList::RemoveLast ()); }
-inline int Remove (ITEM* it, int nb = 1) { return CcuList::Remove (it, nb); }
-inline int Remove (int (*p) (ITEM*), int nb = 1) { return CcuList::Remove ((int (*) (void*)) p, nb); }
-
-inline CcuListIndex InsertAfter (const CcuListIterOf <ITEM>& li, ITEM*it) { return CcuList::InsertAfter (li, it); }
-inline CcuListIndex InsertBefore (const CcuListIterOf <ITEM>& li, ITEM* it) { return CcuList::InsertBefore (li, it); }
-inline ITEM* RemoveAfter (const CcuListIterOf <ITEM>& li) { return (ITEM*) CcuList::RemoveAfter (li); }
+inline IvlListOf () : IvlList () {}
+inline IvlListOf (ITEM* it) : IvlList (it) {}
+inline ITEM* First () { return (ITEM*) (IvlList::First ()); }
+inline ITEM* Last () { return (ITEM*) (IvlList::Last ()); }
+inline ITEM* Nth (int n) { return (ITEM*) (IvlList::Nth (n)); }
+inline int Find (ITEM* it, int* r = 0) const { return IvlList::Find (it, r); }
+
+inline IvlListIndex Append (ITEM* it) { return IvlList::Append (it); }
+inline IvlListIndex Prepend (ITEM* it) { return IvlList::Prepend (it); }
+inline IvlListOf<ITEM>& operator << (ITEM* it) { IvlList::Append (it); return *this; }
+
+inline ITEM* RemoveFirst () { return (ITEM*) (IvlList::RemoveFirst ()); }
+inline ITEM* RemoveLast () { return (ITEM*) (IvlList::RemoveLast ()); }
+inline int Remove (ITEM* it, int nb = 1) { return IvlList::Remove (it, nb); }
+inline int Remove (int (*p) (ITEM*), int nb = 1) { return IvlList::Remove ((int (*) (void*)) p, nb); }
+
+inline IvlListIndex InsertAfter (const IvlListIterOf <ITEM>& li, ITEM*it) { return IvlList::InsertAfter (li, it); }
+inline IvlListIndex InsertBefore (const IvlListIterOf <ITEM>& li, ITEM* it) { return IvlList::InsertBefore (li, it); }
+inline ITEM* RemoveAfter (const IvlListIterOf <ITEM>& li) { return (ITEM*) IvlList::RemoveAfter (li); }
};
-template <class ITEM> class CcuListIterOf : public CcuListIter {
+template <class ITEM> class IvlListIterOf : public IvlListIter {
public:
-inline CcuListIterOf (const CcuListOf <ITEM>& l) : CcuListIter (l) { }
-inline CcuListIterOf<ITEM>& operator = (const CcuListOf <ITEM>& l) { return (CcuListIterOf <ITEM>&) CcuListIter::operator = (l); }
-inline CcuListIterOf<ITEM>& operator = (const CcuListIterOf <ITEM>& li) { return (CcuListIterOf <ITEM>&) CcuListIter::operator = (li); }
-inline CcuListIterOf<ITEM>& operator ++ () { return (CcuListIterOf <ITEM>&) CcuListIter::operator ++ (); }
-inline ITEM* operator * () const { return (ITEM*) CcuListIter::operator * (); }
-inline int Find (ITEM* it) { return CcuListIter::Find (it); }
+inline IvlListIterOf (const IvlListOf <ITEM>& l) : IvlListIter (l) { }
+inline IvlListIterOf<ITEM>& operator = (const IvlListOf <ITEM>& l) { return (IvlListIterOf <ITEM>&) IvlListIter::operator = (l); }
+inline IvlListIterOf<ITEM>& operator = (const IvlListIterOf <ITEM>& li) { return (IvlListIterOf <ITEM>&) IvlListIter::operator = (li); }
+inline IvlListIterOf<ITEM>& operator ++ () { return (IvlListIterOf <ITEM>&) IvlListIter::operator ++ (); }
+inline ITEM* operator * () const { return (ITEM*) IvlListIter::operator * (); }
+inline int Find (ITEM* it) { return IvlListIter::Find (it); }
};
#endif /* CPLUS_BUG19 */
-typedef CcuListItem CcuStackItem;
+typedef IvlListItem IvlStackItem;
/* CPLUS_BUG10 */
-class CcuStack : _private CcuList {
+class IvlStack : _private IvlList {
public:
- CcuList :: Clear;
- CcuList :: IsEmpty;
- CcuList :: GetStatus;
-inline void Push (CcuStackItem* p) { Prepend (p); }
-inline CcuStackItem* Pop () { return RemoveFirst (); }
-inline CcuStackItem* Top () { return First (); }
+ IvlList :: Clear;
+ IvlList :: IsEmpty;
+ IvlList :: GetStatus;
+inline void Push (IvlStackItem* p) { Prepend (p); }
+inline IvlStackItem* Pop () { return RemoveFirst (); }
+inline IvlStackItem* Top () { return First (); }
};
#ifndef CPLUS_BUG19
-template <class ITEM> class CcuStackOf : public CcuStack {
+template <class ITEM> class IvlStackOf : public IvlStack {
public:
-inline void Push (ITEM* p) { CcuStack::Push (p); }
-inline ITEM* Pop () { return (ITEM*) CcuStack::Pop (); }
-inline ITEM* Top () { return (ITEM*) CcuStack::Top (); }
-inline operator const CcuListOf <ITEM>& () { return *(CcuListOf <ITEM>*) this; }
+inline void Push (ITEM* p) { IvlStack::Push (p); }
+inline ITEM* Pop () { return (ITEM*) IvlStack::Pop (); }
+inline ITEM* Top () { return (ITEM*) IvlStack::Top (); }
+inline operator const IvlListOf <ITEM>& () { return *(IvlListOf <ITEM>*) this; }
};
#endif /* CPLUS_BUG19 */
-typedef CcuListItem CcuQueueItem;
+typedef IvlListItem IvlQueueItem;
+#if 0
/* CPLUS_BUG10 */
-class CcuQueue : _private CcuList {
+class IvlQueue : _private IvlList {
public:
- CcuList :: Clear;
- CcuList :: IsEmpty;
- CcuList :: GetStatus;
-inline void Put (CcuQueueItem* p) { Append (p); }
-inline CcuQueueItem* Get () { return RemoveFirst (); }
-inline operator const CcuList& () { return *this; }
+ IvlList :: Clear;
+ IvlList :: IsEmpty;
+ IvlList :: GetStatus;
+inline void Put (IvlQueueItem* p) { Append (p); }
+inline IvlQueueItem* Get () { return RemoveFirst (); }
+inline operator const IvlList& () { return *this; }
};
#ifndef CPLUS_BUG19
-template <class ITEM> class CcuQueueOf : public CcuQueue {
+template <class ITEM> class IvlQueueOf : public IvlQueue {
public:
-inline void Put (ITEM* p) { CcuQueue::Put (p); }
-inline ITEM* Get () { return (ITEM*) CcuQueue::Get (); }
-inline operator const CcuListOf <ITEM>& () { return *(CcuListOf <ITEM>*) this; }
+inline void Put (ITEM* p) { IvlQueue::Put (p); }
+inline ITEM* Get () { return (ITEM*) IvlQueue::Get (); }
+inline operator const IvlListOf <ITEM>& () { return *(IvlListOf <ITEM>*) this; }
};
#endif /* CPLUS_BUG19 */
+#endif /* 0 */
+
#endif /* List_H_ */