| | |
The Isotope class models an isotope. More...
| Header: | #include <Isotope.hpp> |
| Inherits: | QObject |
| Isotope(QObject *parent = nullptr) | |
| Isotope(const MsXpS::libXpertMassCore::Isotope *other_p, QObject *parent = nullptr) | |
| Isotope(const QString &text, QObject *parent = nullptr) | |
| Isotope(const QString &name, const QString &symbol, double mass, double probability, QObject *parent = nullptr) | |
| Isotope(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr) | |
| virtual | ~Isotope() |
| void | clear() |
| MsXpS::libXpertMassCore::Isotope * | clone(QObject *parent = nullptr) const |
| double | getMass() const |
| QString | getName() const |
| double | getProbability() const |
| QString | getSymbol() const |
| bool | initialize(const QString &text) |
| bool | initialize(const QString &name, const QString &symbol, double mass, double probability) |
| bool | initializeVersion1(const QString &text) |
| bool | initializeVersion2(const QString &text) |
| bool | isValid() const |
| void | setMass(double mass) |
| void | setName(const QString &name) |
| void | setProbability(double probability) |
| void | setSymbol(const QString &symbol) |
| QString | toString() const |
| bool | validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) |
| bool | operator!=(const MsXpS::libXpertMassCore::Isotope &other) const |
| bool | operator==(const MsXpS::libXpertMassCore::Isotope &other) const |
| MsXpS::libXpertMassCore::Isotope * | clone(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr) |
| bool | m_isValid |
| double | m_mass |
| QString | m_name |
| double | m_probability |
| QString | m_symbol |
The Isotope class models an Isotope by featuring all the methods and member data required to fully characterize an isotope. The member data in this class have been inspired by the element tables from the IsoSpec library. Please, see https://github.com/MatteoLacki/IsoSpec/.
[invokable] Isotope::Isotope(QObject *parent = nullptr)Constructs an absolutely empty Isotope.
The Isotope instance is invalid. It can be later intialized with the setter functions or the initialization functions.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also initialize(const QString &) and initialize(const QString &name, const QString &symbol, double mass, double probability).
This is an overloaded function.
Constructs the Isotope as a copy of other_p, setting parent to parent.
[invokable] Isotope::Isotope(const QString &text, QObject *parent = nullptr)This is an overloaded function.
Isotope::Isotope(const QString &text, QObject *parent)
Constructs this Isotope using all the data in the text string, setting parent to parent.
The string contains all the Isotope data, separated by a comma ',' exactly with the same format as that implemented by Isotope::toString().
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also initialize(const QString &), initialize(const QString &name, const QString &symbol, double mass, double probability), and toString().
[invokable] Isotope::Isotope(const QString &name, const QString &symbol, double mass, double probability, QObject *parent = nullptr)This is an overloaded function.
Constructs the Isotope with all the required arguments.
The isotope is created as a fully documented instance if all the following parameters are correctly set:
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also initialize(const QString &name, const QString &symbol, double mass, double probability).
This is an overloaded function.
Constructs the Isotope as a copy of other setting parent to parent.
[virtual noexcept] Isotope::~Isotope()Destructs this Isotope.
[invokable] void Isotope::clear()Resets all the member data to default invalid values.
The m_isValid member datum is set to false.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] MsXpS::libXpertMassCore::Isotope *Isotope::clone(QObject *parent = nullptr) constReturns a heap-allocated Isotope as a copy of this Isotope but reparented with parent.
Each member datum in this Isotope is copied the returned Isotope, effectivaly making a copy of this Isotope and returning it after reparenting to parent.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[static] MsXpS::libXpertMassCore::Isotope *Isotope::clone(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr)Returns a heap-allocated Isotope as a copy of other but reparented with parent.
Each member datum in other is copied the returned Isotope, effectivaly making a copy of other and returning it after reparenting to parent.
[invokable] double Isotope::getMass() constReturns the mass of the isotope.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property mass.
See also setMass().
[invokable] QString Isotope::getName() constReturns the name of the isotope.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property name.
See also setName().
[invokable] double Isotope::getProbability() constReturns the probability (the abundance) of the isotope.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property probability.
See also setProbability().
[invokable] QString Isotope::getSymbol() constReturns the symbol of the isotope.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property symbol.
See also setSymbol().
[invokable] bool Isotope::initialize(const QString &text)Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The obtained strings are converted to the corresponding numerical or textual values to initalize all the member data.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
[invokable] bool Isotope::initialize(const QString &name, const QString &symbol, double mass, double probability)This function overloads MsXpS::libXpertMassCore::initialize(const QString &name,.
const QString &symbol, double mass, double probability)
Initializes this Isotope instance using name, symbol, mass and probability.
Returns true if initilization was without error, false otherwise.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also initialize(const QString &text).
Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The index of the substring in the string list obtained by splitting the initial text at ',' delimiter defines what data element it corresponds to.
The obtained strings are converted to the corresponding numerical or textual values to initalize all the member data.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The index of the substring in the string list obtained by splitting the initial text at ',' delimiter defines what data element it corresponds to.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
Return the member datum m_isValid.
Note: Getter function for property isValid.
[invokable] void Isotope::setMass(double mass)Sets the the mass of the isotope to mass.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Setter function for property mass.
See also getMass().
[invokable] void Isotope::setName(const QString &name)Sets the name of the isotope to name.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Setter function for property name.
See also getName().
[invokable] void Isotope::setProbability(double probability)Sets the probability (the abundance) of the isotope to probability.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Setter function for property probability.
See also getProbability().
[invokable] void Isotope::setSymbol(const QString &symbol)Sets the symbol of the isotope to symbol.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Setter function for property symbol.
See also getSymbol().
[invokable] QString Isotope::toString() constReturns a string containing a comma-separated textual representation of all the member data values.
All the member data values are separated using commas ','. Only the values are stored in the string, without naming the variables:
return QString("%1,%2,%3,%4") .arg(m_name) .arg(m_symbol) .arg(m_mass, 0, 'f', 60) .arg(m_probability, 0, 'f', 60);
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] bool Isotope::validate(MsXpS::libXpertMassCore::ErrorList *error_list_p)Validates the isotope.
The element name, symbol, mass and probability member data are scrutinized and if errors are detected descriptive error messages are added to error_list_p.
For example, for symbol:
if(m_symbol.isEmpty()) { local_text = m_symbol.simplified(); regexp.setPattern("^[A-Z][a-z]*$"); if(!regexp.match(local_text).hasMatch()) { error_msg = "Failed to validate the element's symbol."; error_list_p->push_back(error_msg); qWarning() << error_msg; } }
Returns the error count. If no error occurred, the returned value is 0.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Tests the inequality between this isotope and other.
Returns the negated result of operator==().
See also operator==().
Tests the equality between this isotope and other.
Each member datum in other is compared to this isotope's member datum. If a difference is detected, a counter is incremented.
Returns true if no difference has been encountered (the counter is 0) and false otherwise.
See also operator!=().
This variable holds the validity status of this isotope.
See also validate().
This variable holds the mass of this isotope.
Cannot be negative.
This variable holds the element name, like "carbon" or "nitrogen" (lowercase).
This variable holds the probability of this isotope, that is, its abundance.
Cannot be negative nor superior to 1.
This variable holds the element symbol, like "C" or "N".