00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033
00034
00044
00045
00046
00047
00048
00049 #include "database/MJDatabaseIsotope.hh"
00050 #include "database/MJDatabaseUtil.hh"
00051
00052
00053 MJDatabaseIsotope::MJDatabaseIsotope()
00054 {
00055 }
00056 MJDatabaseIsotope::MJDatabaseIsotope(string name, string sym, int z, int n, double a)
00057 :fName(name),
00058 fSymb(sym),
00059 fz(z),
00060 fn(n),
00061 fMolarMass(a)
00062
00063 {
00064 }
00065 MJDatabaseIsotope::MJDatabaseIsotope(const MJDatabaseIsotope & other)
00066 :fName(other.fName),
00067 fSymb(other.fSymb),
00068 fz(other.fz),
00069 fn(other.fn),
00070 fMolarMass(other.fMolarMass)
00071 {
00072
00073 }
00074
00075 MJDatabaseIsotope::~MJDatabaseIsotope()
00076 {
00077 }
00078 MJDatabaseIsotope*
00079 MJDatabaseIsotope::createIsotope(PGresult * res){
00080
00081 MJDatabaseUtil dbutil;
00082 for (int i = 0; i < PQntuples(res); i++)
00083 {
00084 fName = PQgetvalue(res, i, 0);
00085 fSymb = PQgetvalue(res, i, 1);
00086 fz=dbutil.c_Int(PQgetvalue(res, i, 2));
00087 fn=dbutil.c_Int(PQgetvalue(res, i, 3));
00088 fMolarMass=dbutil.c_Float(PQgetvalue(res, i, 4));
00089 fPnnlkey = PQgetvalue(res, i, 5);
00090 fDecay5 = PQgetvalue(res, i, 6);
00091 fComment = PQgetvalue(res, i, 7);
00092
00093 }
00094 return this;
00095 }
00096 void
00097 MJDatabaseIsotope::print()
00098 {
00099 cout << "***** Isotope Properties *****\n"
00100 << "Name : " << GetName() << endl
00101 << "Symbol : " << GetSymbol() << endl
00102 << "Z-number : " << GetZ() << endl
00103 << "# of nucleons: " << GetN() << endl
00104 << "Molar mass : " << GetMolarMass() << endl;
00105 }
00106 ostream& operator << (ostream& os, MJDatabaseIsotope & iso){
00107 os << '\n';
00108 os << "***** Isotope Properties *****\n"
00109 << "Name : " << iso.GetName() << endl
00110 << "Symbol : " << iso.GetSymbol() << endl
00111 << "Z-number : " << iso.GetZ() << endl
00112 << "# of nucleons: " << iso.GetN() << endl
00113 << "Molar mass : " << iso.GetMolarMass() << endl;
00114 return os;
00115 }