LHAPDF  6.5.5
Config.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2024 The LHAPDF collaboration (see AUTHORS for details)
5 //
6 #pragma once
7 #ifndef LHAPDF_Config_H
8 #define LHAPDF_Config_H
9 
10 #include "LHAPDF/Info.h"
11 
12 namespace LHAPDF {
13 
14 
15  /// Class for PDF set metadata and manipulation
16  class Config : public Info {
17  public:
18 
19  /// @name Fetching/creation
20  /// @{
21 
22  /// Get the global configuration object
23  ///
24  /// The global config is populated by reading from lhapdf.conf if it is
25  /// found in the search paths. It is a singleton, hence the 'get' accessor
26  /// rather than a constructor.
27  ///
28  /// @note The LHAPDF system is responsible for deletion of the returned
29  /// object. Do NOT delete it yourself!
30  static Config& get();
31  /// @}
32 
33 
34  /// Config destructor, used for end-of-run banner printing
35  ~Config();
36 
37 
38  private:
39 
40  /// Hide the default constructor
41  Config() {
42  // std::cout << "CONFIG CONSTRUCTION" << std::endl;
43  }
44 
45  };
46 
47 
48  /// @defgroup verb Verbosity control
49  /// @{
50 
51  /// Convenient way to get the current verbosity level
52  ///
53  /// Levels: 0=silent, 1=standard, 2=debug
54  ///
55  /// @note Verbosity is actually managed via the Info class hierarchy and can also be obtained from there.
56  inline int verbosity() {
57  return Config::get().get_entry_as<int>("Verbosity", 1);
58  }
59 
60  /// Convenient way to set the verbosity level
61  ///
62  /// Levels: 0=silent, 1=standard, 2=debug
63  ///
64  /// @note Verbosity is actually managed via the Info class hierarchy and can also be set there.
65  inline void setVerbosity(int v) {
66  Config::get().set_entry("Verbosity", v);
67  }
68 
69  /// @}
70 
71 
72 }
73 #endif