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: /vol/cvsroot/parser/inc/ms_http_client_search.hpp,v $
00012  * @(#)$Revision: 1.11 $
00013  * @(#)$Date: 2016/05/19 16:07:07 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_HTTP_CLIENT_SEARCH_HPP
00018 #define MS_HTTP_CLIENT_SEARCH_HPP
00019 
00020 #ifdef _WIN32
00021 #pragma warning(disable:4251)   // Don't want all classes to be exported
00022 #pragma warning(disable:4786)   // Debug symbols too long
00023 #   ifndef _MATRIX_USE_STATIC_LIB
00024 #       ifdef MS_MASCOTRESFILE_EXPORTS
00025 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00026 #       else
00027 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00028 #       endif
00029 #   else
00030 #       define MS_MASCOTRESFILE_API
00031 #   endif
00032 #else
00033 #   define MS_MASCOTRESFILE_API
00034 #endif
00035 
00036 #include <string>
00037 
00038 namespace matrix_science
00039 {
00045     class ms_http_helper;
00046     class ms_http_client_session;
00047 
00049 
00057     class MS_MASCOTRESFILE_API ms_http_client_search :
00058         public ms_errors
00059     {
00060         public:
00061 
00063 
00066             enum SearchStatusCode
00067             {
00068                 SS_UNKNOWN,             
00069                 SS_ASSIGNED,            
00070                 SS_QUEUED,              
00071                 SS_RUNNING,             
00072                 SS_COMPLETE,            
00073                 SS_ERROR,               
00074                 SS_SEARCH_CONTROL_ERROR 
00075             };
00076 
00078 
00081             enum UploadResponseCode
00082             {
00083                 UR_SUCCESS,             
00084                 UR_ACCESS_DENIED,       
00085                 UR_INVALID_TASKID,      
00086                 UR_NO_RESULT_FILENAME,  
00087                 UR_NO_RESULT_FILE,      
00088                 UR_FILE_ALREADY_EXISTS, 
00089                 UR_ERROR                
00090             };
00091 
00093 
00096             enum DownloadOption
00097             {
00098                 DO_NORMAL = 0,   
00099                 DO_WITH_IONS = 1 
00100             };
00101 
00103 
00107             enum ReportTopSpecialValues
00108             {
00109                 RT_auto = 0, 
00110                 RT_file = -1 
00111             };
00112 
00113 #ifndef SWIG
00114             // C++ STL collection support
00115             ms_http_client_search();
00116 #endif
00117 
00118             ms_http_client_search(ms_http_client_session & session, const std::string & searchTaskId);
00119 
00121             virtual ~ms_http_client_search();
00122 
00123             ms_http_client_search(const ms_http_client_search & src);
00124 #ifndef SWIG
00125             ms_http_client_search& operator=(const ms_http_client_search & right);
00126 #endif
00127             void copyFrom(const ms_http_client_search * right);
00128 
00130 
00133             std::string sessionId() const { return getSessionID(); }
00134 
00136             std::string getSessionID() const;
00137 
00139             std::string getSearchTaskID() const;
00140 
00142 
00146             std::string searchTaskId() const { return getSearchTaskID(); }
00147 
00149             bool getStatus(SearchStatusCode & returnCode, int & statusValue);
00150 
00151             // Undocumented for Perl compatibility. Unable to return an enum
00152             bool getStatus(int & returnCodeAsInt, int & statusValue);
00153 
00155             bool getResultsFileName(std::string & returnFileName);
00156 
00158 
00162             bool getResultsFilename(std::string & returnFilename) { return getResultsFileName(returnFilename); }
00163 
00165             bool downloadResultsFile(std::string filename, ms_http_helper_progress & progress, DownloadOption options = DO_WITH_IONS);
00166 
00168             bool downloadDaemonResultsFile(std::string filename, ms_http_helper_progress & progress);
00169             
00171             bool downloadPercolatorFile(std::string filename, ms_http_helper_progress & progress);
00172             
00174             bool downloadXmlResultsFile(std::string filename, ms_http_helper_progress & progress, int reportTop = RT_auto);
00175 
00177             bool uploadDistillerXmlResultsFile(std::string filename, UploadResponseCode & responseCode, std::string & responseText);
00178 
00179         private:
00180             // Constructor for a newly submitted search
00181             ms_http_client_search(ms_http_client_session & session, std::string searchTaskId, const std::string & actionString);
00182 
00183             ms_http_client_session * session_;
00184             std::string searchTaskId_;
00185             std::string actionString_;
00186             ms_http_helper_handles postRequestHandles_;
00187 
00188         friend class ms_http_client_session; // access to constructor and private member variables when starting a search
00189     };
00190  // end of http_client_group
00192 } // namespace matrix_science
00193 
00194 #endif // MS_HTTP_CLIENT_SEARCH_HPP
00195 
00196 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51