00001 /*========================================================================= 00002 00003 Program: F.R.E.E. - flexible registration evaluation engine 00004 Version: v.1.0.0 00005 Date: $Date: 2006/09/01 12:00:00 $ 00006 Module: $RCSfile: frePointerSentry.cxx,v $ 00007 Language: C++ 00008 00009 00010 00011 Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics, 00012 Institute for Medical Biometry and Informatics, University of Heidelberg, 00013 Germany). All rights reserved. 00014 See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm 00015 for details. 00016 00017 This software is distributed WITHOUT ANY WARRANTY; without even 00018 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00019 PURPOSE. See the above copyright notices for more information. 00020 00021 =========================================================================*/ 00022 00023 00024 #include "frePointerSentry.h" 00025 #include "freExceptions.h" 00026 00027 namespace FREE 00028 { 00029 00030 PointerSentry:: 00031 PointerSentry(void* pGuardedObject, const bool bSuppressException) 00032 { 00033 m_pGuardedObject = pGuardedObject; 00034 m_bSuppressException = bSuppressException; 00035 } 00036 00038 PointerSentry:: 00039 ~PointerSentry() 00040 { 00041 try 00042 { 00043 if (m_pGuardedObject) delete m_pGuardedObject; 00044 } 00045 catch(...) 00046 { 00047 if (!m_bSuppressException) throwExceptionMacro("Exception while deleting pointer." << m_pGuardedObject); 00048 }; 00049 }; 00050 00051 }//end of namespace FREE
1.5.3 written by Dimitri van Heesch,
© 1997-2000