Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_http_helper_handles Class Reference

The class holds HTTP to allow a POST request to be kept alive and retrieve any output received from that request. More...

#include <ms_http_helper_handles.hpp>

Inheritance diagram for ms_http_helper_handles:
Collaboration diagram for ms_http_helper_handles:

Public Member Functions

 ms_http_helper_handles ()
 Default constructor.
 
virtual ~ms_http_helper_handles ()
 Destructor.
 
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
 
void clearAllErrors ()
 Remove all errors from the current list of errors.
 
bool closeHandles ()
 Closes the HTTP handles.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
int getLastError () const
 Return the error description of the last error that occurred.
 
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
 
bool getRequestData (bool &isStillActive, std::string &requestDataRef)
 Retrieves data from the HTTP reply and indicates whether the request is still active (and could produce more data).
 
bool isValid () const
 Call this function to determine if there have been any errors.
 

Detailed Description

The class holds HTTP to allow a POST request to be kept alive and retrieve any output received from that request.

Mascot searches will terminate immediately if the HTTP request times out. It is important to keep the request alive by frequently checking for request data. The Mascot server sends occasional data packets that can be collected. Once the request has completed there could be several packets of uncollected data before the function indicates that the request is no longer active. Once it is inactive the handles can be closed. An object of this class is initialised by ms_http_helper::httpPostFile

Constructor & Destructor Documentation

◆ ~ms_http_helper_handles()

~ms_http_helper_handles ( )
virtual

Destructor.

The handles will be automatically closed when there are no more handles object referencing them.

Called automatically.

Member Function Documentation

◆ appendErrors()

void appendErrors ( const ms_errors src)
inherited

Copies all errors from another instance and appends them at the end of own list.

Parameters
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.

◆ clearAllErrors()

void clearAllErrors ( )
inherited

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.

◆ closeHandles()

bool closeHandles ( )

Closes the HTTP handles.

On Windows IIS, closing the handles will terminate a search being done for that task on the Mascot server.

Returns
True if the function completes successfully.

◆ copyFrom()

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ getErrorHandler()

const ms_errs * getErrorHandler ( ) const
inherited

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns
Constant pointer to the error handler
See also
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, and http_helper_getstring.cpp.

◆ getLastError()

int getLastError ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns
the error number of the last error, or 0 if there have been no errors.

◆ getLastErrorString()

std::string getLastErrorString ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns
Most recent error, warning, information or debug message

See Error Handling.

See also
isValid(), getLastError(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.

◆ getRequestData()

bool getRequestData ( bool &  isStillActive,
std::string &  requestDataRef 
)

Retrieves data from the HTTP reply and indicates whether the request is still active (and could produce more data).

The data is whatever is produced by the server as it progresses with the task. The function blocks until dat is available or the server task has finished.

The data from a Mascot server does not reflect any result of a search.

Use the ms_http_client_search::getStatus() function to monitor how the task is progressing.

See Multiple return values in Perl, Java, Python and C#.

Parameters
[out]isStillActiveTrue if any data was retrieved from the request.
[out]requestDataRefThe data retrieved from the request.
Returns
True if the function completed successfully.

◆ isValid()

bool isValid ( ) const
inherited

The documentation for this class was generated from the following files: