| 1 | /* | 
|---|
| 2 | * ion.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Mar 10, 2014 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef ION_HPP_ | 
|---|
| 9 | #define ION_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | /*********************************************** includes ***********************************/ | 
|---|
| 12 |  | 
|---|
| 13 | // include config.h | 
|---|
| 14 | #ifdef HAVE_CONFIG_H | 
|---|
| 15 | #include <config.h> | 
|---|
| 16 | #endif | 
|---|
| 17 |  | 
|---|
| 18 | #include <iosfwd> | 
|---|
| 19 | #include <string> | 
|---|
| 20 |  | 
|---|
| 21 | #include "Element/element.hpp" | 
|---|
| 22 | #include "types.hpp" | 
|---|
| 23 |  | 
|---|
| 24 | #include "boost/serialization/access.hpp" | 
|---|
| 25 |  | 
|---|
| 26 | class periodentafel; | 
|---|
| 27 |  | 
|---|
| 28 | /********************************************** declarations *******************************/ | 
|---|
| 29 |  | 
|---|
| 30 | /** Ion of a chemical element. | 
|---|
| 31 | * | 
|---|
| 32 | * This class extends element with an ionization. | 
|---|
| 33 | */ | 
|---|
| 34 | class ion : public element | 
|---|
| 35 | { | 
|---|
| 36 | friend class periodentafel; | 
|---|
| 37 | public: | 
|---|
| 38 | ion(const element& _element, const int _ionization); | 
|---|
| 39 | ion(const element* const _element, const int _ionization); | 
|---|
| 40 | virtual ~ion(); | 
|---|
| 41 |  | 
|---|
| 42 | ion& operator=(const element &other); | 
|---|
| 43 | ion& operator=(const ion &other); | 
|---|
| 44 |  | 
|---|
| 45 | // accessor functions | 
|---|
| 46 | virtual atomicNumber_t getAtomicNumber() const; | 
|---|
| 47 | virtual double getCharge() const; | 
|---|
| 48 | virtual double getValence() const; | 
|---|
| 49 | virtual int getNoValenceOrbitals() const; | 
|---|
| 50 |  | 
|---|
| 51 | bool operator==(const element &other) const; | 
|---|
| 52 | bool operator!=(const element &other) const; | 
|---|
| 53 | bool operator==(const ion &other) const; | 
|---|
| 54 | bool operator!=(const ion &other) const { | 
|---|
| 55 | return !(*this == other); | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | private: | 
|---|
| 59 | friend class boost::serialization::access; | 
|---|
| 60 | // private default cstor, just for serialization | 
|---|
| 61 | ion(); | 
|---|
| 62 |  | 
|---|
| 63 | // serialization | 
|---|
| 64 | template<class Archive> | 
|---|
| 65 | void serialize(Archive & ar, const unsigned int version) | 
|---|
| 66 | { | 
|---|
| 67 | ar & boost::serialization::base_object<element>(*this); | 
|---|
| 68 | ar & const_cast<int &>(ionization); | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | const int ionization;    //!< missing or surplus electrons of this ion | 
|---|
| 72 | }; | 
|---|
| 73 |  | 
|---|
| 74 | std::ostream &operator<<(std::ostream&,const ion&); | 
|---|
| 75 |  | 
|---|
| 76 | #endif /* ION_HPP_ */ | 
|---|