00001
00002
00003
00004
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
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
00375 const String& getName() const;
00376
00380 void setSymbol(const String& symbol);
00381
00385 const String& getSymbol() const;
00386
00390 void setGroup(Group group);
00391
00395 Group getGroup() const;
00396
00400 void setPeriod(Period period);
00401
00405 Period getPeriod() const;
00406
00410 void setAtomicNumber(AtomicNumber atomic_number);
00411
00415 AtomicNumber getAtomicNumber() const;
00416
00420 void setAtomicWeight(float atomic_weight);
00421
00425 float getAtomicWeight() const;
00426
00430 void setAtomicRadius(float atomic_radius);
00431
00435 float getAtomicRadius() const;
00436
00440 void setCovalentRadius(float covalent_radius);
00441
00445 float getCovalentRadius() const;
00446
00450 void setVanDerWaalsRadius(float van_der_waals_radius);
00451
00455 float getVanDerWaalsRadius() const;
00456
00460 void setElectronegativity(float electronegativity);
00461
00465 float getElectronegativity() const;
00466
00468
00471
00477 bool operator == (const Element& element) const;
00478
00484 bool operator != (const Element& element) const;
00485
00492 bool operator < (const Element& element) const;
00493
00500 bool operator <= (const Element& element) const;
00501
00508 bool operator >= (const Element& element) const;
00509
00516 bool operator >(const Element& element) const;
00517
00521 BALL_EXPORT
00522 friend std::ostream& operator << (std::ostream& s, const Element& element);
00523
00525
00528
00534 bool isUnknown() const;
00535
00537
00541 static Element UNKNOWN;
00542
00543
00544 private:
00545
00548 String name_;
00549
00552 String symbol_;
00553
00591 Group group_;
00592
00595 Period period_;
00596
00600 AtomicNumber atomic_number_;
00601
00609 float atomic_weight_;
00610
00613 float atomic_radius_;
00614
00617 float covalent_radius_;
00618
00621 float van_der_waals_radius_;
00622
00625 float electronegativity_;
00626 };
00627
00628
00632 BALL_EXPORT
00633 std::ostream& operator << (std::ostream& s, const Element& element);
00634
00635
00638 class BALL_EXPORT PTE_
00639 {
00640 public:
00641
00642 BALL_CREATE(PTE_)
00643
00644
00647
00650 PTE_();
00651
00654 PTE_(const PTE_& pse);
00655
00658 virtual ~PTE_();
00659
00662 virtual void clear();
00663
00665
00668
00673 PTE_& operator = (const PTE_& );
00674
00676
00679
00682 static Element& getElement(Position atomic_number);
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 }
00788
00789
00790 #endif // BALL_KERNEL_PTE_H