Matrix Science header

ms_http_client_search.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_http_client_search.hpp                                                   #
00004 # 'msparser' toolkit                                                         #
00005 # Represents a task on a Mascot server and can be used to sumbit and track   #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2013 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011  * @(#)$Source: parser/inc/ms_http_client_search.hpp $
00012  * @(#)$Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $
00013  * @(#)$Date: 2018-07-30 16:23:53 +0100 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_HTTP_CLIENT_SEARCH_HPP
00018 #define MS_HTTP_CLIENT_SEARCH_HPP
00019 
00020 
00021 #include <string>
00022 
00023 namespace matrix_science
00024 {
00030     class ms_http_helper;
00031     class ms_http_client_session;
00032 
00034 
00042     class MS_MASCOTRESFILE_API ms_http_client_search :
00043         public ms_errors
00044     {
00045         public:
00046 
00048 
00051             enum SearchStatusCode
00052             {
00053                 SS_UNKNOWN,             
00054                 SS_ASSIGNED,            
00055                 SS_QUEUED,              
00056                 SS_RUNNING,             
00057                 SS_COMPLETE,            
00058                 SS_ERROR,               
00059                 SS_SEARCH_CONTROL_ERROR 
00060             };
00061 
00063 
00066             enum UploadResponseCode
00067             {
00068                 UR_SUCCESS,             
00069                 UR_ACCESS_DENIED,       
00070                 UR_INVALID_TASKID,      
00071                 UR_NO_RESULT_FILENAME,  
00072                 UR_NO_RESULT_FILE,      
00073                 UR_FILE_ALREADY_EXISTS, 
00074                 UR_ERROR                
00075             };
00076 
00078 
00081             enum DownloadOption
00082             {
00083                 DO_NORMAL = 0,   
00084                 DO_WITH_IONS = 1 
00085             };
00086 
00088 
00092             enum ReportTopSpecialValues
00093             {
00094                 RT_auto = 0, 
00095                 RT_file = -1 
00096             };
00097 
00098 #ifndef SWIG
00099             // C++ STL collection support
00100             ms_http_client_search();
00101 #endif
00102 
00103             ms_http_client_search(ms_http_client_session & session, const std::string & searchTaskId);
00104 
00106             virtual ~ms_http_client_search();
00107 
00108             ms_http_client_search(const ms_http_client_search & src);
00109 #ifndef SWIG
00110             ms_http_client_search& operator=(const ms_http_client_search & right);
00111 #endif
00112             void copyFrom(const ms_http_client_search * right);
00113 
00115 
00118             std::string sessionId() const { return getSessionID(); }
00119 
00121             std::string getSessionID() const;
00122 
00124             std::string getSearchTaskID() const;
00125 
00127 
00132             std::string searchTaskId() const { return getSearchTaskID(); }
00133 
00135             bool getStatus(SearchStatusCode & returnCode, int & statusValue);
00136 
00137 #ifndef SWIG
00138             // Undocumented for Perl compatibility. Unable to return an enum
00139             bool getStatus(int & returnCodeAsInt, int & statusValue);
00140 
00142             bool getResultsFileName(std::string & returnFileName);
00143 #else // SWIG Multiple return values
00144             bool getStatus(int & OUTPUT, int & OUTPUT);
00145             bool getResultsFileName(std::string & OUTPUT);
00146 #endif
00147 
00149 
00155             bool getResultsFilename(std::string & returnFilename) { return getResultsFileName(returnFilename); }
00156 
00158             bool downloadResultsFile(std::string filename, ms_http_helper_progress & progress, DownloadOption options = DO_WITH_IONS);
00159 
00161             bool downloadDaemonResultsFile(std::string filename, ms_http_helper_progress & progress);
00162             
00164             bool downloadPercolatorFile(std::string filename, ms_http_helper_progress & progress);
00165             
00167             bool downloadXmlResultsFile(std::string filename, ms_http_helper_progress & progress, int reportTop = RT_auto);
00168 #ifndef SWIG
00169 
00170             bool uploadDistillerXmlResultsFile(std::string filename, UploadResponseCode & responseCode, std::string & responseText);
00171 #else // SWIG Multiple return values
00172             bool uploadDistillerXmlResultsFile(std::string filename, UploadResponseCode & OUTPUT, std::string & OUTPUT);
00173 #endif
00174         private:
00175             // Constructor for a newly submitted search
00176             ms_http_client_search(ms_http_client_session & session, std::string searchTaskId, const std::string & actionString);
00177 
00178             ms_http_client_session * session_;
00179             std::string searchTaskId_;
00180             std::string actionString_;
00181             ms_http_helper_handles postRequestHandles_;
00182 
00183         friend class ms_http_client_session; // access to constructor and private member variables when starting a search
00184     };
00185  // end of http_client_group
00187 } // namespace matrix_science
00188 
00189 #endif // MS_HTTP_CLIENT_SEARCH_HPP
00190 
00191 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29