TkN
2.3
Toolkit for Nuclei
Loading...
Searching...
No Matches
tkproperty.cpp
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
#include "tkproperty.h"
38
39
namespace
tkn
{
63
}
64
65
using namespace
tkn
;
66
67
tkproperty::data_info
tkproperty::what_is
(
const
tkstring
&_st)
68
{
69
int
nb, nb_unkown, nb_theo_left, nb_theo_right, nb_tenta_left, nb_tenta_right, nb_about;
70
nb = 0;
71
72
// reads the string and counts the specfics characters
73
nb_unkown = _st.
count_string
(
"?"
); nb += nb_unkown;
74
nb_tenta_left = _st.
count_string
(
"("
); nb += nb_tenta_left;
75
nb_tenta_right = _st.
count_string
(
")"
); nb += nb_tenta_right;
76
nb_theo_left = _st.
count_string
(
"["
); nb += nb_theo_left;
77
nb_theo_right = _st.
count_string
(
"]"
); nb += nb_theo_right;
78
nb_about = _st.
count_string
(
"~"
); nb += nb_about;
79
80
// set the informations
81
if
( nb > 2 )
return
kUnknown
;
82
if
( nb == 0 )
return
kKnown
;
83
84
if
( nb == 1 ) {
85
if
( nb_about == 1 )
return
kAbout
;
86
return
kUnknown
;
87
}
88
if
( nb_tenta_left == 1 && nb_tenta_right == 1 )
return
kTentative
;
89
if
( nb_theo_left == 1 && nb_theo_right == 1 )
return
kTheo
;
90
return
kUnknown
;
91
}
92
93
tkstring
tkproperty::get_info_str
(
bool
_showknown)
const
94
{
95
tkstring
val;
96
if
(fInfo ==
kKnown
&& _showknown) val =
"known"
;
97
else
if
(fInfo ==
kUnknown
) val =
"unknown"
;
98
else
if
(fInfo ==
kTentative
) val =
"tentative"
;
99
else
if
(fInfo ==
kTheo
) val =
"calculated"
;
100
else
if
(fInfo ==
kAbout
) val =
"approximated value"
;
101
else
if
(fInfo ==
kSystematic
) val =
"from systematics"
;
102
else
if
(fInfo ==
kLimit
) val =
"limit value"
;
103
else
if
(fInfo ==
kUncertain
) val =
"no uncertainty"
;
104
else
if
(fInfo !=
kKnown
) val =
"undefined"
;
105
106
if
(fconverted_value) {
107
if
(val.
is_empty
()) val.
append
(
"converted"
);
108
else
val.
append
(
", converted"
);
109
}
110
111
return
val;
112
}
113
114
#ifdef HAS_ROOT
115
ClassImp(
tkproperty
);
116
#endif
tkn::tkproperty
Any property (data) with flags.
Definition
tkproperty.h:51
tkn::tkproperty::get_info_str
tkstring get_info_str(bool _showknown=true) const
to print in string the data_info
Definition
tkproperty.cpp:93
tkn::tkproperty::what_is
static data_info what_is(const tkstring &_st)
It deduces from a string the kind of data.
Definition
tkproperty.cpp:67
tkn::tkproperty::data_info
data_info
flags that qualify a given data
Definition
tkproperty.h:55
tkn::tkproperty::kKnown
@ kKnown
Definition
tkproperty.h:55
tkn::tkproperty::kUncertain
@ kUncertain
Definition
tkproperty.h:55
tkn::tkproperty::kAbout
@ kAbout
Definition
tkproperty.h:55
tkn::tkproperty::kTentative
@ kTentative
Definition
tkproperty.h:55
tkn::tkproperty::kUnknown
@ kUnknown
Definition
tkproperty.h:55
tkn::tkproperty::kTheo
@ kTheo
Definition
tkproperty.h:55
tkn::tkproperty::kLimit
@ kLimit
Definition
tkproperty.h:55
tkn::tkproperty::kSystematic
@ kSystematic
Definition
tkproperty.h:55
tkn::tkstring
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition
tkstring.h:54
tkn::tkstring::is_empty
bool is_empty() const
Definition
tkstring.h:163
tkn::tkstring::count_string
int count_string(const tkstring &_st) const
Definition
tkstring.cpp:547
tkn::tkstring::append
tkstring & append(const tkstring &_st)
Definition
tkstring.h:227
tkn
Definition
tklog.cpp:39
tkn.doxygen
src
physics
tkproperty.cpp
Generated by
1.13.2