Line data Source code
1 : /*
2 : * Configuration.cxx
3 : * ERS
4 : *
5 : * Created by Serguei Kolos on 21.01.05.
6 : * Copyright 2005 CERN. All rights reserved.
7 : *
8 : */
9 : #include <cstdio>
10 : #include <iostream>
11 :
12 : #include <ers/Configuration.hpp>
13 : #include <ers/ers.hpp>
14 : #include <ers/internal/SingletonCreator.hpp>
15 : #include <ers/internal/Util.hpp>
16 :
17 : /** This method returns the singleton instance.
18 : * It should be used for every operation on the factory.
19 : * \return a reference to the singleton instance
20 : */
21 : ers::Configuration &
22 7709 : ers::Configuration::instance()
23 : {
24 : /**Singleton instance
25 : */
26 7709 : static ers::Configuration * instance = ers::SingletonCreator<ers::Configuration>::create();
27 :
28 7709 : return *instance;
29 : }
30 :
31 : /** Private constructor - can not be called by user code, use the \c instance() method instead
32 : * \see instance()
33 : */
34 44 : ers::Configuration::Configuration()
35 44 : : m_debug_level( 0 ),
36 44 : m_verbosity_level( 0 )
37 : {
38 44 : m_debug_level = read_from_environment( "DUNEDAQ_ERS_DEBUG_LEVEL", m_debug_level );
39 44 : m_verbosity_level = read_from_environment( "DUNEDAQ_ERS_VERBOSITY_LEVEL", m_verbosity_level );
40 44 : }
41 :
42 : void
43 0 : ers::Configuration::verbosity_level( int verbosity_level )
44 : {
45 0 : m_verbosity_level = verbosity_level;
46 0 : }
47 :
48 : std::ostream &
49 0 : ers::operator<<( std::ostream & out, const ers::Configuration & conf )
50 : {
51 0 : out << "debug level = " << conf.m_debug_level << " verbosity level = " << conf.m_verbosity_level;
52 0 : return out;
53 : }
|