include/algo/blast/api/blast_exception.hpp

Go to the documentation of this file.
00001 /* $Id: blast_exception.hpp 103491 2007-05-04 17:18:18Z kazimird $
00002  * ===========================================================================
00003  *
00004  *                            public DOMAIN NOTICE                          
00005  *               National Center for Biotechnology Information
00006  *                                                                          
00007  *  This software/database is a "United States Government Work" under the   
00008  *  terms of the United States Copyright Act.  It was written as part of    
00009  *  the author's official duties as a United States Government employee and 
00010  *  thus cannot be copyrighted.  This software/database is freely available 
00011  *  to the public for use. The National Library of Medicine and the U.S.    
00012  *  Government have not placed any restriction on its use or reproduction.  
00013  *                                                                          
00014  *  Although all reasonable efforts have been taken to ensure the accuracy  
00015  *  and reliability of the software and data, the NLM and the U.S.          
00016  *  Government do not and cannot warrant the performance or results that    
00017  *  may be obtained by using this software or data. The NLM and the U.S.    
00018  *  Government disclaim all warranties, express or implied, including       
00019  *  warranties of performance, merchantability or fitness for any particular
00020  *  purpose.                                                                
00021  *                                                                          
00022  *  Please cite the author in any work or product based on this material.   
00023  *
00024  * ===========================================================================
00025  *
00026  * Author:  Christiam Camacho
00027  *
00028  */
00029 
00030 /// @file blast_exception.hpp
00031 /// Declares the BLAST exception class.
00032 
00033 #ifndef ALGO_BLAST_API___BLAST_EXCEPTION__HPP
00034 #define ALGO_BLAST_API___BLAST_EXCEPTION__HPP
00035 
00036 #include <corelib/ncbiexpt.hpp>
00037 
00038 /** @addtogroup AlgoBlast
00039  *
00040  * @{
00041  */
00042 
00043 BEGIN_NCBI_SCOPE
00044 BEGIN_SCOPE(blast)
00045 
00046 /// Defines system exceptions occurred while running BLAST
00047 class CBlastSystemException : public CException
00048 {
00049 public:
00050     /// Error types that BLAST can generate
00051     enum EErrCode {
00052         eOutOfMemory
00053     };
00054 
00055     /// Translate from the error code value to its string representation
00056     virtual const char* GetErrCodeString(void) const {
00057         switch ( GetErrCode() ) {
00058         case eOutOfMemory:          return "eOutOfMemory";
00059         default:                    return CException::GetErrCodeString();
00060         }
00061     }
00062 
00063 #ifndef SKIP_DOXYGEN_PROCESSING
00064     NCBI_EXCEPTION_DEFAULT(CBlastSystemException, CException);
00065 #endif /* SKIP_DOXYGEN_PROCESSING */
00066 };
00067 
00068 /// Defines BLAST error codes (user errors included)
00069 class CBlastException : public CException
00070 {
00071 public:
00072     /// Error types that BLAST can generate
00073     enum EErrCode {
00074         eCoreBlastError,    ///< FIXME: need to interpret CORE errors
00075         eInvalidOptions,    ///< Invalid algorithm options
00076         eInvalidArgument,   ///< Invalid argument to some function/method
00077                             /// (could be programmer error - prefer assertions
00078                             /// in those cases unless API needs to be 
00079                             /// "bullet-proof")
00080         eNotSupported,      ///< Feature not supported
00081         eInvalidCharacter,  ///< Invalid character in sequence data
00082         eSeqSrcInit,        ///< Initialization error in BlastSeqSrc 
00083                             /// implementation
00084         eRpsInit,           ///< Error while initializing RPS-BLAST
00085         eSetup              ///< Error while setting up BLAST
00086     };
00087 
00088     /// Translate from the error code value to its string representation
00089     virtual const char* GetErrCodeString(void) const {
00090         switch ( GetErrCode() ) {
00091         case eCoreBlastError:       return "eCoreBlastError";
00092         case eInvalidOptions:       return "eInvalidOptions";
00093         case eInvalidArgument:      return "eInvalidArgument";
00094         case eNotSupported:         return "eNotSupported";
00095         case eInvalidCharacter:     return "eInvalidCharacter";
00096         case eSeqSrcInit:           return "eSeqSrcInit";
00097         case eRpsInit:              return "eRpsInit";
00098         default:                    return CException::GetErrCodeString();
00099         }
00100     }
00101 
00102 #ifndef SKIP_DOXYGEN_PROCESSING
00103     NCBI_EXCEPTION_DEFAULT(CBlastException,CException);
00104 #endif /* SKIP_DOXYGEN_PROCESSING */
00105 };
00106 
00107 END_SCOPE(blast)
00108 END_NCBI_SCOPE
00109 
00110 /* @} */
00111 
00112 #endif  /* ALGO_BLAST_API___BLAST_EXCEPTION__HPP */
00113 
00114 

Generated on Wed Dec 9 02:54:30 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:17:25 2009 by modify_doxy.py rev. 173732