libXpertMass Developer Documentation
  • libXpertMass
  • Ponderable
  • Ponderable Class

    class MsXpS::libXpertMass::Ponderable

    The Ponderable class provides an abstraction for any chemical entity having a monoisotopic and an average mass. More...

    Header: #include <Ponderable.hpp>
    Inherited By:

    MsXpS::libXpertMass::CrossLinker, MsXpS::libXpertMass::Ionizable, MsXpS::libXpertMass::Modif, and MsXpS::libXpertMass::Monomer

    Public Functions

    Ponderable(double mono = 0, double avg = 0)
    Ponderable(const Ponderable &other)
    virtual ~Ponderable()
    virtual bool accountMasses(double *mono = 0, double *avg = 0, int times = 1) const
    double avg() const
    QString avgString(int decimalPlaces) const
    void clearMasses()
    void decrementAvg(double mass)
    void decrementMono(double mass)
    void incrementAvg(double mass)
    void incrementMass(double mass, MassType type)
    void incrementMono(double mass)
    double mass(MassType type) const
    void masses(double *mono = 0, double *avg = 0) const
    double mono() const
    QString monoString(int decimalPlaces) const
    double &ravg()
    double &rmono()
    void setAvg(double mass)
    bool setAvg(const QString &mass)
    void setMass(double mass, MassType type)
    void setMasses(double mono, double avg)
    void setMono(double mass)
    bool setMono(const QString &mass)
    virtual bool operator!=(const Ponderable &other) const
    virtual Ponderable &operator=(const Ponderable &other)
    virtual bool operator==(const Ponderable &other) const

    Protected Variables

    double m_avg
    double m_mono

    Detailed Description

    Functions are provided to modify the member masses.

    See also Modif and Monomer.

    Member Function Documentation

    Ponderable::Ponderable(double mono = 0, double avg = 0)

    Constructs a ponderable initializing its masses with mono and avg.

    Ponderable::Ponderable(const Ponderable &other)

    Constructs a ponderable initializing it using other.

    [virtual noexcept] Ponderable::~Ponderable()

    Destructs the ponderable.

    [virtual] bool Ponderable::accountMasses(double *mono = 0, double *avg = 0, int times = 1) const

    Increase the member masses by adding either mono and or avg compounded by times.

    The monoisotopic mass is increased if mono is not nullptr. The mono value is compounded by times and the result is added to the member monoisotopic datum.

    The average mass is increased if avg is not nullptr. The avg value is compounded by times and the result is added to the member average datum.

    Always returns true.

    double Ponderable::avg() const

    Returns the average mass.

    See also setAvg().

    QString Ponderable::avgString(int decimalPlaces) const

    Returns a string representing the average mass using decimalPlaces for the precision.

    void Ponderable::clearMasses()

    Sets the member data masses to 0.0.

    void Ponderable::decrementAvg(double mass)

    Decrements the average mass by subtracting mass.

    void Ponderable::decrementMono(double mass)

    Decrements the monoisotopic mass by subtracting mass.

    void Ponderable::incrementAvg(double mass)

    Increments the average mass by adding mass.

    void Ponderable::incrementMass(double mass, MassType type)

    Add to the member data the mass value in mass.

    The member datum that is modified depends on the value of type.

    void Ponderable::incrementMono(double mass)

    Increments the monoisotopic mass by adding mass.

    double Ponderable::mass(MassType type) const

    Returns the mass depending on the type.

    See also setMass().

    void Ponderable::masses(double *mono = 0, double *avg = 0) const

    Sets the mono and avg to the corresponding member data values.

    The pointer arguments cannot be nullptr.

    See also setMasses().

    double Ponderable::mono() const

    Returns the monoisotopic mass.

    See also setMono().

    QString Ponderable::monoString(int decimalPlaces) const

    Returns a string representing the monoisotopic mass using decimalPlaces for the precision.

    double &Ponderable::ravg()

    Returns a reference to the average mass.

    double &Ponderable::rmono()

    Returns a reference to the monoisotopic mass.

    void Ponderable::setAvg(double mass)

    Sets the average mass to mass.

    See also avg().

    bool Ponderable::setAvg(const QString &mass)

    Sets the average mass to mass.

    The mass string is converted to double.

    Returns true if the conversion succceeded, false otherwise.

    void Ponderable::setMass(double mass, MassType type)

    Initializes the member data using mass.

    The member datum that is initialized depends on the value of type.

    See also mass().

    void Ponderable::setMasses(double mono, double avg)

    Initializes the member data using mono and avg.

    See also masses().

    void Ponderable::setMono(double mass)

    Sets the monoisotopic mass to mass.

    See also mono().

    bool Ponderable::setMono(const QString &mass)

    Sets the monoisotopic mass to mass.

    The mass string is converted to double.

    Returns true if the conversion succceeded, false otherwise.

    [virtual] bool Ponderable::operator!=(const Ponderable &other) const

    Returns true if other and this ponderable have at least one differing mass, false otherwise.

    [virtual] Ponderable &Ponderable::operator=(const Ponderable &other)

    Assigns to this Ponderable' member data the values in other.

    Returns a reference to this Ponderable

    [virtual] bool Ponderable::operator==(const Ponderable &other) const

    Returns true if other and this ponderable have the same masses, false otherwise.

    Member Variable Documentation

    double Ponderable::m_avg

    This variable holds the average mass.

    double Ponderable::m_mono

    This variable holds the monoisotopic mass.