diff --git a/src/libCom/cxxTemplates/resourceLib.h b/src/libCom/cxxTemplates/resourceLib.h index a31d1fb63..7a7283cd6 100644 --- a/src/libCom/cxxTemplates/resourceLib.h +++ b/src/libCom/cxxTemplates/resourceLib.h @@ -67,22 +67,15 @@ template class resTableIter; // This class stores resource entries of type T which can be efficiently // located with a hash key of type ID. // -// // NOTES: // 1) class T _must_ derive from class ID and also from class tsSLNode // -// 2) Classes of type T installed into this resTable must implement a -// "void destroy ()" method which is called by ~resTable() for each -// resource entry in the resTable. The destroy() method should at a minimum -// remove the resource from the resTable, and might also choose to (at your -// own discretion) "delete" the item itself. -// -// 3) If the "resTable::show (unsigned level)" member function is called then +// 2) If the "resTable::show (unsigned level)" member function is called then // class T must also implement a "show (unsigned level)" member function which // dumps increasing diagnostics information with increasing "level" to // standard out. // -// 4) Classes of type ID must implement the following member functions: +// 3) Classes of type ID must implement the following member functions: // // // equivalence test // bool operator == (const ID &); @@ -90,7 +83,7 @@ template class resTableIter; // // ID to hash index convert (see examples below) // resTableIndex hash (unsigned nBitsHashIndex) const; // -// 5) Classes of type ID must provide the following member functions +// 4) Classes of type ID must provide the following member functions // (which will usually be static const inline for improved performance). // They determine the minimum and maximum number of elements in the hash // table. If minIndexBitWidth() == maxIndexBitWidth() then the hash table @@ -102,7 +95,7 @@ template class resTableIter; // max number of hash table elements = 1 << maxIndexBitWidth(); // min number of hash table elements = 1 << minIndexBitWidth(); // -// 6) Storage for identifier of type ID must persist until the item of type +// 5) Storage for identifier of type ID must persist until the item of type // T is deleted from the resTable // template @@ -114,15 +107,12 @@ public: // exceptions thrown // class epicsShareClass dynamicMemoryAllocationFailed {}; - class epicsShareClass entryDidntRespondToDestroyVirtualFunction {}; class epicsShareClass sizeExceedsMaxIndexWidth {}; resTable (unsigned nHashTableEntries); virtual ~resTable(); - void destroyAllEntries(); // destroy all entries - // // Call (pT->show) (level) for each entry // where pT is a pointer to type T. Show @@ -164,7 +154,7 @@ public: // a pointer to a member function of T with // no parameters that returns void // - void traverse (pSetMFArg(pCB)) const; + void traverse ( pSetMFArg(pCB) ) const; private: tsSLList *pTable; @@ -378,45 +368,6 @@ inline resTableIndex resTable::hash (const ID & idIn) const return idIn.hash (this->hashIdNBits) & this->hashIdMask; } -// -// resTable::destroyAllEntries() -// -template -void resTable::destroyAllEntries() -{ - tsSLList *pList = this->pTable; - - while (pList<&this->pTable[this->hashIdMask+1]) { - { - tsSLIter iter ( pList->first () ); - while ( iter.valid () ) { - tsSLIter iterTmp = iter.itemAfter (); - iter->destroy(); - iter = iterTmp; - } - } - - // - // Check to see if a defective class is - // installed that does not remove itself - // from the resTable when it is destroyed. - // - { - T *pItem; - while ( ( pItem = pList->get () ) ) { - fprintf ( stderr, -"Warning: Defective class still in resTable after it was destroyed\n" ); - // - // remove defective class - // - this->nInUse--; - } - } - - pList++; - } -} - // // resTable::show // @@ -576,10 +527,6 @@ template resTable::~resTable() { if (this->pTable) { - this->destroyAllEntries(); - if (this->nInUse != 0u) { - throwWithLocation ( entryDidntRespondToDestroyVirtualFunction () ); - } delete [] this->pTable; } }