From 6943e07f55c9fbd50ca0bc25ede057f1d6cbeba2 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 20 Nov 2000 20:52:01 +0000 Subject: [PATCH] added const traverse function --- src/libCom/cxxTemplates/resourceLib.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libCom/cxxTemplates/resourceLib.h b/src/libCom/cxxTemplates/resourceLib.h index 7a7283cd6..3986491e5 100644 --- a/src/libCom/cxxTemplates/resourceLib.h +++ b/src/libCom/cxxTemplates/resourceLib.h @@ -140,11 +140,14 @@ public: // typedef void (T::*pSetMFArg_t)(); # define pSetMFArg(ARG) pSetMFArg_t ARG + typedef void (T::*pSetMFArgConst_t)() const; +# define pSetMFArgConst(ARG) pSetMFArgConst_t ARG #else // // required by gnu g++ 2.7.2 // # define pSetMFArg(ARG) void (T:: * ARG)() +# define pSetMFArgConst(ARG) void (T:: * ARG)() const #endif // @@ -154,7 +157,8 @@ public: // a pointer to a member function of T with // no parameters that returns void // - void traverse ( pSetMFArg(pCB) ) const; + void traverse ( pSetMFArg(pCB) ); + void constTraverse ( pSetMFArgConst(pCB) ) const; private: tsSLList *pTable; @@ -438,6 +442,26 @@ void resTable::traverse (pSetMFArg(pCB)) const } } +// +// resTable::constTraverse +// +template +void resTable::consTraverse (pSetMFArgConst(pCB)) const +{ + tsSLList *pList; + + pList = this->pTable; + while ( pList < &this->pTable[this->hashIdMask+1] ) { + tsSLIter pItem ( pList->first () ); + while ( pItem.valid () ) { + T * p = & ( *pItem ); + (p->*pCB) (); + pItem = pItem.itemAfter (); + } + pList++; + } +} + // // add a res to the resTable //