Logo Search packages:      
Sourcecode: kalzium version File versions  Download package

chemicaldataobject.h

#ifndef CHEMICALDATAOBJECT_H
#define CHEMICALDATAOBJECT_H
/***************************************************************************
 *   Copyright (C) 2005 by Carsten Niehaus                                 *
 *   cniehaus@kde.org                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/

#include <QtCore/QSharedData>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QVariant>

#include "libkdeedu_science_export.h"

class ChemicalDataObjectPrivate;
/**
 * A ChemicalDataObject is an object which contains information about
 * a chemical element. This can for example be a boiling point. The information
 * is stored in a QVariant.
 * This class supports the CML-format defined by the BlueObelisk-Project.
 *
 * @author Carsten Niehaus <cniehaus@kde.org>
 */
00038 class SCIENCE_EXPORT ChemicalDataObject
{
public:
    /**
     * The BlueObelisk-project defines in their XML file the dataset
     * with the names of the enum plus "bo:". So for symbol
     * it is "bo:symbol". To avoid confusion I will choose the very
     * same naming
     */
00047     enum BlueObelisk
    {
00049         atomicNumber = 0 /**< The atomic number of the element */,
00050         symbol/**< the symbol of the element */,
00051         name/**< The IUPAC name of the element */,
00052         mass/**< # IUPAC Official Masses */,
00053         exactMass/**< exact masses of the most common isotopes for each element */,
00054         ionization/**< First inizationenergy */,
00055         electronAffinity/**< the electron affinity of the element */,
00056         electronegativityPauling/**< the electronegativity in the definition of Pauling*/,
00057         radiusCovalent/**< the covalent radius */,
00058         radiusVDW/**< the van der Waals radius */,
00059         meltingpoint/**< the meltingpoint */,
00060         boilingpoint/**< the boilingpoint */,
00061         periodTableBlock/**< the block of the element */,
00062         family/**< "Noblegas" "Non-Metal" "Rare_Earth" "Alkaline_Earth" "Alkali_Earth" "Transition" "Other_Metal" "Metalloids" "Halogene" */,
00063         acidicbehaviour/**< 0 means acidic, 1 means basic, 2 means neutral, 3 means amphoteric*/,
00064         crystalstructure/**< own, bcc, hdp, ccp, hcp, fcc, d, sc, tet, rh, or, mono*/,
00065         electronicConfiguration/**< the electronic configuration, for example 1s2 for He*/,
00066         group/**< This is a value between 1 and 8*/,
00067         nameOrigin/**< the origin of the name */,
00068         orbit/**< the quantumorbit of the element */,
00069         period/**< the period of the element */,
00070         date/**< date of discovery of the element. When 0, the element has been known in ancient times. When the value is -1 the element has not yet been officially recognized by the IUPAC */,
00071         discoverers/** The name of the discoverers, separated by semicolomns */,
00072         relativeAbundance/** The abundance, relative to 100 */,
00073         spin/**< The spin */,
00074         magneticMoment/**< The magnetic dipole moment */,
00075         halfLife/**< The halflife */,
00076         alphaDecayLikeliness/**< The percentage of alphadecay */,
00077         alphaDecay/**< The decayenergy of alphadecay in MeV */,
00078         betaplusDecayLikeliness/**< The percentage of betaplusdecay */,
00079         betaplusDecay/**< The decayenergy of betaplusdecay in MeV */,
00080         betaminusDecayLikeliness/**< The percentage of betaminusdecay */,
00081         betaminusDecay/**< The decayenergy of betaminusdecay in MeV */,
00082         ecDecayLikeliness/**< The percentage of ecdecay */,
00083         ecDecay/**< The decayenergy of ecminusdecay in MeV */,
00084         dangerSymbol/**< the danger symbols are the dangers associated with an element, for example Xn,T+ */,
00085         RPhrase/**< */,
00086         SPhrase/**< */,
        discoveryCountry,
00088         oxidation/**< Oxidation states*/
    };

    /**
     * Constructor.
     */
    ChemicalDataObject();

    /**
     * Constructor.
     * @param v the data of the object
     * @param type the type of the data
     * @param errorValue the error margin of the value @p v
     *
     * @see errorValue()
     */
    ChemicalDataObject( const QVariant& v,
                        BlueObelisk type,
                        const QVariant& errorValue = QVariant(0) );

    /**
     * Copy constructor.
     */
    ChemicalDataObject(const ChemicalDataObject &other);

    /**
     * Destructor.
     */
    ~ChemicalDataObject();

    /**
     * Set the data of this object to @p v
     * @param v the value of the object
     */
    void setData( const QVariant& v );

    /**
     * Set the error value of this object to @p v.
     * The error has to have the same unit as the value.
     * @param v the value of the object
     */
    void setErrorValue(  const QVariant& v );

    /**
     * Every ChemicalDataObject contains one data. For example a
     * integer value which represents the boiling point. This method
     * returns the value as a QString.
     *
     * For bool, the returned string will be "false" or "true"
     * For a QString, the QString will be returned
     * For a int or double, the value will be returned as a QString
     *
     * @return the value as a QString
     */
    QString valueAsString() const;

    /**
     * Every ChemicalDataObject contains one data. For example a
     * integer value which represents the boiling point. This method
     * returns the value as a QVariant.
     *
     * @return the value as a QVariant
     */
    QVariant value() const;

    /**
     * @return the error margin of the object
     */
    QVariant errorValue() const;

    /**
     * @return the type of dataset of this object
     */
    BlueObelisk type() const;

    /**
     * @param type the type of this object
     */
    void setType( BlueObelisk type );

    /**
     * @overload
     */
    void setType( int type );

    /**
     * Compare the value @p v with the data of this object
     */
    bool operator== ( const int v ) const;

    /**
     * Compare the value @p v with the data of this object
     */
    bool operator== ( const double v ) const;

    /**
     * Compare the value @p v with the data of this object
     */
    bool operator== ( const bool v ) const;

    /**
     * Compare the value @p v with the data of this object
     */
    bool operator== ( const QString& v ) const;

    /**
     * @return the unit of the object as a QString. For example kelvin
     * will be returned as "bo:kelvin"
     */
    QString unitAsString() const;

    /**
     * @return the unit of the object
     */
    int unit() const;

    /**
     * set the unit of this object to @p unit
     * @param unit the BlueObeliskUnit for this object
     */
    void setUnit( int unit );

    ChemicalDataObject& operator=(const ChemicalDataObject &other);

    bool operator==(const ChemicalDataObject &other) const;

    bool operator!=(const ChemicalDataObject &other) const;

private:
    QSharedDataPointer<ChemicalDataObjectPrivate> d;
};

#endif // CHEMICALDATAOBJECT_H

Generated by  Doxygen 1.6.0   Back to index