TkN 2.1
Toolkit for Nuclei
tkensdf_record.h
1/********************************************************************************
2 * Copyright (c) : Université de Lyon 1, CNRS/IN2P3, UMR5822, *
3 * IP2I, F-69622 Villeurbanne Cedex, France *
4 * Normandie Université, ENSICAEN, UNICAEN, CNRS/IN2P3, *
5 * LPC Caen, F-14000 Caen, France *
6 * Contibutor(s) : *
7 * Jérémie Dudouet jeremie.dudouet@cnrs.fr [2020] *
8 * Diego Gruyer diego.gruyer@cnrs.fr [2020] *
9 * *
10 * This software is governed by the CeCILL-B license under French law and *
11 * abiding by the rules of distribution of free software. You can use, *
12 * modify and/ or redistribute the software under the terms of the *
13 * CeCILL-B license as circulated by CEA, CNRS and INRIA at the following *
14 * URL \"http://www.cecill.info\". *
15 * *
16 * As a counterpart to the access to the source code and rights to copy, *
17 * modify and redistribute granted by the license, users are provided *
18 * only with a limited warranty and the software's author, the holder of *
19 * the economic rights, and the successive licensors have only limited *
20 * liability. *
21 * *
22 * In this respect, the user's attention is drawn to the risks associated *
23 * with loading, using, modifying and/or developing or reproducing the *
24 * software by the user in light of its specific status of free software, *
25 * that may mean that it is complicated to manipulate, and that also *
26 * therefore means that it is reserved for developers and experienced *
27 * professionals having in-depth computer knowledge. Users are therefore *
28 * encouraged to load and test the software's suitability as regards *
29 * their requirements in conditions enabling the security of their *
30 * systems and/or data to be ensured and, more generally, to use and *
31 * operate it in the same conditions as regards security. *
32 * *
33 * The fact that you are presently reading this means that you have had *
34 * knowledge of the CeCILL-B license and that you accept its terms. *
35 ********************************************************************************/
36
64#ifndef tkensdf_record_H
65#define tkensdf_record_H
66
67#include <iostream>
68
69#include "tkdb_table.h"
70#include "tkstring.h"
71
72namespace tkn {
73
75
76public:
77
79
80 static const int RSIZE = 81; // a record size is 81 bytes (80 data + \n)
81 static std::string BLANK;
82
84
85protected:
86
89
90 tkstring frecord = "";
91 tkstring fid = "";
92
93 record_type ftype = kunknown;
94 bool f_is_continuation_record = false;
95
96 tkstring fcontinuation_record = "";
97 tkstring fcomment_record = "";
98
99 tkstring fUncertain_record = "";
100
101 bool fisknown_woth_offset = false;
102 tkstring fOffset="";
103
104public:
105
108
110 virtual bool set_record(const tkstring &_record);
111
113 virtual void analyse_record() {;}
114
116 virtual void add_continuation_record(const tkstring &_continuation_record);
117
119 virtual tkstring get_continuation_record() { return fcontinuation_record;}
120
123
125 virtual void add_comment_record(const tkstring &_comment_record, bool _is_continuation=false);
126
128 virtual const tkstring &get_comment_record() const { return fcomment_record;}
129
131 virtual void analyse_comment_record() {;}
132
134 void check_record_type();
135
137 const tkstring &get_record() {return frecord;}
138
140 record_type get_record_type() {return ftype;}
141
143 bool is_continuation_record() {return f_is_continuation_record;}
144
146 bool is_comment() {return (ftype==kcomment);}
147
149 tkstring get_energy_str(const tkstring &_record) const {return _record.substr(9,12);}
150
152 tkstring get_lifetime_str(const tkstring &_record) const {return _record.substr(39,16);}
153
155 tkstring get_lifetime_metastable_str(const tkstring &_record) const {return _record.substr(77,2);}
156
158 bool decode_energy(const tkstring &_st);
159
161 bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms);
162
164 bool is_uncertain() const {return !fUncertain_record.is_empty();}
165
167 const tkstring &get_uncertain_record() const {return fUncertain_record;}
168
170 void set_offset(tkstring _offset) {fisknown_woth_offset=true; fOffset=_offset;}
171
173 bool is_energy_offset() {return fisknown_woth_offset;}
174
176 tkstring get_energy_offset() { return fOffset;}
177
178
179 virtual void clear();
180 virtual void print(std::ostream &) const;
181
182// const double &get_energy() const {return fenergy;}
183// const double &get_energy_error() const {return fenergy_error;}
184// const int &get_energy_precision() const {return fenergy_precision;}
185
186 const tkdb_table::measure_data_struct &get_lifetime() const {return flifetime;}
187 const tkdb_table::measure_data_struct &get_energy() const {return fenergy;}
188
189};
190
191
192}
193
194#endif
Decodding of the ENSDF records.
bool is_uncertain() const
check if the record is uncertain
bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms)
decode a lifetime record
bool decode_energy(const tkstring &_st)
decode an anergy record
const tkstring & get_uncertain_record() const
get the record uncertain type
virtual void analyse_record()
analyse the record content, to be re implemented in all daughter classes
tkstring get_lifetime_metastable_str(const tkstring &_record) const
extract the lifetime part
static std::string BLANK
void check_record_type()
check record type from its string
const tkstring & get_record()
get record
virtual void print(std::ostream &) const
virtual void add_comment_record(const tkstring &_comment_record, bool _is_continuation=false)
add a continuation record from a string
bool is_energy_offset()
to now if the energy is given with an offset
tkstring get_energy_str(const tkstring &_record) const
extract the energy part
virtual bool set_record(const tkstring &_record)
define the record from a string. Option false only checks if the record is an identification record
bool is_continuation_record()
to now if the record is a continuation record or not
tkstring fglobal_time_unit
virtual const tkstring & get_comment_record() const
get the continuation record
tkstring get_lifetime_str(const tkstring &_record) const
extract the lifetime part
const tkdb_table::measure_data_struct & get_energy() const
virtual void analyse_continuation_record()
analyse the continuation record
virtual void analyse_comment_record()
analyse the continuation record
const tkdb_table::measure_data_struct & get_lifetime() const
virtual void clear()
tkstring get_energy_offset()
get_energy_offset
virtual void add_continuation_record(const tkstring &_continuation_record)
add a continuation record from a string
record_type get_record_type()
get record type
static const int RSIZE
virtual tkstring get_continuation_record()
get the continuation record
void set_offset(tkstring _offset)
set_energy_offset
bool is_comment()
to now if the record is a comment
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
bool is_empty() const
Definition: tkstring.h:163
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
Definition: tkstring.h:179
Definition: tklog.cpp:39
data structure used to fill a tkmeasure object from the sqlite database
Definition: tkdb_table.h:72