Matrix Science header
Public Member Functions

ms_fragrulesfile Class Reference
[Mascot configuration files module]

This class encapsulates a complete fragmentation_rules file. More...

#include <ms_fragmentationrules.hpp>

Inheritance diagram for ms_fragrulesfile:
Inheritance graph
[legend]
Collaboration diagram for ms_fragrulesfile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ms_fragrulesfile ()
 Default constructor.
 ms_fragrulesfile (const char *filename, const matrix_science::ms_connection_settings *cs=0)
 Immediate-action constructor that reads the given file.
 ms_fragrulesfile (const ms_fragrulesfile &src)
 Copying constructor.
 ~ms_fragrulesfile ()
 Destructor.
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
void appendInstrument (const ms_fragmentationrules *item)
 Adds a new instrument definition at the end of the list.
void clearAllErrors ()
 Remove all errors from the current list of errors.
void clearInstruments ()
 Deletes all instruments definitions.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
void copyFrom (const ms_fragrulesfile *right)
 Can be used to make a copy of another instance.
void defaultValues ()
 Re-initialises the list of fragmentation rules, so the instance can be re-used.
bool deleteInstrumentByName (const char *name)
 Remove an instrument from the list in memory.
bool deleteInstrumentByNumber (const int num)
 Remove an instrument from the list in memory.
matrix_science::ms_connection_settings getConnectionSettings () const
 Returns the sessionID and proxy server for use with an HTTP transfer.
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
std::string getFileName () const
 Get the currently used file name.
const ms_fragmentationrulesgetInstrumentByName (const char *name) const
 Returns a configuration for an instrument by name.
const ms_fragmentationrulesgetInstrumentByNumber (const int instrumentNum) const
 Returns a configuration for an instrument by its number from 0 to (getNumberOfInstruments()-1).
std::string getInstrumentName (const int instrumentNum) const
 Returns an instrument name by its number from 0 to (getNumberOfInstruments()-1).
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.
int getNumberOfInstruments () const
 Returns a number of instruments configured.
bool isValid () const
 Call this function to determine if there have been any errors.
ms_fragrulesfileoperator= (const ms_fragrulesfile &right)
 C++ style assignment operator.
void read_buffer (const char *buffer)
 Reads and parses the string, populates the list of instruments.
void read_file ()
 Reads and parses the file, populates the list of instruments.
void save_file ()
 Stores instrument definitions in a file.
void setConnectionSettings (const matrix_science::ms_connection_settings &cs)
 Sets the sessionID and proxy server for use with an HTTP transfer.
void setFileName (const char *filename)
 Use this member to set a non-default file name.
bool updateInstrumentByName (const char *name, const ms_fragmentationrules item)
 Update the information for a specific instrument.
bool updateInstrumentByNumber (const int num, const ms_fragmentationrules item)
 Update the information for a specific instrument.

Detailed Description

This class encapsulates a complete fragmentation_rules file.

Usage of this class is simple. Just create an instance, set an explicit file name if necessary, call read_file()-member, check for errors (isValid()) and retrieve an instrument by its name or number.

Examples:

config_fragrules.cpp.


Constructor & Destructor Documentation

Default constructor.

Not generally useful. The filename is set to ../config/fragmentation_rules, but the file is not read.

ms_fragrulesfile ( const char *  filename,
const matrix_science::ms_connection_settings cs = 0 
)

Immediate-action constructor that reads the given file.

Parameters:
filenameThe file name parameter can be either a local file path or a Mascot server URL, it cannot be an empty string or NULL pointer. If it is a URL it should be of the form http://your-server/mascot/cgi .
csis a pointer to the connection settings. This should contain a sessionID and optionally the proxy server settings.

Destructor.

Frees all memory allocated for the object.


Member Function Documentation

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.
void appendInstrument ( const ms_fragmentationrules item )

Adds a new instrument definition at the end of the list.

Typically, the file would be saved after doing this.

Parameters:
itemis the the new instrument definition to be added.
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.
void clearInstruments (  )

Deletes all instruments definitions.

All instruments are removed.

void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
void copyFrom ( const ms_fragrulesfile right )

Can be used to make a copy of another instance.

Parameters:
rightis the fragmentation rules file to copy values from.
void defaultValues (  )

