37#include "tklevel_builder.h"
42#include "tkensdf_level_rec.h"
56tklevel_builder::~tklevel_builder() =
default;
58tklevel_builder::tklevel_builder(
tkdatabase *_database,
const char *_table_name) :
tkdb_builder(_database, _table_name)
60 fTable = &fDataBase->new_table(fTableName);
62 fTable->add_column(
"level_id",
"INT NOT NULL PRIMARY KEY");
63 fTable->add_column(
"isotope_id",
"INT NOT NULL");
64 fTable->add_column(
"dataset_id",
"INT NOT NULL");
66 add_measure(
"energy");
68 fTable->add_column(
"level_spin",
"REAL");
69 fTable->add_column(
"level_parity",
"INT");
70 fTable->add_column(
"level_spin_parity",
"TEXT");
72 add_measure(
"lifetime");
74 fTable->add_column(
"level_comment",
"TEXT");
76 fTable->add_column(
"level_uncertain",
"TEXT");
78 fTable->add_constraint(
"FOREIGN KEY (isotope_id) REFERENCES ISOTOPE (isotope_id),");
79 fTable->add_constraint(
"FOREIGN KEY (dataset_id) REFERENCES DATASET (dataset_id)");
81 fTable->write_to_database();
83 glog <<
info <<
"Creating '" << _table_name <<
"' table" <<
do_endl;
89 (*fTable)[
"level_id"].set_value(fLevelIdx);
90 (*fTable)[
"isotope_id"].set_value(_isotope_idx);
91 (*fTable)[
"dataset_id"].set_value(_dset_idx);
93 fill_measure(
"energy",_lev_record.
get_energy());
96 if(_lev_record.
get_J()->
is_known()) (*fTable)[
"level_spin"].set_value(_lev_record.
get_j());
98 (*fTable)[
"level_spin_parity"].set_value(_lev_record.
get_Jpi_str());
109 tkdb_table& isotope = (*gdatabase)[
"ISOTOPE"];
112 isotope[
"spin"].set_value(_lev_record.
get_j());
113 isotope[
"parity"].set_value(_lev_record.
get_pi());
114 isotope[
"spin_parity"].set_value(_lev_record.
get_Jpi_str());
Interface to the sqlite database.
Mother class used to fill the sqlite database.
Representaiton of a sqlite data table.
void update_row(const tkstring &_where)
Decodding of the ENSDF level properties.
const bool & get_pi() const
const tkstring & get_Jpi_str() const
const tkparity * get_Pi() const
const double & get_j() const
const tkspin * get_J() const
bool is_uncertain() const
check if the record is uncertain
const tkstring & get_uncertain_record() const
get the record uncertain type
virtual const tkstring & get_comment_record() const
get the continuation record
const tkdb_table::measure_data_struct & get_energy() const
const tkdb_table::measure_data_struct & get_lifetime() const
Filling of the ENSDF level properties.
void fill_level(int _dset_idx, int _isotope_idx, const tkensdf_level_rec &_lev_record, bool _adopted)
bool is_known() const
to get some information about this data
static const char * form(const char *_format,...)
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
tklog & do_endl(tklog &log)