Iguana
1.2.1
Implementation Guardian of Analysis Algorithms
Toggle main menu visibility
Loading...
Searching...
No Matches
GlobalParam.h
1
#pragma once
2
3
#include <mutex>
4
#include <string>
5
6
#include "Object.h"
7
8
namespace
iguana {
9
19
template
<
typename
T>
20
class
GlobalParam
:
public
Object
21
{
22
23
public
:
24
26
GlobalParam
(T val)
27
:
Object
(
"IGUANA"
)
28
, m_val(val)
29
{}
30
35
GlobalParam<T>
&
operator=
(T
const
& val)
36
{
37
std::lock_guard<std::mutex> lock(m_mutex);
38
std::call_once(m_once, [&]() { m_val = val; });
39
return
*
this
;
40
}
41
44
T
const
operator()
()
45
{
46
std::lock_guard<std::mutex> lock(m_mutex);
47
return
m_val;
48
}
49
50
private
:
51
52
T m_val;
53
std::once_flag m_once;
54
std::mutex m_mutex;
55
};
56
57
// ==================================================================================
58
// IGUANA GLOBAL PARAMETERS (see source file 'GlobalParam.cc' for their default values)
59
// ==================================================================================
60
68
extern
GlobalParam<std::string> GlobalConcurrencyModel;
69
72
extern
GlobalParam<std::string> GlobalRcdbUrl;
73
74
}
iguana::GlobalParam::operator()
T const operator()()
get the value of the parameter
Definition
GlobalParam.h:44
iguana::GlobalParam::operator=
GlobalParam< T > & operator=(T const &val)
assign a new value to this parameter
Definition
GlobalParam.h:35
iguana::GlobalParam::GlobalParam
GlobalParam(T val)
Definition
GlobalParam.h:26
iguana::Object::Object
Object(std::string_view name="", Logger::Level lev=Logger::DEFAULT_LEVEL)
iguana_v1.2.1
src
iguana
services
GlobalParam.h
Generated by
1.18.0