TkN 2.4
Toolkit for Nuclei
Loading...
Searching...
No Matches
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 * Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11 * SPDX-License-Identifier: MIT *
12 ********************************************************************************/
13
14#ifndef tkproperty_H
15#define tkproperty_H
16
17#include "tkn_config.h"
18
19#ifdef HAS_ROOT
20#include "TClass.h"
21#endif
22
23#include "tkstring.h"
24
25namespace tkn {
26
28{
29public:
30
33
34protected:
35 data_info fInfo = kUnknown; // set a flag to a given data
36 bool fconverted_value = false; // set to true if the value has been converted in TkN
37 tkstring fReference = ""; // reference of the given data
38
39public:
41 explicit tkproperty(tkproperty::data_info _info) { set_info(_info); }
42
43 virtual ~tkproperty() {}
44
46 static data_info what_is(const tkstring &_st);
47
49 void set_converted(bool _val=true) { fconverted_value = _val; }
50
52 bool is_converted() const { return fconverted_value;}
53
55 void set_info(tkproperty::data_info _info) { fInfo = _info; }
56
58 data_info get_info() { return fInfo; }
59 data_info get_info_const() const { return fInfo; }
60
62 tkstring get_info_str(bool _showknown=true) const;
63
65 bool is_info(data_info _info) const { return fInfo == _info ;}
66
68 bool is_known() const { return (fInfo == kKnown) ;}
69
71 void set_reference(const char *_st) { fReference = _st; }
72
74 tkstring get_reference() { return fReference; }
75
77 void clear() { fInfo = kUnknown; fconverted_value = false; fReference = "";}
78
79#ifdef HAS_ROOT
81 ClassDef(tkproperty,0);
82#endif
83
84};
85}
86
87#endif
Any property (data) with flags.
Definition tkproperty.h:28
tkproperty(tkproperty::data_info _info)
Definition tkproperty.h:41
bool is_converted() const
to know if the value has been converted
Definition tkproperty.h:52
void set_info(tkproperty::data_info _info)
to set some information about this data
Definition tkproperty.h:55
virtual ~tkproperty()
Definition tkproperty.h:43
void set_reference(const char *_st)
to set the reference of this data
Definition tkproperty.h:71
void set_converted(bool _val=true)
to define the value as a converted one
Definition tkproperty.h:49
data_info get_info_const() const
Definition tkproperty.h:59
tkstring get_info_str(bool _showknown=true) const
to print in string the data_info
static data_info what_is(const tkstring &_st)
It deduces from a string the kind of data.
data_info get_info()
to get information about this data
Definition tkproperty.h:58
bool is_known() const
to get some information about this data
Definition tkproperty.h:68
void clear()
clear the property
Definition tkproperty.h:77
data_info
flags that qualify a given data
Definition tkproperty.h:32
tkstring get_reference()
to get the reference of this data
Definition tkproperty.h:74
bool is_info(data_info _info) const
to get some information about this data
Definition tkproperty.h:65
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:31
Definition tklog.cpp:16