rearranged exception classes

This commit is contained in:
Jeff Hill
1999-08-09 21:32:30 +00:00
parent 64baafdd34
commit bf791d14dc
2 changed files with 96 additions and 30 deletions

View File

@@ -105,14 +105,6 @@ template <class T, class ID>
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<class T, class ID> member functions
/////////////////////////////////////////////////
@@ -308,7 +326,7 @@ resTable<T,ID>::resTable (unsigned nHashTableEntries) :
}
if ( nbits > ID::maxIndexBitWidth ) {
throw sizeExceedsMaxIndexWidth ();
throw resLib_sizeExceedsMaxIndexWidth ();
}
//
@@ -325,7 +343,7 @@ resTable<T,ID>::resTable (unsigned nHashTableEntries) :
this->nInUse = 0u;
this->pTable = new tsSLList<T> [1<<nbits];
if (this->pTable==0) {
throw dynamicMemoryAllocationFailed ();
throw resLib_dynamicMemoryAllocationFailed ();
}
}
@@ -561,15 +579,15 @@ resTable<T,ID>::~resTable()
if (this->pTable) {
this->destroyAllEntries();
if (this->nInUse != 0u) {
throw entryDidntRespondToDestroyVirtualFunction ();
throw resLib_entryDidntRespondToDestroyVirtualFunction ();
}
delete [] this->pTable;
}
}
//////////////////////////////////////////
//////////////////////////////////////////////
// chronIntIdResTable<ITEM> member functions
//////////////////////////////////////////
//////////////////////////////////////////////
//
// chronIntIdResTable<ITEM>::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

View File

@@ -105,14 +105,6 @@ template <class T, class ID>
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<class T, class ID> member functions
/////////////////////////////////////////////////
@@ -308,7 +326,7 @@ resTable<T,ID>::resTable (unsigned nHashTableEntries) :
}
if ( nbits > ID::maxIndexBitWidth ) {
throw sizeExceedsMaxIndexWidth ();
throw resLib_sizeExceedsMaxIndexWidth ();
}
//
@@ -325,7 +343,7 @@ resTable<T,ID>::resTable (unsigned nHashTableEntries) :
this->nInUse = 0u;
this->pTable = new tsSLList<T> [1<<nbits];
if (this->pTable==0) {
throw dynamicMemoryAllocationFailed ();
throw resLib_dynamicMemoryAllocationFailed ();
}
}
@@ -561,15 +579,15 @@ resTable<T,ID>::~resTable()
if (this->pTable) {
this->destroyAllEntries();
if (this->nInUse != 0u) {
throw entryDidntRespondToDestroyVirtualFunction ();
throw resLib_entryDidntRespondToDestroyVirtualFunction ();
}
delete [] this->pTable;
}
}
//////////////////////////////////////////
//////////////////////////////////////////////
// chronIntIdResTable<ITEM> member functions
//////////////////////////////////////////
//////////////////////////////////////////////
//
// chronIntIdResTable<ITEM>::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