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

Go to the SVN repository for this file.

1 /* $Id: presenter_catenated.hpp 92169 2020-12-22 17:45:08Z grichenk $
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:
27 *
28 * File Description:
29 *
30 * ===========================================================================
31 */
32 
33 #ifndef __presenter_catenated_hpp__
34 #define __presenter_catenated_hpp__
35 
36 // ============================================================================
38 // ============================================================================
39  : public CSeqEntryPresenter
40 {
41 public:
42  // ------------------------------------------------------------------------
44  // ------------------------------------------------------------------------
46  {
47  };
48 
49  // ------------------------------------------------------------------------
50  virtual void Initialize(
51  const CArgs& args )
52  // ------------------------------------------------------------------------
53  {
55  m_is.reset(
57  (eSerial_AsnText),
58  args["i"].AsInputFile() ) );
59  };
60 
61  // ------------------------------------------------------------------------
62  virtual void Run(
63  CSeqEntryProcess* process )
64  // ------------------------------------------------------------------------
65  {
66  CSeqEntryPresenter::Run( process );
67 
68  try {
69  while (true) {
70  // Get seq-entry to validate
72 
73  try {
74  m_is->Read(ObjectInfo(*se));
75  }
76  catch (const CSerialException& e) {
78  break;
79  } else {
80  throw;
81  }
82  }
83  catch (const CException&) {
84  break;
85  }
86  try {
87  Process(se);
88  }
89  catch (const CObjMgrException& om_ex) {
92  Process(se);
93  }
94  }
95  }
96  catch (const CException&) {
97  }
98  };
99 
100  // ------------------------------------------------------------------------
101  virtual void Finalize(
102  const CArgs& args )
103  // ------------------------------------------------------------------------
104  {
106  };
107 
108 protected:
109  unique_ptr<CObjectIStream> m_is;
110 };
111 
112 #endif
CArgs –.
Definition: ncbiargs.hpp:379
unique_ptr< CObjectIStream > m_is
virtual void Run(CSeqEntryProcess *process)
virtual void Finalize(const CArgs &args)
virtual void Initialize(const CArgs &args)
Base class for all object manager exceptions.
virtual void Process(CRef< CSeq_entry > &se)
Definition: presenter.hpp:113
virtual void Run(CSeqEntryProcess *process)
Definition: presenter.hpp:71
virtual void Initialize(const CArgs &args)
Definition: presenter.hpp:59
virtual void Finalize(const CArgs &args)
Definition: presenter.hpp:79
Definition: Seq_entry.hpp:56
void ReassignConflictingIds(void)
Definition: Seq_entry.cpp:548
Root class for all serialization exceptions.
Definition: exception.hpp:50
TErrCode GetErrCode(void) const
Get error code.
Definition: ncbiexpt.cpp:453
@ eSerial_AsnText
ASN.1 text.
Definition: serialdef.hpp:73
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
Definition: objectinfo.hpp:762
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
Definition: objistr.cpp:195
@ eEOF
Unexpected end-of-file.
Definition: exception.hpp:55
@ eAddDataError
Error while adding new data.
Modified on Fri Sep 20 14:57:26 2024 by modify_doxy.py rev. 669887