summaryrefslogtreecommitdiff
path: root/utils/IdTable.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/IdTable.h')
-rw-r--r--utils/IdTable.h82
1 files changed, 40 insertions, 42 deletions
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 ITEM> class CcuIdTableOf : public CcuIdTable {
+template <class ITEM> 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 ITEM> class CcuIdIterOf : public CcuIdIter {
+template <class ITEM> class IvlIdIterOf : public IvlIdIter {
public:
-inline CcuIdIterOf (CcuIdTableOf <ITEM> & t) : CcuIdIter (t) { }
-inline CcuIdIterOf<ITEM>& operator = (const CcuIdTableOf <ITEM>& t) { return (CcuIdIterOf<ITEM>&) CcuIdIter::operator = (t); }
-inline CcuIdIterOf<ITEM>& operator = (const CcuIdIterOf<ITEM>& li) { return (CcuIdIterOf<ITEM>&) CcuIdIter::operator = (li); }
-inline CcuIdIterOf<ITEM>& operator ++ () { return (CcuIdIterOf<ITEM>&) CcuIdIter::operator ++ (); }
-inline ITEM* Current () const { return (ITEM*) CcuIdIter::Current (); }
+inline IvlIdIterOf (IvlIdTableOf <ITEM> & t) : IvlIdIter (t) { }
+inline IvlIdIterOf<ITEM>& operator = (const IvlIdTableOf <ITEM>& t) { return (IvlIdIterOf<ITEM>&) IvlIdIter::operator = (t); }
+inline IvlIdIterOf<ITEM>& operator = (const IvlIdIterOf<ITEM>& li) { return (IvlIdIterOf<ITEM>&) IvlIdIter::operator = (li); }
+inline IvlIdIterOf<ITEM>& operator ++ () { return (IvlIdIterOf<ITEM>&) IvlIdIter::operator ++ (); }
+inline ITEM* Current () const { return (ITEM*) IvlIdIter::Current (); }
inline ITEM* operator * () const { return Current (); }
};
-
-
#endif /* IdTable_H_ */