/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */ /* $Id: cmnErrorCode.h,v 1.6 2007/04/26 19:33:57 anton Exp $ Author(s): Ankur Kapoor Created on: 2003-06-25 (C) Copyright 2003-2007 Johns Hopkins University (JHU), All Rights Reserved. --- begin cisst license - do not edit --- This software is provided "as is" under an open source license, with no warranty. The complete license can be found in license.txt and http://www.cisst.org/cisst/license.txt. --- end cisst license --- */ /*! \file \brief Declaration of cmnErrorCode */ #ifndef _cmnErrorCode_h #define _cmnErrorCode_h #include #include class cmnExceptionBase; template class cmnErrorCode : public cmnErrorCodeBase { public: cmnErrorCode (const char shortDescription[] = "", const char detailedDescription[] = "") : cmnErrorCodeBase (shortDescription, detailedDescription, typeid(C).name()) {}; inline void ThrowOnEqual(const cmnErrorCode &compareWithErrorCode, const char userMessage[] = ""); inline void ThrowOnNotEqual(const cmnErrorCode &compareWithErrorCode, const char userMessage[] = ""); inline bool Compare(const cmnErrorCode &compareWithErrorCode); }; template void cmnErrorCode::ThrowOnEqual(const cmnErrorCode &compareWithErrorCode, const char userMessage[]) { if (this == &compareWithErrorCode) { cmnExceptionBase throwThis(compareWithErrorCode, userMessage); throw throwThis; } } template void cmnErrorCode::ThrowOnNotEqual(const cmnErrorCode &compareWithErrorCode, const char userMessage[]) { if (this != &compareWithErrorCode) { cmnExceptionBase throwThis(compareWithErrorCode, userMessage); throw throwThis; } } template bool cmnErrorCode::Compare(const cmnErrorCode &compareWithErrorCode) { if (this == &compareWithErrorCode) { return true; } return false; } #endif // _cmnErrorCode_h // **************************************************************************** // Change History // **************************************************************************** // // $Log: cmnErrorCode.h,v $ // Revision 1.6 2007/04/26 19:33:57 anton // All files in libraries: Applied new license text, separate copyright and // updated dates, added standard header where missing. // // Revision 1.5 2006/11/20 20:33:19 anton // Licensing: Applied new license to cisstCommon, cisstVector, cisstNumerical, // cisstInteractive, cisstImage and cisstOSAbstraction. // // Revision 1.4 2005/09/26 15:41:46 anton // cisst: Added modelines for emacs and vi. // // Revision 1.3 2005/05/19 19:29:00 anton // cisst libs: Added the license to cisstCommon and cisstVector // // Revision 1.2 2004/10/25 13:52:05 anton // Doxygen documentation: Cleanup all the useless \ingroup. // // Revision 1.1 2003/11/14 22:05:36 anton // Added to repository for testing // // // ****************************************************************************