1 /* $Id: entrez2_client.hpp 481294 2015-10-08 14:03:49Z 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: Aaron Ucko, NCBI
27 *
28 * File Description:
29 * Entrez2 network client
30 *
31 * Remark:
32 * This code was originally generated by application DATATOOL
33 * using specifications from the data definition file
34 * 'entrez2.asn'.
35 */
36
37 #ifndef OBJECTS_ENTREZ2_ENTREZ2_CLIENT_HPP
38 #define OBJECTS_ENTREZ2_ENTREZ2_CLIENT_HPP
39
40
41 // generated includes
42 #include <objects/entrez2/entrez2_client_.hpp>
43
44 #include <objects/entrez2/Entrez2_link_set.hpp>
45 #include <objects/entrez2/Entrez2_link_count_list.hpp>
46 #include <objects/entrez2/Entrez2_docsum_list.hpp>
47
48
49 // generated classes
50
51 BEGIN_NCBI_SCOPE
52
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54
55
56 class NCBI_ENTREZ2_EXPORT CEntrez2Client : public CEntrez2Client_Base
57 {
58 typedef CEntrez2Client_Base Tparent;
59 public:
60 typedef TIntId TUid;
61
62 // constructor
63 CEntrez2Client(void);
64 // destructor
65 ~CEntrez2Client(void);
66
67 /// A simplified interface for getting neighbors (links)
68
69 /// Get ids of neigbors of a specified type.
70 /// db is, e.g., "nucleotide" or "protein" (depending on the query).
71 /// link_type is, for example, "nucleotide_nucleotide".
72
73 /// This form just yields a vector of UIDs
74 void GetNeighbors(TUid query_uid,
75 const string& db_from,
76 const string& db_to,
77 vector<TUid>& neighbor_uids);
78
79 /// This form just yields a vector of UIDs, taking a vector of UIDs
80 void GetNeighbors(const vector<TUid>& query_uids,
81 const string& db,
82 const string& link_type,
83 vector<TUid>& neighbor_uids);
84
85 /// This form returns the entire CEntrez2_link_set object,
86 /// which includes scores.
87 CRef<CEntrez2_link_set> GetNeighbors(TUid query_uid,
88 const string& db_from,
89 const string& db_to);
90
91 /// This form returns the entire CEntrez2_link_set object,
92 /// which includes scores.
93 CRef<CEntrez2_link_set> GetNeighbors(const vector<TUid>& query_uids,
94 const string& db_from,
95 const string& db_to);
96
97 /// Retrieve counts of the various types of neighbors available
98 CRef<CEntrez2_link_count_list> GetNeighborCounts(TUid query_uid,
99 const string& db);
100
101 /// Some other simplified interfaces
102
103 /// Query a db with a string, returning uids as integers
104 void Query(const string& query,
105 const string& db,
106 vector<TUid>& result_uids,
107 size_t start_offs = 0,
108 size_t count = 0,
109 TReply* reply = 0);
110
111 /// Given some uids, a database, and an entrez query string,
112 /// determine which of these uids match the query string.
113 ///
114 /// Note: If a uid appears more than once in query_uids and
115 /// matches the query string, it may or may not appear more
116 /// more than once in the result.
117 void FilterIds(const vector<TUid>& query_uids,
118 const string& db,
119 const string& query_string,
120 vector<TUid>& result_uids);
121
122 /// Retrieve the docsums for a set of UIDs
123 CRef<CEntrez2_docsum_list> GetDocsums(const vector<TUid>& uids,
124 const string& db);
125
126 /// Retrieve the docsums for a single UID
127 CRef<CEntrez2_docsum_list> GetDocsums(TUid uid,
128 const string& db);
129
130 #ifdef NCBI_STRICT_GI
131 void GetNeighbors(TGi query_uid, const string& db_from,
132 const string& db_to,
133 vector<TGi>& neighbor_uids);
134 void GetNeighbors(const vector<TGi>& query_uids,
135 const string& db,
136 const string& link_type,
137 vector<TGi>& neighbor_uids);
138 CRef<CEntrez2_link_set> GetNeighbors(TGi query_uid,
139 const string& db_from,
140 const string& db_to);
141 CRef<CEntrez2_link_set> GetNeighbors(const vector<TGi>& query_uids,
142 const string& db_from,
143 const string& db_to);
144 CRef<CEntrez2_link_count_list> GetNeighborCounts(TGi query_uid,
145 const string& db);
146 void Query(const string& query, const string& db,
147 vector<TGi>& result_uids,
148 size_t start_offs = 0, size_t count = 0,
149 TReply* reply = 0);
150 void FilterIds(const vector<TGi>& query_uids, const string& db,
151 const string& query_string,
152 vector<TGi>& result_uids);
153 CRef<CEntrez2_docsum_list> GetDocsums(const vector<TGi>& uids,
154 const string& db);
155 CRef<CEntrez2_docsum_list> GetDocsums(TGi uid,
156 const string& db);
157 #endif
158
159 protected:
160 /// Get DB affinity of the request
161 virtual string GetAffinity(const CEntrez2_request& request) const;
162
163 private:
164 // Prohibit copy constructor and assignment operator
165 CEntrez2Client(const CEntrez2Client& value);
166 CEntrez2Client& operator=(const CEntrez2Client& value);
167 };
168
169
170
171 /////////////////// CEntrez2Client inline methods
172
173 // constructor
174 inline
CEntrez2Client(void)175 CEntrez2Client::CEntrez2Client(void)
176 {
177 SetDefaultRequest().SetTool("CEntrez2Client");
178 SetDefaultRequest().SetVersion(1);
179 }
180
181
182 /////////////////// end of CEntrez2Client inline methods
183
184
185 END_objects_SCOPE // namespace ncbi::objects::
186
187 END_NCBI_SCOPE
188
189 #endif // OBJECTS_ENTREZ2_ENTREZ2_CLIENT_HPP
190 /* Original file checksum: lines: 93, chars: 2440, CRC32: 16aa1713 */
191