TkN 2.1
Toolkit for Nuclei
tkensdf_reader.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
37#ifndef tkensdf_reader_H
38#define tkensdf_reader_H
39
40#include <fstream>
41#include <map>
42
43#include "tkstring.h"
44#include "tkensdf_ident_rec.h"
45
46namespace tkn {
47
49
51
52private:
53
55 std::ifstream fEnsdf_file{};
56
58 ensdf_data_type fdata_type = kensdf;
59
61 tkstring fNucleus{};
62
64 bool fVerbose = false;
65
67 std::map<tkensdf_record::record_type, std::pair<long long, long long > > frecords_counter;
68
69 tkstring finput_folder;
70
71protected:
72
74 std::vector<tkensdf_ident_rec> fDataSets;
75
76public:
77
78 tkensdf_reader(const tkstring &_input_folder) : finput_folder(_input_folder) {};
79 virtual ~tkensdf_reader() = default;
80
82 bool open_nuc(const tkstring &_nuc_name, const ensdf_data_type &_ftype=kensdf);
83
85 void print_datasets();
86
88 void reset_record_counter() {frecords_counter.clear();}
91
93 std::vector<tkensdf_ident_rec> *get_datasets() {return &fDataSets;}
94
96 bool first_record(tkensdf_ident_rec *_dataset, tkstring &record);
97
99 bool next_record(tkensdf_ident_rec *_dataset, tkstring &record);
100
101private:
102
104 bool open_file(const tkstring &_file_name);
105
107 virtual void close_file();
108};
109}
110
111
112#endif
Decodding of the ENSDF identification record properties.
Main class dedicated to ENSDF ascii files reading.
void print_datasets()
print the list of loaded data sets for the current nucleus and data type
virtual ~tkensdf_reader()=default
bool open_nuc(const tkstring &_nuc_name, const ensdf_data_type &_ftype=kensdf)
open the file for the slected nucleus and data type, and extract the available data sets
bool first_record(tkensdf_ident_rec *_dataset, tkstring &record)
move in the current file to the first record of the selected data set
tkensdf_reader(const tkstring &_input_folder)
void print_record_counters()
print record counters
bool next_record(tkensdf_ident_rec *_dataset, tkstring &record)
get the next record of the selected data set
void reset_record_counter()
reset the record counters
std::vector< tkensdf_ident_rec > * get_datasets()
get access to the identification records
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
Definition: tklog.cpp:39
ensdf_data_type
@ kensdf
@ kxundl