CycloBranch
cSummaryFormula Class Reference

The representation of a summary formula. More...

#include <cSummaryFormula.h>

Public Member Functions

 cSummaryFormula ()
 The constructor.
 
 cSummaryFormula (string &formula, bool partial=false)
 The constructor. More...
 
void clear ()
 Clear the structure.
 
void setFormula (const string &formula, bool partial=false)
 Set the formula. More...
 
string getSummary ()
 Get the summary formula as a string. More...
 
string getFancySummary (int charge)
 Get the fancy summary formula as a string. More...
 
bool isPartial ()
 Check if the formula is incomplete or not. More...
 
void setPartial (bool partial)
 Set the formula as partial. More...
 
void addFormula (string &formula, bool remove=false)
 Add a formula to the existing one. More...
 
void setFromMap (map< string, int > &atoms, bool partial)
 Set the string formula from a map of atoms. More...
 
bool isValid (string &errormessage)
 Check the syntax of a chemical formula. More...
 
bool isEmpty ()
 Check if the formula is empty. More...
 
bool hasAllElementsPositive ()
 Check if the formula has the numbers of all elements positive. More...
 
double getMass ()
 Get mass of the formula. More...
 
cPeaksList getIsotopePattern (double fwhm, int charge, bool positive, int maxchangedatoms, bool writedescription)
 Get a theoretical isotope pattern of the formula. More...
 
void store (ofstream &os)
 Store the structure into an output stream. More...
 
void load (ifstream &is)
 Load the structure from an input stream. More...
 
bool equals (cSummaryFormula &secondformula)
 Check if the object equals to another object. More...
 

Detailed Description

The representation of a summary formula.

Constructor & Destructor Documentation

◆ cSummaryFormula()

cSummaryFormula::cSummaryFormula ( string &  formula,
bool  partial = false 
)

The constructor.

Parameters
formulaa chemical formula
partialtrue when the formula is incomplete

Member Function Documentation

◆ addFormula()

void cSummaryFormula::addFormula ( string &  formula,
bool  remove = false 
)

Add a formula to the existing one.

Parameters
formulaa chemical formula
removeif true then the formula is removed; if false then the formula is added

◆ equals()

bool cSummaryFormula::equals ( cSummaryFormula secondformula)

Check if the object equals to another object.

Parameters
secondformulaobject for comparison
Return values
booltrue if the objects are equals

◆ getFancySummary()

string cSummaryFormula::getFancySummary ( int  charge)

Get the fancy summary formula as a string.

Parameters
chargepeak charge
Return values
stringformula as a string

◆ getIsotopePattern()

cPeaksList cSummaryFormula::getIsotopePattern ( double  fwhm,
int  charge,
bool  positive,
int  maxchangedatoms,
bool  writedescription 
)

Get a theoretical isotope pattern of the formula.

Parameters
fwhmFWHM
chargecharge
positivetrue if the charge is positive charge, false if the charge is negative
maxchangedatomsmaximum number of atoms of an element which are replaced with isotopic variants
writedescriptionif true then string descriptions of peaks are filled
Return values
cPeaksListisotopic pattern of the formula

◆ getMass()

double cSummaryFormula::getMass ( )

Get mass of the formula.

Return values
doublemass of the formula

◆ getSummary()

string cSummaryFormula::getSummary ( )

Get the summary formula as a string.

Return values
stringformula as a string

◆ hasAllElementsPositive()

bool cSummaryFormula::hasAllElementsPositive ( )

Check if the formula has the numbers of all elements positive.

Return values
booltrue if the formula has the numbers of all elements positive

◆ isEmpty()

bool cSummaryFormula::isEmpty ( )

Check if the formula is empty.

Return values
booltrue if the formula is empty; false otherwise

◆ isPartial()

bool cSummaryFormula::isPartial ( )

Check if the formula is incomplete or not.

Return values
booltrue when the formula is incomplete, false when the formula is complete

◆ isValid()

bool cSummaryFormula::isValid ( string &  errormessage)

Check the syntax of a chemical formula.

Parameters
errormessagean error message if formula is invalid
Return values
booltrue when formula is valid

◆ load()

void cSummaryFormula::load ( ifstream &  is)

Load the structure from an input stream.

Parameters
isan input stream

◆ setFormula()

void cSummaryFormula::setFormula ( const string &  formula,
bool  partial = false 
)

Set the formula.

Parameters
formulaa chemical formula
partialtrue when the formula is incomplete

◆ setFromMap()

void cSummaryFormula::setFromMap ( map< string, int > &  atoms,
bool  partial 
)

Set the string formula from a map of atoms.

Parameters
atomsan input map of atoms
partialtrue if the formula is incomplete

◆ setPartial()

void cSummaryFormula::setPartial ( bool  partial)

Set the formula as partial.

Parameters
partialtrue if the formula is incomplete

◆ store()

void cSummaryFormula::store ( ofstream &  os)

Store the structure into an output stream.

Parameters
osan output stream

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