NCBI C++ ToolKit
seqalign_exception.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seqalign_exception.hpp 84612 2018-11-21 14:24:48Z ucko $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Philip Johnson
27  *
28  * File Description: CSeqalignException class
29  *
30  */
31 
32 #ifndef OBJECTS_SEQALIGN_SEQALIGN_EXCEPTION_HPP
33 #define OBJECTS_SEQALIGN_SEQALIGN_EXCEPTION_HPP
34 
35 #include <corelib/ncbiexpt.hpp>
36 
38 BEGIN_SCOPE(objects) // namespace ncbi::objects::
39 
41 {
42 public:
43  enum EErrCode {
44  /// Operation that is undefined for the given input Seq-align,
45  /// and which is impossible to perform.
47 
48  /// The current alignment has a structural or data error.
49  ///
50  /// This error code applies to problems on "this" object
51  /// in member functions of an alignment object. Note that
52  /// mismatches between alignment types and scores that
53  /// are not supported for them are indicated by eUnsupported.
55 
56  /// An invalid alignmnent passed as input to the current
57  /// operation has a structural or data error.
58  ///
59  /// This error code applies to problems on an alignment
60  /// object other than "this" object. Note that
61  /// mismatches between alignment types and scores that
62  /// are not supported for them are indicated by eUnsupported.
64 
68 
69  /// A sequence identifier is invalid or cannot be
70  /// resolved within the relevant scope.
72 
73  /// Attempt to use unimplemented funtionality.
74  ///
75  /// The operation could be performed, in theory, but
76  /// current code is incomplete and requires modification
77  /// to provided the desired functionality.
78  eNotImplemented
79  };
80 
81  virtual const char* GetErrCodeString(void) const override
82  {
83  switch (GetErrCode()) {
84  case eUnsupported: return "eUnsupported";
85  case eInvalidAlignment: return "eInvalidAlignment";
86  case eInvalidInputAlignment: return "eInvalidInputAlignment";
87  case eInvalidRowNumber: return "eInvalidRowNumber";
88  case eOutOfRange: return "eOutOfRange";
89  case eInvalidInputData: return "eInvalidInputData";
90  case eInvalidSeqId: return "eInvalidSeqId";
91  case eNotImplemented: return "eNotImplemented";
92  default: return CException::GetErrCodeString();
93  }
94  }
95 
97 };
98 
99 #define _SEQALIGN_ASSERT(expr) \
100  do { \
101  if ( !(expr) ) { \
102  _ASSERT(expr); \
103  NCBI_THROW(CSeqalignException, eInvalidAlignment, \
104  string("Assertion failed: ") + #expr); \
105  } \
106  } while ( 0 )
107 
110 
111 #endif // OBJECTS_SEQALIGN_SEQALIGN_EXCEPTION_HPP
virtual const char * GetErrCodeString(void) const override
@ eInvalidSeqId
A sequence identifier is invalid or cannot be resolved within the relevant scope.
@ eUnsupported
Operation that is undefined for the given input Seq-align, and which is impossible to perform.
@ eInvalidAlignment
The current alignment has a structural or data error.
@ eInvalidInputAlignment
An invalid alignmnent passed as input to the current operation has a structural or data error.
NCBI_EXCEPTION_DEFAULT(CSeqalignException, CException)
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
Definition: ncbiexpt.cpp:444
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
Definition: ncbiexpt.hpp:1388
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Defines NCBI C++ exception handling.
Modified on Tue Apr 16 20:12:32 2024 by modify_doxy.py rev. 669887