From bf791d14dc6af680f20654f4b83beb199fbaa22f Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 9 Aug 1999 21:32:30 +0000 Subject: [PATCH] rearranged exception classes --- src/cxxTemplates/resourceLib.h | 63 ++++++++++++++++++++------- src/libCom/cxxTemplates/resourceLib.h | 63 ++++++++++++++++++++------- 2 files changed, 96 insertions(+), 30 deletions(-) diff --git a/src/cxxTemplates/resourceLib.h b/src/cxxTemplates/resourceLib.h index 9dade14cd..00d0c1b53 100644 --- a/src/cxxTemplates/resourceLib.h +++ b/src/cxxTemplates/resourceLib.h @@ -105,14 +105,6 @@ template class resTable { public: - // - // exceptions thrown by this class - // - class resourceWithThatNameIsAlreadyInstalled {}; - class dynamicMemoryAllocationFailed {}; - class entryDidntRespondToDestroyVirtualFunction {}; - class sizeExceedsMaxIndexWidth {}; - resTable (unsigned nHashTableEntries); virtual ~resTable(); @@ -258,7 +250,6 @@ private: class epicsShareClass stringId { public: - class dynamicMemoryAllocationFailed {}; // exception enum allocationType {copyString, refString}; @@ -284,6 +275,33 @@ private: static const unsigned char fastHashPermutedIndexSpace[256]; }; +// +// exceptions thrown by this library +// +class epicsShareClass resLib_resourceWithThatNameIsAlreadyInstalled +{ +public: + resLib_resourceWithThatNameIsAlreadyInstalled (); +}; + +class epicsShareClass resLib_dynamicMemoryAllocationFailed +{ +public: + resLib_dynamicMemoryAllocationFailed (); +}; + +class epicsShareClass resLib_entryDidntRespondToDestroyVirtualFunction +{ +public: + resLib_entryDidntRespondToDestroyVirtualFunction (); +}; + +class epicsShareClass resLib_sizeExceedsMaxIndexWidth +{ +public: + resLib_sizeExceedsMaxIndexWidth (); +}; + ///////////////////////////////////////////////// // resTable member functions ///////////////////////////////////////////////// @@ -308,7 +326,7 @@ resTable::resTable (unsigned nHashTableEntries) : } if ( nbits > ID::maxIndexBitWidth ) { - throw sizeExceedsMaxIndexWidth (); + throw resLib_sizeExceedsMaxIndexWidth (); } // @@ -325,7 +343,7 @@ resTable::resTable (unsigned nHashTableEntries) : this->nInUse = 0u; this->pTable = new tsSLList [1<pTable==0) { - throw dynamicMemoryAllocationFailed (); + throw resLib_dynamicMemoryAllocationFailed (); } } @@ -561,15 +579,15 @@ resTable::~resTable() if (this->pTable) { this->destroyAllEntries(); if (this->nInUse != 0u) { - throw entryDidntRespondToDestroyVirtualFunction (); + throw resLib_entryDidntRespondToDestroyVirtualFunction (); } delete [] this->pTable; } } -////////////////////////////////////////// +////////////////////////////////////////////// // chronIntIdResTable member functions -////////////////////////////////////////// +////////////////////////////////////////////// // // chronIntIdResTable::chronIntIdResTable() @@ -753,7 +771,7 @@ stringId::stringId (const char * idIn, allocationType typeIn) : memcpy ((void *)this->pStr, idIn, nChars); } else { - throw dynamicMemoryAllocationFailed (); + throw resLib_dynamicMemoryAllocationFailed (); } } else { @@ -886,6 +904,21 @@ const unsigned char stringId::fastHashPermutedIndexSpace[256] = { 134, 68, 93,183,241, 81,196, 49,192, 65,212, 94,203, 10,200, 47 }; +// +// instantiate exceptions +// +resLib_resourceWithThatNameIsAlreadyInstalled:: + resLib_resourceWithThatNameIsAlreadyInstalled () {} + +resLib_dynamicMemoryAllocationFailed:: + resLib_dynamicMemoryAllocationFailed () {} + +resLib_entryDidntRespondToDestroyVirtualFunction:: + resLib_entryDidntRespondToDestroyVirtualFunction () {} + +resLib_sizeExceedsMaxIndexWidth:: + resLib_sizeExceedsMaxIndexWidth () {} + #endif // if instantiateRecourceLib is defined #endif // INCresourceLibh diff --git a/src/libCom/cxxTemplates/resourceLib.h b/src/libCom/cxxTemplates/resourceLib.h index 9dade14cd..00d0c1b53 100644 --- a/src/libCom/cxxTemplates/resourceLib.h +++ b/src/libCom/cxxTemplates/resourceLib.h @@ -105,14 +105,6 @@ template class resTable { public: - // - // exceptions thrown by this class - // - class resourceWithThatNameIsAlreadyInstalled {}; - class dynamicMemoryAllocationFailed {}; - class entryDidntRespondToDestroyVirtualFunction {}; - class sizeExceedsMaxIndexWidth {}; - resTable (unsigned nHashTableEntries); virtual ~resTable(); @@ -258,7 +250,6 @@ private: class epicsShareClass stringId { public: - class dynamicMemoryAllocationFailed {}; // exception enum allocationType {copyString, refString}; @@ -284,6 +275,33 @@ private: static const unsigned char fastHashPermutedIndexSpace[256]; }; +// +// exceptions thrown by this library +// +class epicsShareClass resLib_resourceWithThatNameIsAlreadyInstalled +{ +public: + resLib_resourceWithThatNameIsAlreadyInstalled (); +}; + +class epicsShareClass resLib_dynamicMemoryAllocationFailed +{ +public: + resLib_dynamicMemoryAllocationFailed (); +}; + +class epicsShareClass resLib_entryDidntRespondToDestroyVirtualFunction +{ +public: + resLib_entryDidntRespondToDestroyVirtualFunction (); +}; + +class epicsShareClass resLib_sizeExceedsMaxIndexWidth +{ +public: + resLib_sizeExceedsMaxIndexWidth (); +}; + ///////////////////////////////////////////////// // resTable member functions ///////////////////////////////////////////////// @@ -308,7 +326,7 @@ resTable::resTable (unsigned nHashTableEntries) : } if ( nbits > ID::maxIndexBitWidth ) { - throw sizeExceedsMaxIndexWidth (); + throw resLib_sizeExceedsMaxIndexWidth (); } // @@ -325,7 +343,7 @@ resTable::resTable (unsigned nHashTableEntries) : this->nInUse = 0u; this->pTable = new tsSLList [1<pTable==0) { - throw dynamicMemoryAllocationFailed (); + throw resLib_dynamicMemoryAllocationFailed (); } } @@ -561,15 +579,15 @@ resTable::~resTable() if (this->pTable) { this->destroyAllEntries(); if (this->nInUse != 0u) { - throw entryDidntRespondToDestroyVirtualFunction (); + throw resLib_entryDidntRespondToDestroyVirtualFunction (); } delete [] this->pTable; } } -////////////////////////////////////////// +////////////////////////////////////////////// // chronIntIdResTable member functions -////////////////////////////////////////// +////////////////////////////////////////////// // // chronIntIdResTable::chronIntIdResTable() @@ -753,7 +771,7 @@ stringId::stringId (const char * idIn, allocationType typeIn) : memcpy ((void *)this->pStr, idIn, nChars); } else { - throw dynamicMemoryAllocationFailed (); + throw resLib_dynamicMemoryAllocationFailed (); } } else { @@ -886,6 +904,21 @@ const unsigned char stringId::fastHashPermutedIndexSpace[256] = { 134, 68, 93,183,241, 81,196, 49,192, 65,212, 94,203, 10,200, 47 }; +// +// instantiate exceptions +// +resLib_resourceWithThatNameIsAlreadyInstalled:: + resLib_resourceWithThatNameIsAlreadyInstalled () {} + +resLib_dynamicMemoryAllocationFailed:: + resLib_dynamicMemoryAllocationFailed () {} + +resLib_entryDidntRespondToDestroyVirtualFunction:: + resLib_entryDidntRespondToDestroyVirtualFunction () {} + +resLib_sizeExceedsMaxIndexWidth:: + resLib_sizeExceedsMaxIndexWidth () {} + #endif // if instantiateRecourceLib is defined #endif // INCresourceLibh