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

Go to the SVN repository for this file.

1 #ifndef ELINK__HPP
2 #define ELINK__HPP
3 
4 /* $Id: elink.hpp 46390 2010-07-06 00:37:12Z dicuccio $
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: Aleksey Grichenko
30 *
31 * File Description:
32 * ELink request
33 *
34 */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <corelib/ncbitime.hpp>
40 
42 
43 
44 /** @addtogroup EUtils
45  *
46  * @{
47  */
48 
49 
50 /////////////////////////////////////////////////////////////////////////////
51 ///
52 /// CELink_Request
53 ///
54 /// Search for Related Articles link
55 
56 
58 {
59 public:
60  /// Create ELink request for the given destination database.
61  /// Use "all" to retrieve links for all Entrez databases.
62  CELink_Request(const string& db, CRef<CEUtils_ConnContext>& ctx);
63  virtual ~CELink_Request(void);
64 
65  /// Get CGI script query string.
66  virtual string GetQueryString(void) const;
67 
68  /// Get serial stream format for reading data.
69  virtual ESerialDataFormat GetSerialDataFormat(void) const;
70 
71  /// Get search result.
72  CRef<elink::CELinkResult> GetELinkResult(void);
73 
74  /// Origination database.
75  const string& GetDbFrom(void) const { return m_DbFrom; }
76  void SetDbFrom(const string& dbfrom) { Disconnect(); m_DbFrom = dbfrom; }
77 
78  /// Multiple ID groups.
79  const CEUtils_IdGroupSet& GetIdGroups(void) const { return m_IdGroups; }
80  CEUtils_IdGroupSet& GetIdGroups(void) { Disconnect(); return m_IdGroups; }
81 
82  /// Search term.
83  const string& GetTerm(void) const { return m_Term; }
84  void SetTerm(const string& term) { Disconnect(); m_Term = term; }
85 
86  /// Relative date to start search with, in days.
87  /// 0 = not set
88  int GetRelDate(void) const { return m_RelDate; }
89  void SetRelDate(int days) { Disconnect(); m_RelDate = days; }
90 
91  /// Min date. Both min and max date must be set.
92  const CTime& GetMinDate(void) const { return m_MinDate; }
93  void SetMinDate(const CTime& date) { Disconnect(); m_MinDate = date; }
94 
95  /// Max date. Both min and max date must be set.
96  const CTime& GetMaxDate(void) const { return m_MaxDate; }
97  void SetMaxDate(const CTime& date) { Disconnect(); m_MaxDate = date; }
98 
99  /// Limit dates to a specific date field based on database
100  /// (e.g. edat, mdat).
101  const string& GetDateType(void) const { return m_DateType; }
102  void SetDateType(const string& type) { Disconnect(); m_DateType = type; }
103 
104  /// Output data types.
105  enum ERetMode {
107  eRetMode_xml, /// Default mode is XML
108  eRetMode_ref ///< used only with cmd=prlinks
109  };
110  /// Output data type.
111  ERetMode GetRetMode(void) const { return m_RetMode; }
112  void SetRetMode(ERetMode retmode) { Disconnect(); m_RetMode = retmode; }
113 
114  /// ELink commands.
115  enum ECommand {
117  eCmd_prlinks, ///< Links to the primary provider
118  eCmd_llinks, ///< LinkOut URLs, except PubMed libraries
119  eCmd_llinkslib, ///< LinkOut URLs and Attributes
120  eCmd_lcheck, ///< Check for the existence of external links
121  eCmd_ncheck, ///< Check for the existence of neighbor links
122  eCmd_neighbor, ///< Display neighbors within a database (default)
123  eCmd_neighbor_score, ///< Display neighbors within a database, with scores
124  eCmd_neighbor_history, ///< Create history for use in other EUtils
125  eCmd_acheck ///< Entrez databases links
126  };
127  ECommand GetCommand(void) const { return m_Cmd; }
128  void SetCommand(ECommand cmd) { Disconnect(); m_Cmd = cmd; }
129 
130  /// Link to a specific neighbor subset.
131  /// A full list of allowed link names is available at
132  /// http://eutils.ncbi.nlm.nih.gov/entrez/query/static/entrezlinks.html
133  const string& GetLinkName(void) const { return m_LinkName; }
134  void SetLinkName(const string& linkname)
135  { Disconnect(); m_LinkName = linkname; }
136 
137  /// List LinkOut URLs for the specified holding provider.
138  /// Used only in conjunction with cmd=llinks or cmd=llinkslib.
139  const string& GetHolding(void) const { return m_Holding; }
140  void SetHolding(const string& holding)
141  { Disconnect(); m_Holding = holding; }
142 
143  /// Latest DTD version.
144  const string& GetVersion(void) const { return m_Version; }
145  void SetVersion(const string& version)
146  { Disconnect(); m_Version = version; }
147 
148 private:
150 
151  const char* x_GetRetModeName(void) const;
152  const char* x_GetCommandName(void) const;
153 
154  string m_DbFrom;
156  string m_Term;
160  string m_DateType; // ???
163  string m_LinkName;
164  string m_Holding;
165  string m_Version;
166 };
167 
168 
169 /* @} */
170 
171 
173 
174 #endif // ELINK__HPP
User-defined methods of the data storage class.
CEUtils_IdGroupSet.
Definition: eutils.hpp:271
CEUtils_Request.
Definition: eutils.hpp:119
CTime –.
Definition: ncbitime.hpp:296
Include a standard set of the NCBI C++ Toolkit most basic headers.
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
CS_CONTEXT * ctx
Definition: t0006.c:12
static int type
Definition: getdata.c:31
const CEUtils_IdGroupSet & GetIdGroups(void) const
Multiple ID groups.
Definition: elink.hpp:79
string m_LinkName
Definition: elink.hpp:163
virtual string GetQueryString(void) const
Get CGI script query string.
Definition: eutils.cpp:200
string m_DateType
Definition: elink.hpp:160
void SetVersion(const string &version)
Definition: elink.hpp:145
ECommand GetCommand(void) const
Definition: elink.hpp:127
ERetMode
Output data types.
Definition: elink.hpp:105
void SetTerm(const string &term)
Definition: elink.hpp:84
const string & GetLinkName(void) const
Link to a specific neighbor subset.
Definition: elink.hpp:133
void SetMinDate(const CTime &date)
Definition: elink.hpp:93
CTime m_MinDate
Definition: elink.hpp:158
ERetMode GetRetMode(void) const
Output data type.
Definition: elink.hpp:111
ECommand
ELink commands.
Definition: elink.hpp:115
const CTime & GetMinDate(void) const
Min date. Both min and max date must be set.
Definition: elink.hpp:92
virtual ESerialDataFormat GetSerialDataFormat(void) const
Get serial stream format for reading data.
Definition: eutils.hpp:134
CEUtils_IdGroupSet m_IdGroups
Definition: elink.hpp:155
void SetRetMode(ERetMode retmode)
Definition: elink.hpp:112
const string & GetVersion(void) const
Latest DTD version.
Definition: elink.hpp:144
string m_Holding
Definition: elink.hpp:164
string m_Version
Definition: elink.hpp:165
void SetLinkName(const string &linkname)
Definition: elink.hpp:134
ECommand m_Cmd
Definition: elink.hpp:162
void SetMaxDate(const CTime &date)
Definition: elink.hpp:97
const string & GetTerm(void) const
Search term.
Definition: elink.hpp:83
void SetDateType(const string &type)
Definition: elink.hpp:102
int GetRelDate(void) const
Relative date to start search with, in days.
Definition: elink.hpp:88
const string & GetDateType(void) const
Limit dates to a specific date field based on database (e.g.
Definition: elink.hpp:101
const CTime & GetMaxDate(void) const
Max date. Both min and max date must be set.
Definition: elink.hpp:96
string m_DbFrom
Definition: elink.hpp:154
void SetDbFrom(const string &dbfrom)
Definition: elink.hpp:76
const string & GetHolding(void) const
List LinkOut URLs for the specified holding provider.
Definition: elink.hpp:139
const string & GetDbFrom(void) const
Origination database.
Definition: elink.hpp:75
string m_Term
Definition: elink.hpp:156
CEUtils_IdGroupSet & GetIdGroups(void)
Definition: elink.hpp:80
void SetHolding(const string &holding)
Definition: elink.hpp:140
void Disconnect(void)
Close connection, destroy the stream.
Definition: eutils.hpp:149
void SetRelDate(int days)
Definition: elink.hpp:89
CTime m_MaxDate
Definition: elink.hpp:159
CEUtils_Request TParent
Definition: elink.hpp:149
void SetCommand(ECommand cmd)
Definition: elink.hpp:128
ERetMode m_RetMode
Definition: elink.hpp:161
@ eCmd_llinks
LinkOut URLs, except PubMed libraries.
Definition: elink.hpp:118
@ eCmd_ncheck
Check for the existence of neighbor links.
Definition: elink.hpp:121
@ eCmd_lcheck
Check for the existence of external links.
Definition: elink.hpp:120
@ eCmd_prlinks
Links to the primary provider.
Definition: elink.hpp:117
@ eCmd_neighbor
Display neighbors within a database (default)
Definition: elink.hpp:122
@ eCmd_llinkslib
LinkOut URLs and Attributes.
Definition: elink.hpp:119
@ eCmd_neighbor_history
Create history for use in other EUtils.
Definition: elink.hpp:124
@ eCmd_neighbor_score
Display neighbors within a database, with scores.
Definition: elink.hpp:123
ESerialDataFormat
Data file format.
Definition: serialdef.hpp:71
#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_EUTILS_EXPORT
Definition: ncbi_export.h:1460
const string version
version string
Definition: variables.hpp:66
Defines: CTimeFormat - storage class for time format.
Definition: type.c:6
Modified on Fri Sep 20 14:58:27 2024 by modify_doxy.py rev. 669887