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

The class provides access license details in read-only mode. More...

#include <ms_license.hpp>

Inheritance diagram for ms_license:
Collaboration diagram for ms_license:

Public Member Functions

 ms_license ()
 Default constructor.
 
 ms_license (const char *filename)
 Immediate action constructor.
 
 ms_license (const ms_license &src)
 Copying constructor.
 
 ~ms_license ()
 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.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
void copyFrom (const ms_license *right)
 Copies all information from another instance.
 
void defaultValues ()
 Can be called before re-using the instance in order to erase the previous license details.
 
std::string getDistributor () const
 Returns Mascot distributor information.
 
std::string getEndDate () const
 Returns a date the license is valid until as a string.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
std::string getFeatures () const
 Returns a string which encodes feature information.
 
std::string getFileName () const
 Returns a file name being used as a license.
 
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.
 
std::string getLicensee () const
 Returns a name of the licensee.
 
std::string getLicenseString () const
 Returns a compound license string that can be used for displaying license information.
 
std::string getLicenseVersion () const
 Returns a license version as a string.
 
int getNumProcessorsLicensed () const
 Returns a number of processors licensed.
 
std::string getStartDate () const
 Returns a date the license is valid from as a string.
 
bool isLicenseValid () const
 Returns TRUE if the license has been sucessfully read, parsed and checked.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
ms_licenseoperator= (const ms_license &right)
 Assignment operator for C++ client applications.
 
void read_file ()
 Main method that reads in the license file.
 
void setFileName (const char *filename)
 Set the license file name explicitly rather than use a default location.
 

Detailed Description

The class provides access license details in read-only mode.

This class doesn't contain functions to create a new license or read details of why a license may be invalid.

Please note the ms_license class will only work with license files from Mascot release 2.3 or earlier.

To use this class:

  • Create an instance of this class.
  • Set an explicit file name if needed.
  • Call read_file().
  • Check for possible file reading errors with isValid().
  • Check license validity with isLicenseValid().
  • If the license is valid, then access individual license properties.
  • Re-use the instance (if you need to read multiple licenses) after calling defaultValues().
Examples
config_license.cpp.

Constructor & Destructor Documentation

◆ ms_license() [1/2]

Default constructor.

Deprecated:
Warning: This class just reads licenses for Mascot version 2.4.x and earlier

This doesn't read a license file.

◆ ms_license() [2/2]

ms_license ( const char *  filename)

Immediate action constructor.

Deprecated:
Warning: This class just reads licenses for Mascot version 2.4.x and earlier

Loads the license file into memory. Call isValid() and isLicenseValid() to checks that it is a valid license file.

Parameters
filenameis a full or relative path to mascot.license

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.

◆ 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

◆ getDistributor()

std::string getDistributor ( ) const

Returns Mascot distributor information.

The distributor will be one of:

  • Unknown
  • Direct
  • Bruker
  • Infocom
  • Kratos
  • Applied Biosystems
  • Mass Solutions Ltd Taiwan
Returns
the distributor as a string.

◆ getEndDate()

std::string getEndDate ( ) const

Returns a date the license is valid until as a string.

Returns
the license end date as a string in the format YYYYMMDD.

◆ 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.

◆ getFeatures()

std::string getFeatures ( ) const

Returns a string which encodes feature information.

Returns
a numerically encoded string.

◆ getFileName()

std::string getFileName ( ) const

Returns a file name being used as a license.

Returns
The license filename – full or relative path.

◆ 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.

◆ getLicensee()

std::string getLicensee ( ) const

Returns a name of the licensee.

The licensee name will be up to 80 characters long.

Returns
the licensee as a string.

◆ getLicenseString()

std::string getLicenseString ( ) const

Returns a compound license string that can be used for displaying license information.

This will be of the following format:

   Licensed to: xxx, (yy processors).

For a temporary license:

    Licensed to: xxx, (yy processors). Demo version expires: zzzz
Returns
the license string.
Examples
config_license.cpp.

◆ getLicenseVersion()

std::string getLicenseVersion ( ) const

Returns a license version as a string.

The license version number is not directly related to the Mascot version number. It is incremented each time new functionality (and hence extra lines) are added to the license file.

Returns
The license version number as a string.

◆ getNumProcessorsLicensed()

int getNumProcessorsLicensed ( ) const

Returns a number of processors licensed.

Returns
the number of processors licensed.

◆ getStartDate()

std::string getStartDate ( ) const

Returns a date the license is valid from as a string.

Returns
the license start date as a string in the format YYYYMMDD.

◆ isLicenseValid()

bool isLicenseValid ( ) const

Returns TRUE if the license has been sucessfully read, parsed and checked.

If the license is not valid, some information may be available by calling getLastErrorString() or getLastError().

Returns
true if the license is valid.
Examples
config_license.cpp.

◆ isValid()

bool isValid ( ) const
inherited

◆ read_file()

void read_file ( )

Main method that reads in the license file.

Deprecated:
Warning: This class just reads licenses for Mascot version 2.4.x and earlier

Called by the constructor if a filename is passed.

◆ setFileName()

void setFileName ( const char *  filename)

Set the license file name explicitly rather than use a default location.

Deprecated:
Warning: This class just reads licenses for Mascot version 2.4.x and earlier

A default location for the license file is ../config/mascot.license. Call this member to change this file name before calling read_file().

Parameters
filenameThe license filename – full or relative path.

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