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

Go to the SVN repository for this file.

1 /* $Id: ValidError.hpp 102322 2024-04-23 12:29:28Z foleyjp $
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  */
27 
28 /// @file ValidError.hpp
29 /// User-defined methods of the data storage class.
30 ///
31 /// This file was originally generated by application DATATOOL
32 /// using the following specifications:
33 /// 'valerr.asn'.
34 ///
35 /// New methods or data members can be added to it if needed.
36 /// See also: ValidError_.hpp
37 
38 
39 #ifndef OBJECTS_VALERR_VALIDERROR_HPP
40 #define OBJECTS_VALERR_VALIDERROR_HPP
41 
42 
43 // generated includes
45 
46 // generated classes
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
52 class CSeqdesc;
53 class CSeq_entry;
54 
56 {
57 public:
58  virtual ~IValidError() = default;
59 
60  virtual void AddValidErrItem(
61  EDiagSev sev, // severity
62  unsigned int ec, // error code
63  const string& msg, // specific error message
64  const string& desc, // offending object's description
65  const CSerialObject& obj, // offending object
66  const string& acc, // accession of object.
67  const int ver, // version of object.
68  const string& location = kEmptyStr, // formatted location of object
69  const int seq_offset = 0) = 0;
70 
71  virtual void AddValidErrItem(
72  EDiagSev sev, // severity
73  unsigned int ec, // error code
74  const string& msg, // specific error message
75  const string& desc, // offending object's description
76  const string& acc, // accession of object.
77  const int ver, // version of object.
78  const string& location = kEmptyStr, // formatted location of object
79  const int seq_offset = 0) = 0;
80 
81  virtual void AddValidErrItem(
82  EDiagSev sev, // severity
83  unsigned int ec, // error code
84  const string& msg, // specific error message
85  const string& desc, // offending object's description
86  const CSeqdesc& seqdesc, // offending object
87  const CSeq_entry& ctx, // place of packaging
88  const string& acc, // accession of object or context.
89  const int ver, // version of object.
90  const int seq_offset = 0) = 0;
91 
92  virtual void AddValidErrItem(
93  EDiagSev sev, // severity
94  unsigned int ec, // error code
95  const string& msg) // specific error message
96  = 0;
97 
98  virtual void AddValidErrItem(CRef<CValidErrItem> item) = 0;
99 };
100 
101 /////////////////////////////////////////////////////////////////////////////
103  public CValidError_Base,
104  public IValidError
105 {
107 public:
108  // constructor
109  CValidError(const CSerialObject* obj = nullptr);
110  // destructor
111  virtual ~CValidError();
112 
113  void AddValidErrItem(
114  EDiagSev sev, // severity
115  unsigned int ec, // error code
116  const string& msg, // specific error message
117  const string& desc, // offending object's description
118  const CSerialObject& obj, // offending object
119  const string& acc, // accession of object.
120  const int ver, // version of object.
121  const string& location = kEmptyStr, // formatted location of object
122  const int seq_offset = 0) final;
123 
124  void AddValidErrItem(
125  EDiagSev sev, // severity
126  unsigned int ec, // error code
127  const string& msg, // specific error message
128  const string& desc, // offending object's description
129  const string& acc, // accession of object.
130  const int ver, // version of object.
131  const string& location = kEmptyStr, // formatted location of object
132  const int seq_offset = 0) final;
133 
134  void AddValidErrItem(
135  EDiagSev sev, // severity
136  unsigned int ec, // error code
137  const string& msg, // specific error message
138  const string& desc, // offending object's description
139  const CSeqdesc& seqdesc, // offending object
140  const CSeq_entry& ctx, // place of packaging
141  const string& acc, // accession of object or context.
142  const int ver, // version of object.
143  const int seq_offset = 0) final;
144 
145  void AddValidErrItem(
146  EDiagSev sev, // severity
147  unsigned int ec, // error code
148  const string& msg) final; // specific error message
149 
150  void AddValidErrItem(CRef<CValidErrItem> item) final;
151 
152  // Statistics
153  SIZE_TYPE TotalSize() const;
154  SIZE_TYPE Size(EDiagSev sev) const;
155 
156  SIZE_TYPE InfoSize () const;
157  SIZE_TYPE WarningSize () const;
158  SIZE_TYPE ErrorSize () const;
159  SIZE_TYPE CriticalSize() const;
160  SIZE_TYPE FatalSize () const;
161 
162  // Get the validated object (Seq-entry, Seq-submit or Seq-align)
163  const CSerialObject* GetValidated() const;
164 
165  // for suppressing errors by type. Suppression list
166  // will be checked at the time that a AddValidErrItem
167  // method is called
168  void SuppressError(unsigned int ec);
169  bool ShouldSuppress(unsigned int ec);
170  void ClearSuppressions();
171 
172  NCBI_DEPRECATED bool IsCatastrophic() const;
173 
174 protected:
175  friend class CValidError_CI;
176 
180 
181  // data
182  TSevStats m_Stats; // severity statistics
183  TValidated m_Validated; // the validated object
184  vector<unsigned int> m_SuppressionList;
185 
186 private:
187  // Prohibit copy constructor & assignment operator
189  CValidError& operator=(const CValidError&) = delete;
190 };
191 
192 
194 {
195 public:
196  CValidError_CI();
198  const CValidError& ve,
199  const string& errcode = kEmptyStr,
200  EDiagSev minsev = eDiagSevMin,
201  EDiagSev maxsev = eDiagSevMax);
202  CValidError_CI(const CValidError_CI& iter);
203  virtual ~CValidError_CI();
204 
205  CValidError_CI& operator=(const CValidError_CI& iter);
206  CValidError_CI& operator++();
207 
208  bool IsValid() const;
210 
211  const CValidErrItem& operator*() const;
212  const CValidErrItem* operator->() const;
213 
214 private:
215  bool Filter(const CValidErrItem& item) const;
216  bool AtEnd() const;
217  void Next();
218 
220  CValidError::TErrs::const_iterator m_Current;
221 
222  // filters:
226 };
227 
228 
229 /////////////////// CValidError inline methods
230 
231 // constructor
232 
233 inline
235 {
236  return GetErrs().size();
237 }
238 
239 
240 inline
242 {
243  return const_cast<CValidError*>(this)->m_Stats[sev];
244 }
245 
246 
247 inline
249 {
250  return Size(eDiag_Info);
251 }
252 
253 
254 inline
256 {
257  return Size(eDiag_Warning);
258 }
259 
260 
261 inline
263 {
264  return Size(eDiag_Error);
265 }
266 
267 
268 inline
270 {
271  return Size(eDiag_Critical);
272 }
273 
274 
275 inline
277 {
278  return Size(eDiag_Fatal);
279 }
280 
281 inline
283 {
284  return m_Validated.GetPointerOrNull();
285 }
286 
287 
288 /////////////////// end of CValidError inline methods
289 
290 
291 END_objects_SCOPE // namespace ncbi::objects::
292 
294 
295 #endif // OBJECTS_VALERR_VALIDERROR_HPP
296 /* Original file checksum: lines: 94, chars: 2596, CRC32: 9c930424 */
Data storage class.
CConstRef –.
Definition: ncbiobj.hpp:1266
CRef –.
Definition: ncbiobj.hpp:618
Definition: Seq_entry.hpp:56
Base class for all serializable objects.
Definition: serialbase.hpp:150
CValidError_Base –.
Definition: ValidError_.hpp:77
DECLARE_OPERATOR_BOOL(IsValid())
EDiagSev m_MinSeverity
Definition: ValidError.hpp:224
CConstRef< CValidError > m_Validator
Definition: ValidError.hpp:219
string m_ErrCodeFilter
Definition: ValidError.hpp:223
EDiagSev m_MaxSeverity
Definition: ValidError.hpp:225
CValidError::TErrs::const_iterator m_Current
Definition: ValidError.hpp:220
const CSerialObject * GetValidated() const
Definition: ValidError.hpp:282
SIZE_TYPE ErrorSize() const
Definition: ValidError.hpp:262
SIZE_TYPE InfoSize() const
Definition: ValidError.hpp:248
SIZE_TYPE CriticalSize() const
Definition: ValidError.hpp:269
CValidError_Base Tparent
Definition: ValidError.hpp:106
SIZE_TYPE Size(EDiagSev sev) const
Definition: ValidError.hpp:241
SIZE_TYPE WarningSize() const
Definition: ValidError.hpp:255
SIZE_TYPE TotalSize() const
Definition: ValidError.hpp:234
SIZE_TYPE FatalSize() const
Definition: ValidError.hpp:276
virtual ~IValidError()=default
virtual void AddValidErrItem(EDiagSev sev, unsigned int ec, const string &msg)=0
virtual void AddValidErrItem(CRef< CValidErrItem > item)=0
virtual void AddValidErrItem(EDiagSev sev, unsigned int ec, const string &msg, const string &desc, const CSeqdesc &seqdesc, const CSeq_entry &ctx, const string &acc, const int ver, const int seq_offset=0)=0
virtual void AddValidErrItem(EDiagSev sev, unsigned int ec, const string &msg, const string &desc, const CSerialObject &obj, const string &acc, const int ver, const string &location=kEmptyStr, const int seq_offset=0)=0
virtual void AddValidErrItem(EDiagSev sev, unsigned int ec, const string &msg, const string &desc, const string &acc, const int ver, const string &location=kEmptyStr, const int seq_offset=0)=0
Definition: map.hpp:338
CS_CONTEXT * ctx
Definition: t0006.c:12
static const char location[]
Definition: config.c:97
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
@ eDiag_Info
Informational message.
Definition: ncbidiag.hpp:651
@ eDiag_Error
Error message.
Definition: ncbidiag.hpp:653
@ eDiag_Warning
Warning message.
Definition: ncbidiag.hpp:652
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
Definition: ncbidiag.hpp:655
@ eDiagSevMin
Verbosity level for min. severity.
Definition: ncbidiag.hpp:660
@ eDiag_Critical
Critical error message.
Definition: ncbidiag.hpp:654
@ eDiagSevMax
Verbosity level for max. severity.
Definition: ncbidiag.hpp:661
CVect2< NCBI_PROMOTE(int,U) > operator*(int v1, const CVect2< U > &v2)
Definition: globals.hpp:371
bool IsValid(const CSeq_point &pt, CScope *scope)
Checks that point >= 0 and point < length of Bioseq.
TObjectType * GetPointerOrNull(void) const THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:1672
#define NCBI_DEPRECATED
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_VALERR_EXPORT
Definition: ncbi_export.h:921
void Filter(TTimeline &timeline, TServers &servers)
#define const
Definition: zconf.h:232
Modified on Thu May 02 14:33:09 2024 by modify_doxy.py rev. 669887