Re-initialises the list of fragmentation rules, so the instance can be re-used.

Clears the list of instruments and comments. Clears all errors.

bool deleteInstrumentByName ( const char *  name )

Remove an instrument from the list in memory.

Parameters:
namemust be a valid instrument name.
Returns:
True if the instrument name is valid and the instrument is removed.
Examples:
config_fragrules.cpp.
bool deleteInstrumentByNumber ( const int  num )

Remove an instrument from the list in memory.

Parameters:
nummust be in the range 0..getNumberOfInstruments()-1.
Returns:
True if the instrument number is valid.
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.
std::string getFileName (  ) const

Get the currently used file name.

Returns:
The new file name or URL.
const ms_fragmentationrules * getInstrumentByName ( const char *  name ) const

Returns a configuration for an instrument by name.

Parameters:
nameis the name of the instrument as specified in the title line in the fragmentation_rules file.
Returns:
The rules specified for the given instrument.
Examples:
config_fragrules.cpp.
const ms_fragmentationrules * getInstrumentByNumber ( const int  instrumentNum ) const

Returns a configuration for an instrument by its number from 0 to (getNumberOfInstruments()-1).

Parameters:
instrumentNumis the number of the instrument and should be between zero and getNumberOfInstruments()-1.
Returns:
The rules specified for the given instrument.
std::string getInstrumentName ( const int  instrumentNum ) const

Returns an instrument name by its number from 0 to (getNumberOfInstruments()-1).

Parameters:
instrumentNumis the number of the instrument and should be between zero and getNumberOfInstruments()-1.
Returns:
The name of the instrument from the title: line in the fragmentation_rules file.
Examples:
config_fragrules.cpp.
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.

Reimplemented in ms_mascotresfile.

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()

Reimplemented in ms_mascotresfile.

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.
int getNumberOfInstruments (  ) const

Returns a number of instruments configured.

Returns:
the number of instrument types with assigned settings.
Examples:
config_fragrules.cpp.
bool isValid (  ) const [inherited]

Call this function to determine if there have been any errors.

This will return true unless there have been any fatal errors.

See Error Handling.

Returns:
True if no fatal error occured
See also:
getLastError(), getLastErrorString(), 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, peptide_list.cpp, resfile_summary.cpp, and tools_aahelper.cpp.
ms_fragrulesfile & operator= ( const ms_fragrulesfile right )

C++ style assignment operator.

Parameters:
rightis the fragmentation rules file to copy values from.
Returns:
reference to the current object
void read_buffer ( const char *  buffer )

Reads and parses the string, populates the list of instruments.

Check for possible errors with isValid()-function and retrieve errors descriptions (if any) after calling this function. If an error occurs during reading the buffer it will still contain some of the instruments that have been successfully read from the file.

Parameters:
bufferbuffer to read
void read_file (  )

Reads and parses the file, populates the list of instruments.

Check for possible errors with isValid()-function and retrieve errors descriptions (if any) after calling this function. If an error occurs during reading the file it will still contain some of the instruments that have been successfully read from the file.

void save_file (  )

Stores instrument definitions in a file.

Don't forget to check for errors after this function call.

Examples:
config_fragrules.cpp.
void setConnectionSettings ( const matrix_science::ms_connection_settings cs )

Sets the sessionID and proxy server for use with an HTTP transfer.

This value would normally be passed in the constructor.

Parameters:
csis the new connection settings.
void setFileName ( const char *  filename )

Use this member to set a non-default file name.

Parameters:
filenameis the new file name or URL.
Examples:
config_fragrules.cpp.
bool updateInstrumentByName ( const char *  name,
const ms_fragmentationrules  item 
)

Update the information for a specific instrument.

Parameters:
namemust be a valid Instrument name.
itemis a pointer to the new definition of the instrument.
Returns:
true if the instrument was found and was updated.
Examples:
config_fragrules.cpp.
bool updateInstrumentByNumber ( const int  num,
const ms_fragmentationrules  item 
)

Update the information for a specific instrument.

Parameters:
nummust be in the range 0..getNumberOfInstruments()-1.
itemis a pointer to the new definition of the instrument definition.
Returns:
true if the instrument was found and was updated.

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

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