BALL
1.4.1
|
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 #define BALL_ELEMENT_IS_METAL_DEFAULT false 00033 00034 00035 namespace BALL 00036 { 00050 00054 class BALL_EXPORT Element 00055 { 00056 public: 00057 00058 BALL_CREATE(Element) 00059 00060 00062 typedef short Group; 00063 00066 typedef short Period; 00067 00070 typedef short AtomicNumber; 00071 00075 enum Name 00076 { 00077 ACTINIUM = 0, 00078 ALUMINUM, 00079 AMERICIUM, 00080 ANTIMONY, STIBIUM = ANTIMONY, 00081 ARGON, 00082 ARSENIC, 00083 ASTATINE, 00084 BARIUM, 00085 BERKELIUM, 00086 BERYLLIUM, 00087 BISMUTH, WISMUT = BISMUTH, 00088 BOHRIUM, 00089 BORON, 00090 BROMINE, 00091 CADMIUM, 00092 CAESIUM, 00093 CALCIUM, 00094 CALIFORNIUM, 00095 CARBON, CARBONEUM = CARBON, 00096 CERIUM, 00097 CHLORINE, 00098 CHROMIUM, 00099 COBALT, 00100 COPPER, CUPRUM = COPPER, 00101 CURIUM, 00102 DUBNIUM, 00103 DYSPROSIUM, 00104 EINSTEINIUM, 00105 ERBIUM, 00106 EUROPIUM, 00107 FERMIUM, 00108 FLUORINE, 00109 FRANCIUM, 00110 GADOLINIUM, 00111 GALLIUM, 00112 GERMANIUM, 00113 GOLD, AURUM = GOLD, 00114 HAFNIUM, 00115 HAHNIUM, 00116 HELIUM, 00117 HOLMIUM, 00118 HYDROGEN, HYDROGENIUM = HYDROGEN, 00119 INDIUM, 00120 IODINE, JOD = IODINE, 00121 IRIDIUM, 00122 IRON, FERRUM = IRON, 00123 JOLIOTIUM, 00124 KRYPTON, 00125 LANTHANUM, 00126 LAWRENCIUM, 00127 LEAD, PLUMBUM = LEAD, 00128 LITHIUM, 00129 LUTETIUM, 00130 MAGNESIUM, 00131 MANGANESE, MANGAN = MANGANESE, 00132 MEITNERIUM, 00133 MENDELEVIUM, 00134 MERCURY, HYDRARGYRUM = MERCURY, MERCURIUM = MERCURY, 00135 MOLYBDENUM, 00136 NEODYMIUM, 00137 NEON, 00138 NEPTUNIUM, 00139 NICKEL, 00140 NIOBIUM, 00141 NITROGEN, NITROGENIUM = NITROGEN, 00142 NOBELIUM, 00143 OSMIUM, 00144 OXYGEN, OXYGENIUM = OXYGEN, 00145 PALLADIUM, 00146 PHOSPHORUS, 00147 PLATINUM, 00148 PLUTONIUM, 00149 POLONIUM, 00150 POTASSIUM, KALIUM = POTASSIUM, 00151 PRASEODYMIUM, 00152 PROMETHIUM, 00153 PROTACTINIUM, 00154 RADIUM, 00155 RADON, 00156 RHENIUM, 00157 RHODIUM, 00158 RUBIDIUM, 00159 RUTHENIUM, 00160 RUTHERFORDIUM, 00161 SAMARIUM, 00162 SCANDIUM, 00163 SELENIUM, 00164 SILICON, SILICIUM = SILICON, 00165 SILVER, ARGENTUM = SILVER, 00166 SODIUM, NATRIUM = SODIUM, 00167 STRONTIUM, 00168 SULPHUR, SULFUR = SULPHUR, 00169 TANTALUM, 00170 TECHNETIUM, 00171 TELLURIUM, 00172 TERBIUM, 00173 THALLIUM, 00174 THORIUM, 00175 THULIUM, 00176 TIN, STANNUM = TIN, 00177 TITANIUM, 00178 TUNGSTEN, WOLFRAM = TUNGSTEN, 00179 UNUNBIUM, 00180 UNUNNILIUM, 00181 UNUNNINIUM, 00182 URANIUM, 00183 VANADIUM, 00184 XENON, 00185 YTTERBIUM, 00186 YTTRIUM, 00187 ZINC, ZINCUM = ZINC, 00188 ZIRCONIUM, 00189 00190 NUMBER_OF_ELEMENTS // 111 00191 }; 00192 00196 enum Symbol 00197 { 00198 Ac = 0, 00199 Al, 00200 Am, 00201 Sb, 00202 Ar, 00203 As, 00204 At, 00205 Ba, 00206 Bk, 00207 Be, 00208 Bi, 00209 Bh, 00210 B, 00211 Br, 00212 Cd, 00213 Cs, 00214 Ca, 00215 Cf, 00216 C, 00217 Ce, 00218 Cl, 00219 Cr, 00220 Co, 00221 Cu, 00222 Cm, 00223 Db, 00224 Dy, 00225 Es, 00226 Er, 00227 Eu, 00228 Fm, 00229 F, 00230 Fr, 00231 Gd, 00232 Ga, 00233 Ge, 00234 Au, 00235 Hf, 00236 Hn, 00237 He, 00238 Ho, 00239 H, 00240 In, 00241 I, 00242 Ir, 00243 Fe, 00244 Jl, 00245 Kr, 00246 La, 00247 Lr, 00248 Pb, 00249 Li, 00250 Lu, 00251 Mg, 00252 Mn, 00253 Mt, 00254 Md, 00255 Hg, 00256 Mo, 00257 Nd, 00258 Ne, 00259 Np, 00260 Ni, 00261 Nb, 00262 N, 00263 No, 00264 Os, 00265 O, 00266 Pd, 00267 P, 00268 Pt, 00269 Pu, 00270 Po, 00271 K, 00272 Pr, 00273 Pm, 00274 Pa, 00275 Ra, 00276 Rn, 00277 Re, 00278 Rh, 00279 Rb, 00280 Ru, 00281 Rf, 00282 Sm, 00283 Sc, 00284 Se, 00285 Si, 00286 Ag, 00287 Na, 00288 Sr, 00289 S, 00290 Ta, 00291 Tc, 00292 Te, 00293 Tb, 00294 Tl, 00295 Th, 00296 Tm, 00297 Sn, 00298 Ti, 00299 W, 00300 Uub, 00301 Uun, 00302 Uuu, 00303 U, 00304 V, 00305 Xe, 00306 Yb, 00307 Y, 00308 Zn, 00309 Zr 00310 }; 00311 00315 00320 Element(); 00321 00324 Element 00325 (const String& name, 00326 const String& symbol, 00327 Group group, 00328 Period period, 00329 AtomicNumber atomic_umber, 00330 float atomic_weight, 00331 float atomic_radius, 00332 float covalent_radius, 00333 float van_der_waals_radius, 00334 bool is_metal, 00335 float electronegativity); 00336 00339 virtual ~Element(); 00340 00345 virtual void clear(); 00346 00348 00351 00353 00356 00360 void setName(const String& name); 00361 00367 const String& getName() const; 00368 00372 void setSymbol(const String& symbol); 00373 00377 const String& getSymbol() const; 00378 00382 void setGroup(Group group); 00383 00387 Group getGroup() const; 00388 00392 void setPeriod(Period period); 00393 00397 Period getPeriod() const; 00398 00402 void setAtomicNumber(AtomicNumber atomic_number); 00403 00407 AtomicNumber getAtomicNumber() const; 00408 00412 void setAtomicWeight(float atomic_weight); 00413 00417 float getAtomicWeight() const; 00418 00422 void setAtomicRadius(float atomic_radius); 00423 00427 float getAtomicRadius() const; 00428 00432 void setCovalentRadius(float covalent_radius); 00433 00437 float getCovalentRadius() const; 00438 00442 void setVanDerWaalsRadius(float van_der_waals_radius); 00443 00447 float getVanDerWaalsRadius() const; 00448 00452 void setElectronegativity(float electronegativity); 00453 00457 float getElectronegativity() const; 00458 00460 00463 00469 bool operator == (const Element& element) const; 00470 00476 bool operator != (const Element& element) const; 00477 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 00513 BALL_EXPORT 00514 friend std::ostream& operator << (std::ostream& s, const Element& element); 00515 00517 00520 00526 bool isUnknown() const; 00527 00533 bool isMetal() const; 00534 00536 00540 static Element UNKNOWN; 00541 00542 00543 private: 00544 00547 String name_; 00548 00551 String symbol_; 00552 00590 Group group_; 00591 00594 Period period_; 00595 00599 AtomicNumber atomic_number_; 00600 00608 float atomic_weight_; 00609 00612 float atomic_radius_; 00613 00616 float covalent_radius_; 00617 00620 float van_der_waals_radius_; 00621 00624 bool is_metal_; 00625 00628 float electronegativity_; 00629 }; 00630 00631 00635 BALL_EXPORT 00636 std::ostream& operator << (std::ostream& s, const Element& element); 00637 00638 00641 class BALL_EXPORT PTE_ 00642 { 00643 public: 00644 00645 BALL_CREATE(PTE_) 00646 00647 00650 00653 PTE_(); 00654 00657 PTE_(const PTE_& pse); 00658 00661 virtual ~PTE_(); 00662 00665 virtual void clear(); 00666 00668 00671 00676 PTE_& operator = (const PTE_& /*pte*/); 00677 00679 00682 00685 static Element& getElement(Position atomic_number); 00686 00690 static Element& getElement(const String& symbol); 00691 00693 00696 00701 bool operator == (const PTE_& pte) const; 00702 00706 Element& operator [] (const String& symbol); 00707 00711 const Element& operator [] (const String& symbol) const; 00712 00716 Element& operator [] (Element::Name name); 00717 00721 const Element& operator [] (Element::Name name) const; 00722 00726 Element& operator [] (Element::Symbol symbol); 00727 00731 const Element& operator [] (Element::Symbol symbol) const; 00732 00736 Element& operator [] (Position position); 00737 00741 const Element& operator [] (Position position) const; 00742 00744 00747 00753 static bool apply(UnaryProcessor<Element>& applicator); 00754 00756 00758 struct SymbolToElement 00759 { 00761 const char* symbol; 00762 00764 Element* element; 00765 }; 00766 00767 private: 00768 00770 static Element element_[]; 00771 00773 static SymbolToElement symbol_to_element_[]; 00774 00776 static Element* atomic_number_to_element_[]; 00777 }; 00778 00779 00783 BALL_EXPORT extern PTE_ PTE; 00784 00785 00786 00787 # ifndef BALL_NO_INLINE_FUNCTIONS 00788 # include <BALL/KERNEL/PTE.iC> 00789 # endif 00790 } //namespace BALL 00791 00792 00793 #endif // BALL_KERNEL_PTE_H