| [68cb0f] | 1 | #ifndef PERIODENTAFEL_HPP_ | 
|---|
|  | 2 | #define PERIODENTAFEL_HPP_ | 
|---|
|  | 3 |  | 
|---|
| [f66195] | 4 | /*********************************************** includes ***********************************/ | 
|---|
|  | 5 |  | 
|---|
| [68cb0f] | 6 | // include config.h | 
|---|
|  | 7 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 8 | #include <config.h> | 
|---|
|  | 9 | #endif | 
|---|
|  | 10 |  | 
|---|
| [986ed3] | 11 | #include <iosfwd> | 
|---|
| [ead4e6] | 12 | #include <map> | 
|---|
| [f308e6] | 13 | #include <string> | 
|---|
| [68cb0f] | 14 |  | 
|---|
| [e4fe8d] | 15 | #include "Helpers/defs.hpp" | 
|---|
| [ead4e6] | 16 | #include "types.hpp" | 
|---|
| [68cb0f] | 17 |  | 
|---|
| [912a6f] | 18 | #include <boost/version.hpp> | 
|---|
|  | 19 | #if BOOST_VERSION > 106300 | 
|---|
|  | 20 | #include <boost/serialization/array_wrapper.hpp> | 
|---|
|  | 21 | #endif | 
|---|
| [b60804] | 22 | #include "boost/serialization/array.hpp" | 
|---|
|  | 23 | #include "boost/serialization/map.hpp" | 
|---|
|  | 24 |  | 
|---|
| [f66195] | 25 | /****************************************** forward declarations *****************************/ | 
|---|
|  | 26 |  | 
|---|
|  | 27 | class element; | 
|---|
| [37ef6d] | 28 | class ion; | 
|---|
| [f66195] | 29 |  | 
|---|
|  | 30 | /********************************************** declarations *******************************/ | 
|---|
| [6ac7ee] | 31 |  | 
|---|
| [68cb0f] | 32 |  | 
|---|
|  | 33 | /** Periodentafel is a list of all elements sorted by their atomic number. | 
|---|
|  | 34 | */ | 
|---|
|  | 35 | class periodentafel { | 
|---|
| [ead4e6] | 36 | /******* Types *********/ | 
|---|
| [4eb4fe] | 37 | friend class periodentafelTest; | 
|---|
| [b60804] | 38 | private: | 
|---|
|  | 39 | typedef std::map<atomicNumber_t,element*> elementSet; | 
|---|
| [37ef6d] | 40 | typedef std::map<int,ion*> ionSet; | 
|---|
|  | 41 | typedef std::map<atomicNumber_t,ionSet> IonsPerElement; | 
|---|
| [b60804] | 42 | public: | 
|---|
|  | 43 | typedef elementSet::iterator iterator; | 
|---|
|  | 44 | typedef elementSet::const_iterator const_iterator; | 
|---|
|  | 45 | typedef std::reverse_iterator<const_iterator> reverse_iterator; | 
|---|
|  | 46 |  | 
|---|
|  | 47 | /******* Functions *********/ | 
|---|
|  | 48 | public: | 
|---|
| [4ae823] | 49 | periodentafel(const bool DoLoad = false); | 
|---|
| [042f82] | 50 | ~periodentafel(); | 
|---|
| [6ac7ee] | 51 |  | 
|---|
| [e5c0a1] | 52 | iterator AddElement(element * pointer); | 
|---|
|  | 53 | size_t RemoveElement(const element * pointer); | 
|---|
| [61745cc] | 54 | size_t RemoveElement(atomicNumber_t); | 
|---|
| [ead4e6] | 55 | void CleanupPeriodtable(); | 
|---|
| [e5c0a1] | 56 | const element * FindElement(atomicNumber_t) const; | 
|---|
| [37ef6d] | 57 | const element * FindElement(atomicNumber_t, const int); | 
|---|
| [e5c0a1] | 58 | const element * FindElement(const std::string &shorthand) const; | 
|---|
|  | 59 | const element * AskElement() const; | 
|---|
|  | 60 | const element * EnterElement(); | 
|---|
|  | 61 |  | 
|---|
|  | 62 | const_iterator begin() const; | 
|---|
|  | 63 | const_iterator end() const; | 
|---|
|  | 64 | reverse_iterator rbegin() const; | 
|---|
|  | 65 | reverse_iterator rend() const; | 
|---|
| [ead4e6] | 66 | bool Output(std::ostream * const output) const; | 
|---|
| [47ed3d] | 67 | void OutputElement(std::ostream * const output, const element *elem) const; | 
|---|
| [fb73b8] | 68 | bool LoadPeriodentafel(const char * const path); | 
|---|
|  | 69 | bool StorePeriodentafel(const char * const path) const; | 
|---|
| [6ac7ee] | 70 |  | 
|---|
| [b60804] | 71 | bool operator==(const periodentafel &other) const; | 
|---|
|  | 72 |  | 
|---|
|  | 73 | bool operator!=(const periodentafel &other) const { | 
|---|
|  | 74 | return !(*this == other); | 
|---|
|  | 75 | } | 
|---|
| [4eb4fe] | 76 |  | 
|---|
| [b60804] | 77 | private: | 
|---|
|  | 78 | friend class boost::serialization::access; | 
|---|
|  | 79 | // serialization | 
|---|
|  | 80 | template<class Archive> | 
|---|
|  | 81 | void serialize(Archive & ar, const unsigned int version) | 
|---|
|  | 82 | { | 
|---|
|  | 83 | ar & boost::serialization::make_array<char>(header1, MAXSTRINGSIZE); | 
|---|
|  | 84 | ar & boost::serialization::make_array<char>(header2, MAXSTRINGSIZE); | 
|---|
|  | 85 | ar & elements; | 
|---|
| [37ef6d] | 86 | ar & ions; | 
|---|
| [b60804] | 87 | } | 
|---|
|  | 88 |  | 
|---|
| [4ae823] | 89 | void ScanPeriodentafel(); | 
|---|
| [b60804] | 90 | bool LoadColorDatabase(std::istream &input); | 
|---|
| [e5c0a1] | 91 | bool LoadElementsDatabase(std::istream &input); | 
|---|
| [67c92b] | 92 | bool LoadElectronegativityDatabase(std::istream &input); | 
|---|
|  | 93 | bool LoadValenceDatabase(std::istream &input); | 
|---|
|  | 94 | bool LoadOrbitalsDatabase(std::istream &input); | 
|---|
|  | 95 | bool LoadHBondAngleDatabase(std::istream &input); | 
|---|
|  | 96 | bool LoadHBondLengthsDatabase(std::istream &input); | 
|---|
| [4eb4fe] | 97 |  | 
|---|
| [b60804] | 98 | /******* Variables *********/ | 
|---|
|  | 99 | private: | 
|---|
|  | 100 | char header1[MAXSTRINGSIZE]; //!< store first header line | 
|---|
|  | 101 | char header2[MAXSTRINGSIZE]; //!< store second header line | 
|---|
| [68cb0f] | 102 |  | 
|---|
| [b60804] | 103 | elementSet elements; | 
|---|
| [37ef6d] | 104 | IonsPerElement ions; | 
|---|
| [b60804] | 105 | }; | 
|---|
| [68cb0f] | 106 |  | 
|---|
|  | 107 | #endif /*PERIODENTAFEL_HPP_*/ | 
|---|