TkN
2.4
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
* Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11
* SPDX-License-Identifier: MIT *
12
********************************************************************************/
13
14
#include "tkproperty.h"
15
16
namespace
tkn
{
40
}
41
42
using namespace
tkn
;
43
44
tkproperty::data_info
tkproperty::what_is
(
const
tkstring
&_st)
45
{
46
int
nb, nb_unkown, nb_theo_left, nb_theo_right, nb_tenta_left, nb_tenta_right, nb_about;
47
nb = 0;
48
49
// reads the string and counts the specfics characters
50
nb_unkown = _st.
count_string
(
"?"
); nb += nb_unkown;
51
nb_tenta_left = _st.
count_string
(
"("
); nb += nb_tenta_left;
52
nb_tenta_right = _st.
count_string
(
")"
); nb += nb_tenta_right;
53
nb_theo_left = _st.
count_string
(
"["
); nb += nb_theo_left;
54
nb_theo_right = _st.
count_string
(
"]"
); nb += nb_theo_right;
55
nb_about = _st.
count_string
(
"~"
); nb += nb_about;
56
57
// set the informations
58
if
( nb > 2 )
return
kUnknown
;
59
if
( nb == 0 )
return
kKnown
;
60
61
if
( nb == 1 ) {
62
if
( nb_about == 1 )
return
kAbout
;
63
return
kUnknown
;
64
}
65
if
( nb_tenta_left == 1 && nb_tenta_right == 1 )
return
kTentative
;
66
if
( nb_theo_left == 1 && nb_theo_right == 1 )
return
kTheo
;
67
return
kUnknown
;
68
}
69
70
tkstring
tkproperty::get_info_str
(
bool
_showknown)
const
71
{
72
tkstring
val;
73
if
(fInfo ==
kKnown
&& _showknown) val =
"known"
;
74
else
if
(fInfo ==
kUnknown
) val =
"unknown"
;
75
else
if
(fInfo ==
kTentative
) val =
"tentative"
;
76
else
if
(fInfo ==
kTheo
) val =
"calculated"
;
77
else
if
(fInfo ==
kAbout
) val =
"approximated value"
;
78
else
if
(fInfo ==
kSystematic
) val =
"from systematics"
;
79
else
if
(fInfo ==
kLimit
) val =
"limit value"
;
80
else
if
(fInfo ==
kUncertain
) val =
"no uncertainty"
;
81
else
if
(fInfo !=
kKnown
) val =
"undefined"
;
82
83
if
(fconverted_value) {
84
if
(val.
is_empty
()) val.
append
(
"converted"
);
85
else
val.
append
(
", converted"
);
86
}
87
88
return
val;
89
}
90
91
#ifdef HAS_ROOT
92
ClassImp(
tkproperty
);
93
#endif
tkn::tkproperty
Any property (data) with flags.
Definition
tkproperty.h:28
tkn::tkproperty::get_info_str
tkstring get_info_str(bool _showknown=true) const
to print in string the data_info
Definition
tkproperty.cpp:70
tkn::tkproperty::what_is
static data_info what_is(const tkstring &_st)
It deduces from a string the kind of data.
Definition
tkproperty.cpp:44
tkn::tkproperty::data_info
data_info
flags that qualify a given data
Definition
tkproperty.h:32
tkn::tkproperty::kKnown
@ kKnown
Definition
tkproperty.h:32
tkn::tkproperty::kUncertain
@ kUncertain
Definition
tkproperty.h:32
tkn::tkproperty::kAbout
@ kAbout
Definition
tkproperty.h:32
tkn::tkproperty::kTentative
@ kTentative
Definition
tkproperty.h:32
tkn::tkproperty::kUnknown
@ kUnknown
Definition
tkproperty.h:32
tkn::tkproperty::kTheo
@ kTheo
Definition
tkproperty.h:32
tkn::tkproperty::kLimit
@ kLimit
Definition
tkproperty.h:32
tkn::tkproperty::kSystematic
@ kSystematic
Definition
tkproperty.h:32
tkn::tkstring
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition
tkstring.h:31
tkn::tkstring::is_empty
bool is_empty() const
Definition
tkstring.h:140
tkn::tkstring::count_string
int count_string(const tkstring &_st) const
Definition
tkstring.cpp:524
tkn::tkstring::append
tkstring & append(const tkstring &_st)
Definition
tkstring.h:204
tkn
Definition
tklog.cpp:16
tkn.doxygen
src
physics
tkproperty.cpp
Generated by
1.13.2