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

Go to the SVN repository for this file.

1 #ifndef NCBI_ITAXON3_HPP
2 #define NCBI_ITAXON3_HPP
3 
4 /* $Id: itaxon3.hpp 97477 2022-07-21 13:44:29Z gotvyans $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Colleen Bollin, based on work by Vladimir Soussov, Michael Domrachev
30  * Brad Holmes : Added ITaxon interface, to support mocking the service.
31  *
32  * File Description:
33  * NCBI Taxonomy information retreival library
34  *
35  */
36 
37 
41 #include <serial/serialdef.hpp>
42 #include <connect/ncbi_types.h>
43 #include <corelib/ncbi_limits.hpp>
44 #include <corelib/ncbimisc.hpp>
46 
47 #include <list>
48 #include <vector>
49 #include <map>
50 
51 
53 
54 class CObjectOStream;
56 
57 
58 BEGIN_objects_SCOPE
59 
60 using taxupdate_func_t = function<CRef<CTaxon3_reply>(const vector<CRef<COrg_ref>>& list)>;
61 
63 public:
64 
65  virtual ~ITaxon3(){};
66 
67  //---------------------------------------------
68  // Taxon1 server init
69  // Returns: TRUE - OK
70  // FALSE - Can't open connection to taxonomy service
71  virtual void Init() = 0;
72 
73  virtual void Init(const STimeout* timeout, unsigned reconnect_attempts=5) = 0;
74 
76  eT3reply_nothing = 0,
77  eT3reply_org = 0x0001, // data.org
78  eT3reply_blast_lin = 0x0002, // data.blast_name_lineage
79  eT3reply_status = 0x0004, // data.status
80  eT3reply_refresh = 0x0008, // data.refresh
81 
82  eT3reply_all = (eT3reply_org | eT3reply_blast_lin | eT3reply_status | eT3reply_refresh),
83  eT3reply_default = eT3reply_all
84  };
85  typedef unsigned int fT3reply_parts;
86 
87  // submit a list of org_refs
88  virtual CRef< CTaxon3_reply > SendOrgRefList(const vector< CRef< COrg_ref > >& list,
90  fT3reply_parts t3result_parts = eT3reply_default) = 0;
91 
92  // Name list lookup all the names (including common names) regardless of their lookup flag
93  // By default returns scientific name and taxid in T3Data.org and old_name_class property with matched class name
94  virtual CRef< CTaxon3_reply > SendNameList(const vector<std::string>& list,
97  fT3reply_parts t3parts = (eT3reply_org|eT3reply_status)) = 0;
98  // By default returns only scientific name and taxid in T3Data.org
99  virtual CRef< CTaxon3_reply > SendTaxidList(const vector<TTaxId>& list,
102  fT3reply_parts t3parts = eT3reply_org) = 0;
103 
104  virtual CRef< CTaxon3_reply > SendRequest(const CTaxon3_request& request) = 0;
105  //--------------------------------------------------
106  // Get error message after latest erroneous operation
107  // Returns: error message, or empty string if no error occurred
108  ///
109  virtual const string& GetLastError() const = 0;
110 
111 };
112 
113 
114 END_objects_SCOPE
116 
117 #endif //NCBI_ITAXON1_HPP
User-defined methods of the data storage class.
User-defined methods of the data storage class.
This stream exchanges data with a named service, in a constraint that the service is implemented as o...
CObjectOStream –.
Definition: objostr.hpp:83
unsigned int fOrgref_parts
Definition: Org_ref.hpp:94
@ eOrgref_default
Definition: Org_ref.hpp:92
@ eOrgref_taxname
Definition: Org_ref.hpp:56
@ eOrgref_db_taxid
Definition: Org_ref.hpp:61
CTaxon3_request –.
virtual CRef< CTaxon3_reply > SendNameList(const vector< std::string > &list, COrg_ref::fOrgref_parts parts=(COrg_ref::eOrgref_taxname|COrg_ref::eOrgref_db_taxid), fT3reply_parts t3parts=(eT3reply_org|eT3reply_status))=0
virtual CRef< CTaxon3_reply > SendRequest(const CTaxon3_request &request)=0
virtual ~ITaxon3()
Definition: itaxon3.hpp:65
unsigned int fT3reply_parts
Definition: itaxon3.hpp:85
virtual CRef< CTaxon3_reply > SendTaxidList(const vector< TTaxId > &list, COrg_ref::fOrgref_parts parts=(COrg_ref::eOrgref_taxname|COrg_ref::eOrgref_db_taxid), fT3reply_parts t3parts=eT3reply_org)=0
ETaxon3_reply_part
Definition: itaxon3.hpp:75
virtual CRef< CTaxon3_reply > SendOrgRefList(const vector< CRef< COrg_ref > > &list, COrg_ref::fOrgref_parts result_parts=COrg_ref::eOrgref_default, fT3reply_parts t3result_parts=eT3reply_default)=0
virtual const string & GetLastError() const =0
virtual void Init()=0
virtual void Init(const STimeout *timeout, unsigned reconnect_attempts=5)=0
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_TAXON3_EXPORT
Definition: ncbi_export.h:865
function< CRef< CTaxon3_reply >(const vector< CRef< COrg_ref > > &list)> taxupdate_func_t
Definition: itaxon3.hpp:60
Miscellaneous common-use basic types and functionality.
Timeout structure.
Definition: ncbi_types.h:76
Modified on Sun Jun 23 05:18:30 2024 by modify_doxy.py rev. 669887