libXpertMass Developer Documentation
  • libXpertMass
  • CrossLinker
  • CrossLinker Class

    class MsXpS::libXpertMass::CrossLinker

    The CrossLinker class provides abstractions to define the chemical basis of a cross-linking reaction. More...

    Header: #include <CrossLinker.hpp>
    Inherits: MsXpS::libXpertMass::PolChemDefEntity, MsXpS::libXpertMass::Formula, and MsXpS::libXpertMass::Ponderable
    Inherited By:

    MsXpS::libXpertMass::CrossLink

    Public Functions

    CrossLinker(PolChemDefCstSPtr pol_chem_def_csp, const QString &name, const QString &formula)
    CrossLinker(const CrossLinker &other)
    virtual ~CrossLinker()
    virtual bool accountMasses(double *mono = 0, double *avg = 0, int times = 1)
    virtual bool accountMasses(Ponderable *ponderable, int times = 1)
    bool appendModif(Modif *modif)
    QString *formatXmlClkElement(int offset, const QString &indent = QString(" "))
    QString formula() const
    int hasModif(const QString &modif_name)
    int isNameKnown()
    const Modif *modifAt(int index) const
    QList<Modif *> &modifList()
    bool removeModifAt(int index)
    bool renderXmlClkElement(const QDomElement &element, int version)
    bool setModifAt(Modif *modif, int index)
    bool validate()
    CrossLinker &operator=(const CrossLinker &other)
    virtual bool operator==(const CrossLinker &other) const

    Reimplemented Public Functions

    virtual bool calculateMasses() override

    Static Public Members

    int isNameInList(const QString &name, const QList<CrossLinker *> &cross_linker_list, CrossLinker *other = 0)

    Protected Variables

    QList<Modif *> m_modifList

    Detailed Description

    The notion of a cross-linker is that it is the description of the chemical reaction that is carried out by Monomers in a Polymer or in an Oligomer sequence to form a CrossLink.

    There are two different kinds of chemical entities potentially involved in the description of a CrossLinker:

    Modif instances that are applied to Monomer instances. the Formula base class that completes the chemical reactions described by the Modif instances.

    Member Function Documentation

    CrossLinker::CrossLinker(PolChemDefCstSPtr pol_chem_def_csp, const QString &name, const QString &formula)

    Constructs a CrossLinker instance.

    CrossLinker::CrossLinker(const CrossLinker &other)

    Constructs a CrossLinker instance as a copy of other.

    [virtual noexcept] CrossLinker::~CrossLinker()

    Destructs this CrossLinker instance

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

    Copies the member masses (Ponderable base class) to mono and avg if these are non-nullptr.

    Upon copying, the masses are multiplied by the compounding factor times.

    Returns true.

    [virtual] bool CrossLinker::accountMasses(Ponderable *ponderable, int times = 1)

    Copies the member masses (Ponderable base class) to ponderable.

    ponderable cannot be nullptr.

    Upon copying, the masses are multiplied by the compounding factor times.

    Returns true.

    bool CrossLinker::appendModif(Modif *modif)

    Adds modif to this CrossLinker instance.

    Returns true.

    [override virtual] bool CrossLinker::calculateMasses()

    Returns true if the mass calculations for this CrossLinker instance are performed without error, false otherwise.

    The calculation involved accounting masses for the Modifs (if any) and for the Formula (if non-empty). The member masses (Ponderable base class) are updated.

    QString *CrossLinker::formatXmlClkElement(int offset, const QString &indent = QString(" "))

    Formats this CrossLinker instance in a heap-allocated string to be used as an XML element in the polymer chemistry definition.

    The formatting of the XML element takes into account offset and indent by prepending the string with offset * indent character substring.

    indent defaults to two spaces.

    Returns a dynamically allocated string that needs to be freed after use.

    QString CrossLinker::formula() const

    Returns the Formula.

    int CrossLinker::hasModif(const QString &modif_name)

    Returns true if a Modif instance by modif_name is in the list of Modif instances, false otherwise.

    [static] int CrossLinker::isNameInList(const QString &name, const QList<CrossLinker *> &cross_linker_list, CrossLinker *other = 0)

    Returns the index of a CrossLinker found in the cross_linker_list list of CrossLinker instances by name name, -1 otherwise.

    If other is non-nullptr, the found CrossLinker instance is copied into it.

    int CrossLinker::isNameKnown()

    Returns true if this CrossLinker instance is found in the member polymer chemistry definition, false otherwise.

    const Modif *CrossLinker::modifAt(int index) const

    Returns the Modif instance at index.

    index cannot be out-of-bounds.

    See also setModifAt().

    QList<Modif *> &CrossLinker::modifList()

    Returns the list of Modif instances.

    bool CrossLinker::removeModifAt(int index)

    Removes the Modif instance at index.

    index cannot be out-of-bounds.

    Returns true.

    bool CrossLinker::renderXmlClkElement(const QDomElement &element, int version)

    Returns true if parsing of XML element, using a versioned function was successful, false otherwise.

    The data in element are set to this CrossLinker instance if they validated successfully, thus essentially initializing this CrossLinker instance.

    bool CrossLinker::setModifAt(Modif *modif, int index)

    Sets the Modif at index index to modif.

    index cannot be out-of-bounds.

    Returns true.

    See also modifAt().

    bool CrossLinker::validate()

    Returns true if this CrossLinker instance validates successfully, false otherwise.

    The validation involves the following:

    CrossLinker &CrossLinker::operator=(const CrossLinker &other)

    Assigns other to this CrossLinker instance.

    Returns a reference to this CrossLinker instance.

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

    Returns true if this CrossLinker and other are identical.

    Member Variable Documentation

    QList<Modif *> CrossLinker::m_modifList

    This variable holds the list of Modif instances that describe the reaction (or the reactions) involved in the formation of a CrossLink between Monomers of a Polymer (or of an Oligomer) sequence.