![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
TableB.cppGo to the documentation of this file.00001 00020 #include "TableB.h" // header file 00021 00022 void Table::tableInsert(const TableItemType& newItem) 00023 throw(TableException) 00024 { 00025 try 00026 { 00027 bst.searchTreeInsert(newItem); 00028 ++size; 00029 } // end try 00030 catch (TreeException e) 00031 { throw TableException( 00032 "TableException: tableInsert cannot allocate memory"); 00033 } // end catch 00034 } // end tableInsert 00035 00036 void Table::tableDelete(KeyType searchKey) 00037 throw(TableException) 00038 { 00039 try 00040 { bst.searchTreeDelete(searchKey); 00041 } // end try 00042 catch (TreeException e) 00043 { throw TableException("TableException: Item not found on delete"); 00044 } // end catch 00045 } // end tableDelete 00046 00047 void Table::tableRetrieve(KeyType searchKey, 00048 TableItemType& tableItem) const 00049 throw(TableException) 00050 { 00051 try 00052 { bst.searchTreeRetrieve(searchKey, tableItem); 00053 } // end try 00054 catch (TreeException e) 00055 { throw TableException("TableException: Item not found on retrieve"); 00056 } // end catch 00057 } // end tableRetrieve 00058 00059 void Table::traverseTable(FunctionType visit) 00060 { 00061 bst.inorderTraverse(visit); 00062 } // end traverseTable 00063 // End of implementation file. |