TkN 2.1
Toolkit for Nuclei
tkproperty.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 tkproperty_H
38#define tkproperty_H
39
40#include "tkn_config.h"
41
42#ifdef HAS_ROOT
43#include "TClass.h"
44#endif
45
46#include "tkstring.h"
47
48namespace tkn {
49
51{
52public:
53
56
57protected:
58 data_info fInfo = kUnknown; // set a flag to a given data
59 bool fconverted_value = false; // set to true if the value has been converted in TkN
60 tkstring fReference = ""; // reference of the given data
61
62public:
64 explicit tkproperty(tkproperty::data_info _info) { set_info(_info); }
65
66 virtual ~tkproperty() {}
67
69 static data_info what_is(const tkstring &_st);
70
72 void set_converted(bool _val=true) { fconverted_value = _val; }
73
75 bool is_converted() const { return fconverted_value;}
76
78 void set_info(tkproperty::data_info _info) { fInfo = _info; }
79
81 data_info get_info() { return fInfo; }
82 data_info get_info_const() const { return fInfo; }
83
85 tkstring get_info_str(bool _showknown=true) const;
86
88 bool is_info(data_info _info) const { return fInfo == _info ;}
89
91 bool is_known() const { return (fInfo == kKnown) ;}
92
94 void set_reference(const char *_st) { fReference = _st; }
95
97 tkstring get_reference() { return fReference; }
98
100 void clear() { fInfo = kUnknown; fconverted_value = false; fReference = "";}
101
102#ifdef HAS_ROOT
104 ClassDef(tkproperty,0);
105#endif
106
107};
108}
109
110#endif
Any property (data) with flags.
Definition: tkproperty.h:51
tkproperty(tkproperty::data_info _info)
Definition: tkproperty.h:64
bool is_converted() const
to know if the value has been converted
Definition: tkproperty.h:75
void set_info(tkproperty::data_info _info)
to set some information about this data
Definition: tkproperty.h:78
virtual ~tkproperty()
Definition: tkproperty.h:66
void set_reference(const char *_st)
to set the reference of this data
Definition: tkproperty.h:94
void set_converted(bool _val=true)
to define the value as a converted one
Definition: tkproperty.h:72
data_info get_info_const() const
Definition: tkproperty.h:82
tkstring get_info_str(bool _showknown=true) const
to print in string the data_info
Definition: tkproperty.cpp:93
static data_info what_is(const tkstring &_st)
It deduces from a string the kind of data.
Definition: tkproperty.cpp:67
data_info get_info()
to get information about this data
Definition: tkproperty.h:81
bool is_known() const
to get some information about this data
Definition: tkproperty.h:91
void clear()
clear the property
Definition: tkproperty.h:100
data_info
flags that qualify a given data
Definition: tkproperty.h:55
tkstring get_reference()
to get the reference of this data
Definition: tkproperty.h:97
bool is_info(data_info _info) const
to get some information about this data
Definition: tkproperty.h:88
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
Definition: tklog.cpp:39