Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_http_client_search.hpp
1/*
2##############################################################################
3# file: ms_http_client_search.hpp #
4# 'msparser' toolkit #
5# Represents a task on a Mascot server and can be used to sumbit and track #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2013 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11 * @(#)$Source: parser/inc/ms_http_client_search.hpp $
12 * @(#)$Revision: 9f0c123764e41b5a92a31ec7e127cc7e3aa6ce82 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $
13 * @(#)$Date: 2024-02-01 09:58:21 +0000 $
14##############################################################################
15 */
16
17#ifndef MS_HTTP_CLIENT_SEARCH_HPP
18#define MS_HTTP_CLIENT_SEARCH_HPP
19
20
21#include <string>
22
23namespace matrix_science
24{
30 class ms_http_helper;
31 class ms_http_client_session;
32
34
42 class MS_MASCOTRESFILE_API ms_http_client_search :
43 public ms_errors
44 {
45 public:
46
48
52 {
59 SS_SEARCH_CONTROL_ERROR
60 };
61
63
67 {
74 UR_ERROR
75 };
76
78
82 {
83 DO_NORMAL = 0,
84 DO_WITH_IONS = 1
85 };
86
88
93 {
94 RT_auto = 0,
95 RT_file = -1
96 };
97
98#ifndef SWIG
99 // C++ STL collection support
101#endif
103 ms_http_client_search(ms_http_client_session & session, const std::string & searchTaskId);
104
106 virtual ~ms_http_client_search();
107
109#ifndef SWIG
110 ms_http_client_search& operator=(const ms_http_client_search & right);
111#endif
112 void copyFrom(const ms_http_client_search * right);
113
115
118 std::string sessionId() const { return getSessionID(); }
119
121 std::string getSessionID() const;
122
124 std::string getSearchTaskID() const;
125
127
132 std::string searchTaskId() const { return getSearchTaskID(); }
133
135 bool getStatus(SearchStatusCode & returnCode, int & statusValue);
136
137#ifndef SWIG
138 // Undocumented for Perl compatibility. Unable to return an enum
139 bool getStatus(int & returnCodeAsInt, int & statusValue);
140
142 bool getResultsFileName(std::string & returnFileName);
143
145 bool getStage(std::string & stage, int & step);
146#else // SWIG Multiple return values
147 bool getStatus(int & OUTPUT, int & OUTPUT);
148 bool getResultsFileName(std::string & OUTPUT);
149 bool getStage(std::string & OUTPUT, int & OUTPUT);
150#endif
151
153
159 bool getResultsFilename(std::string & returnFilename) { return getResultsFileName(returnFilename); }
160
162 bool downloadResultsFile(std::string filename, ms_http_helper_progress & progress, DownloadOption options = DO_WITH_IONS);
163
165 bool downloadResultsFileMSR(std::string filename, ms_http_helper_progress & progress, DownloadOption options = DO_WITH_IONS);
166
168 bool downloadDaemonResultsFile(std::string filename, ms_http_helper_progress & progress);
169
171 bool downloadPercolatorFile(std::string filename, ms_http_helper_progress & progress);
172
174 bool downloadXmlResultsFile(std::string filename, ms_http_helper_progress & progress, int reportTop = RT_auto);
175#ifndef SWIG
177 bool uploadDistillerXmlResultsFile(std::string filename, UploadResponseCode & responseCode, std::string & responseText);
178#else // SWIG Multiple return values
179 bool uploadDistillerXmlResultsFile(std::string filename, UploadResponseCode & OUTPUT, std::string & OUTPUT);
180#endif
181 private:
182 // Constructor for a newly submitted search
183 ms_http_client_search(ms_http_client_session & session, std::string searchTaskId, const std::string & actionString);
184
185 ms_http_client_session * session_;
186 std::string searchTaskId_;
187 std::string actionString_;
188 ms_http_helper_handles postRequestHandles_;
189
190 friend class ms_http_client_session; // access to constructor and private member variables when starting a search
191 };
192 // end of http_client_group
194} // namespace matrix_science
195
196#endif // MS_HTTP_CLIENT_SEARCH_HPP
197
198/*------------------------------- End of File -------------------------------*/
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
Used for submitting searches to a Mascot server and retrieving search results using HTTP(S).
Definition: ms_http_client_search.hpp:44
ReportTopSpecialValues
Definitions for special 'report top' values when requesting results in XML format.
Definition: ms_http_client_search.hpp:93
UploadResponseCode
Definitions for the various responses possible when uploading data to Mascot.
Definition: ms_http_client_search.hpp:67
@ UR_SUCCESS
The upload completed successfully.
Definition: ms_http_client_search.hpp:68
@ UR_FILE_ALREADY_EXISTS
The upload failed because the file already exists.
Definition: ms_http_client_search.hpp:73
@ UR_INVALID_TASKID
The upload failed due to not having a task identifier.
Definition: ms_http_client_search.hpp:70
@ UR_NO_RESULT_FILE
The upload failed due to the result file not existing.
Definition: ms_http_client_search.hpp:72
@ UR_NO_RESULT_FILENAME
The upload failed due to not having a result file name.
Definition: ms_http_client_search.hpp:71
@ UR_ACCESS_DENIED
The upload was not permitted by Mascot Security.
Definition: ms_http_client_search.hpp:69
std::string sessionId() const
Get the associated session ID.
Definition: ms_http_client_search.hpp:118
SearchStatusCode
Definitions for the various states possible when querying about a running Mascot search.
Definition: ms_http_client_search.hpp:52
@ SS_QUEUED
The search has been submitted, but it has been queued by the server.
Definition: ms_http_client_search.hpp:55
@ SS_UNKNOWN
The search task ID was not recognised as a recent Mascot task.
Definition: ms_http_client_search.hpp:53
@ SS_COMPLETE
The search has completed.
Definition: ms_http_client_search.hpp:57
@ SS_ERROR
An error occurred when running the search. The Mascot error number is available from the getStatus ca...
Definition: ms_http_client_search.hpp:58
@ SS_ASSIGNED
The search task has been assigned but no search has been submitted.
Definition: ms_http_client_search.hpp:54
@ SS_RUNNING
The search has started. The approximate percentage that has been completed is available.
Definition: ms_http_client_search.hpp:56
DownloadOption
Definitions for downloading results.
Definition: ms_http_client_search.hpp:82
This gives access to a Mascot session so searches may be submitted.
Definition: ms_http_client_session.hpp:48