PTE.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: PTE.h,v 1.30.16.1 2007/03/25 21:23:42 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_KERNEL_PTE_H
00008 #define BALL_KERNEL_PTE_H
00009 
00010 #ifndef BALL_COMMON_CREATE_H
00011 # include <BALL/COMMON/create.h>
00012 #endif
00013 
00014 #ifndef BALL_DATATYPE_STRING_H
00015 # include <BALL/DATATYPE/string.h>
00016 #endif
00017 
00018 #ifndef BALL_CONCEPT_PROCESSOR_H
00019 # include <BALL/CONCEPT/processor.h>
00020 #endif
00021 
00022 #define BALL_ELEMENT_NAME_DEFAULT                "Unknown"
00023 #define BALL_ELEMENT_SYMBOL_DEFAULT              "?"
00024 #define BALL_ELEMENT_GROUP_DEFAULT               0
00025 #define BALL_ELEMENT_PERIOD_DEFAULT              0
00026 #define BALL_ELEMENT_ATOMICNUMBER_DEFAULT        0
00027 #define BALL_ELEMENT_ATOMICWEIGHT_DEFAULT        0
00028 #define BALL_ELEMENT_ATOMICRADIUS_DEFAULT        0
00029 #define BALL_ELEMENT_COVALENTRADIUS_DEFAULT      0
00030 #define BALL_ELEMENT_VANDERWAALSRADIUS_DEFAULT   0
00031 #define BALL_ELEMENT_ELECTRONEGATIVITY_DEFAULT   0
00032 
00033 
00034 namespace BALL 
00035 {
00049 
00053   class BALL_EXPORT Element
00054   {
00055     public:
00056 
00057       BALL_CREATE(Element)
00058 
00059       
00061       typedef short Group;
00062 
00065       typedef short Period;
00066 
00069       typedef short AtomicNumber;
00070 
00074       enum Name
00075       {
00076         ACTINIUM = 0,
00077         ALUMINUM,
00078         AMERICIUM,
00079         ANTIMONY, STIBIUM = ANTIMONY,
00080         ARGON,
00081         ARSENIC,
00082         ASTATINE,
00083         BARIUM,
00084         BERKELIUM,
00085         BERYLLIUM,
00086         BISMUTH, WISMUT = BISMUTH,
00087         BOHRIUM,
00088         BORON,
00089         BROMINE,
00090         CADMIUM,
00091         CAESIUM,
00092         CALCIUM,
00093         CALIFORNIUM,
00094         CARBON, CARBONEUM = CARBON,
00095         CERIUM,
00096         CHLORINE,
00097         CHROMIUM,
00098         COBALT,
00099         COPPER, CUPRUM = COPPER,
00100         CURIUM,
00101         DUBNIUM,
00102         DYSPROSIUM,
00103         EINSTEINIUM,
00104         ERBIUM,
00105         EUROPIUM,
00106         FERMIUM,
00107         FLUORINE,
00108         FRANCIUM,
00109         GADOLINIUM,
00110         GALLIUM,
00111         GERMANIUM,
00112         GOLD, AURUM = GOLD,
00113         HAFNIUM,
00114         HAHNIUM,
00115         HELIUM,
00116         HOLMIUM,
00117         HYDROGEN, HYDROGENIUM = HYDROGEN,
00118         INDIUM,
00119         IODINE, JOD = IODINE,
00120         IRIDIUM,
00121         IRON, FERRUM = IRON,
00122         JOLIOTIUM,
00123         KRYPTON,
00124         LANTHANUM,
00125         LAWRENCIUM,
00126         LEAD, PLUMBUM = LEAD,
00127         LITHIUM,
00128         LUTETIUM,
00129         MAGNESIUM,
00130         MANGANESE, MANGAN = MANGANESE,
00131         MEITNERIUM,
00132         MENDELEVIUM,
00133         MERCURY, HYDRARGYRUM = MERCURY, MERCURIUM = MERCURY,
00134         MOLYBDENUM,
00135         NEODYMIUM,
00136         NEON,
00137         NEPTUNIUM,
00138         NICKEL,
00139         NIOBIUM,
00140         NITROGEN, NITROGENIUM = NITROGEN,
00141         NOBELIUM,
00142         OSMIUM,
00143         OXYGEN, OXYGENIUM = OXYGEN,
00144         PALLADIUM,
00145         PHOSPHORUS,
00146         PLATINUM,
00147         PLUTONIUM,
00148         POLONIUM,
00149         POTASSIUM, KALIUM = POTASSIUM,
00150         PRASEODYMIUM,
00151         PROMETHIUM,
00152         PROTACTINIUM,
00153         RADIUM,
00154         RADON,
00155         RHENIUM,
00156         RHODIUM,
00157         RUBIDIUM,
00158         RUTHENIUM,
00159         RUTHERFORDIUM,
00160         SAMARIUM,
00161         SCANDIUM,
00162         SELENIUM,
00163         SILICON, SILICIUM = SILICON,
00164         SILVER, ARGENTUM = SILVER,
00165         SODIUM, NATRIUM = SODIUM,
00166         STRONTIUM,
00167         SULPHUR, SULFUR = SULPHUR,
00168         TANTALUM,
00169         TECHNETIUM,
00170         TELLURIUM,
00171         TERBIUM,
00172         THALLIUM,
00173         THORIUM,
00174         THULIUM,
00175         TIN, STANNUM = TIN,
00176         TITANIUM,
00177         TUNGSTEN, WOLFRAM = TUNGSTEN,
00178         UNUNBIUM,
00179         UNUNNILIUM,
00180         UNUNNINIUM,
00181         URANIUM,
00182         VANADIUM,
00183         XENON,
00184         YTTERBIUM,
00185         YTTRIUM,
00186         ZINC, ZINCUM = ZINC,
00187         ZIRCONIUM,
00188         
00189         NUMBER_OF_ELEMENTS //  111
00190       };
00191 
00195       enum Symbol
00196       {
00197         Ac = 0,
00198         Al,
00199         Am,
00200         Sb,
00201         Ar,
00202         As,
00203         At,
00204         Ba,
00205         Bk,
00206         Be,
00207         Bi,
00208         Bh,
00209         B,
00210         Br,
00211         Cd,
00212         Cs,
00213         Ca,
00214         Cf,
00215         C,
00216         Ce,
00217         Cl,
00218         Cr,
00219         Co,
00220         Cu,
00221         Cm,
00222         Db,
00223         Dy,
00224         Es,
00225         Er,
00226         Eu,
00227         Fm,
00228         F,
00229         Fr,
00230         Gd,
00231         Ga,
00232         Ge,
00233         Au,
00234         Hf,
00235         Hn,
00236         He,
00237         Ho,
00238         H,
00239         In,
00240         I,
00241         Ir,
00242         Fe,
00243         Jl,
00244         Kr,
00245         La,
00246         Lr,
00247         Pb,
00248         Li,
00249         Lu,
00250         Mg,
00251         Mn,
00252         Mt,
00253         Md,
00254         Hg,
00255         Mo,
00256         Nd,
00257         Ne,
00258         Np,
00259         Ni,
00260         Nb,
00261         N,
00262         No,
00263         Os,
00264         O,
00265         Pd,
00266         P,
00267         Pt,
00268         Pu,
00269         Po,
00270         K,
00271         Pr,
00272         Pm,
00273         Pa,
00274         Ra,
00275         Rn,
00276         Re,
00277         Rh,
00278         Rb,
00279         Ru,
00280         Rf,
00281         Sm,
00282         Sc,
00283         Se,
00284         Si,
00285         Ag,
00286         Na,
00287         Sr,
00288         S,
00289         Ta,
00290         Tc,
00291         Te,
00292         Tb,
00293         Tl,
00294         Th,
00295         Tm,
00296         Sn,
00297         Ti,
00298         W,
00299         Uub,
00300         Uun,
00301         Uuu,
00302         U,
00303         V,
00304         Xe,
00305         Yb,
00306         Y,
00307         Zn,
00308         Zr
00309       };
00310 
00314       
00319       Element();
00320 
00323       Element(const Element& element);
00324 
00327       Element
00328         (const String& name,
00329          const String& symbol,
00330          Group group,
00331          Period period,
00332          AtomicNumber atomic_umber,
00333          float atomic_weight,
00334          float atomic_radius,
00335          float covalent_radius,
00336          float van_der_waals_radius,
00337          float electronegativity);
00338 
00341       virtual ~Element();
00342 
00347       virtual void clear();
00348       
00350 
00353 
00358       Element& operator = (const Element& element);
00359 
00361 
00364     
00368       void setName(const String& name);
00369 
00373       const String& getName() const;
00374 
00378       void setSymbol(const String& symbol);
00379 
00383       const String& getSymbol() const;
00384 
00388       void setGroup(Group group);
00389 
00393       Group getGroup() const;
00394 
00398       void setPeriod(Period period);
00399 
00403       Period getPeriod() const;
00404 
00408       void setAtomicNumber(AtomicNumber atomic_number);
00409 
00413       AtomicNumber getAtomicNumber() const;
00414 
00418       void setAtomicWeight(float atomic_weight);
00419 
00423       float getAtomicWeight() const;
00424 
00428       void setAtomicRadius(float atomic_radius);
00429 
00433       float getAtomicRadius() const;
00434 
00438       void setCovalentRadius(float covalent_radius);
00439 
00443       float getCovalentRadius() const;
00444 
00448       void setVanDerWaalsRadius(float van_der_waals_radius);
00449 
00453       float getVanDerWaalsRadius() const;
00454 
00458       void setElectronegativity(float electronegativity);
00459 
00463       float getElectronegativity() const;
00464 
00466 
00469 
00475       bool operator == (const Element& element) const;
00476 
00482       bool operator != (const Element& element) const;
00483 
00490       bool operator < (const Element& element) const;
00491 
00498       bool operator <= (const Element& element) const;
00499 
00506       bool operator >= (const Element& element) const;
00507 
00514       bool operator >(const Element& element) const;
00515 
00519       BALL_EXPORT
00520       friend std::ostream& operator << (std::ostream& s, const Element& element);
00521 
00523 
00526 
00532       bool isUnknown() const;
00533 
00535 
00539       static Element UNKNOWN;
00540 
00541 
00542     private:
00543 
00546       String name_;
00547 
00550       String symbol_;
00551 
00589       Group   group_;
00590 
00593       Period  period_;
00594 
00598       AtomicNumber atomic_number_;
00599 
00607       float atomic_weight_;
00608     
00611       float atomic_radius_;
00612 
00615       float  covalent_radius_;
00616 
00619       float van_der_waals_radius_;
00620 
00623       float electronegativity_;
00624   };
00625 
00626 
00630   BALL_EXPORT
00631   std::ostream& operator << (std::ostream& s, const Element& element);
00632 
00633 
00636   class BALL_EXPORT PTE_
00637   {
00638     public:
00639 
00640       BALL_CREATE(PTE_)
00641 
00642       
00645 
00648       PTE_();
00649 
00652       PTE_(const PTE_& pse);
00653 
00656       virtual ~PTE_();
00657 
00660       virtual void clear();
00661 
00663 
00666     
00671       PTE_& operator = (const PTE_& /*pte*/);
00672       
00674 
00677 
00682       static Element& getElement(Position position);
00683     
00687       static Element& getElement(const String& symbol);
00688 
00690 
00693     
00698       bool operator == (const PTE_& pte) const;
00699 
00703       Element& operator [] (const String& symbol);
00704 
00708       const Element& operator [] (const String& symbol) const;
00709 
00713       Element& operator [] (Element::Name name);
00714 
00718       const Element& operator [] (Element::Name name) const;
00719 
00723       Element& operator [] (Element::Symbol symbol);
00724 
00728       const Element& operator [] (Element::Symbol symbol) const;
00729 
00733       Element& operator [] (Position position);
00734 
00738       const Element& operator [] (Position position) const;
00739 
00741 
00744     
00750       static bool apply(UnaryProcessor<Element>& applicator);
00751 
00753 
00755       struct SymbolToElement
00756       {
00758         const char* symbol;
00759 
00761         Element*    element;
00762       };
00763 
00764     private:
00765 
00767       static Element element_[];
00768 
00770       static SymbolToElement symbol_to_element_[];
00771 
00773       static Element* atomic_number_to_element_[];
00774   };
00775 
00776 
00780   BALL_EXPORT extern PTE_ PTE;
00781 
00782 
00783 
00784 # ifndef BALL_NO_INLINE_FUNCTIONS
00785 #   include <BALL/KERNEL/PTE.iC>
00786 # endif
00787 } //namespace BALL 
00788 
00789 
00790 #endif // BALL_KERNEL_PTE_H