gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
logger.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
27 
28 #include "gambit/Logs/logger.hpp" // Forward declaration of retriever function 'logger()' and helper functions
29 #include "gambit/Logs/logmaster.hpp" // Full declaration of LogMaster class
30 #include "gambit/Logs/logging.hpp"
31 
32 namespace Gambit
33 {
34  namespace Logging
35  {
36  // This is an empty struct that I use simple to ensure that the logger LogTag "catalogues" are constructed before the logger itself. This ensures that they are destructed *after* the logger, which is important because we need them to exist during destruction of the logger.
37  struct ensure_construction_order
38  {
39  ensure_construction_order()
40  {
41  // call the functions which retrieve the catalogues/maps, thus ensuring those objects are constructed.
42  msgtypes();
43  flags();
44  components();
45  tag2str();
46  }
47  };
48 
50 
52  LogMaster& operator<<(LogMaster& logobj, const std::string& in)
53  {
54  logobj.input(in);
55  return logobj;
56  }
57 
59  LogMaster& operator<<(LogMaster& logobj, const LogTag& tag)
60  {
61  logobj.input(tag);
62  return logobj;
63  }
64 
67  {
68  logobj.input(eom);
69  return logobj;
70  }
71 
73  LogMaster& operator<<(LogMaster& logobj, const manip1 fp)
74  {
75  logobj.input(fp);
76  return logobj;
77  }
78 
79  LogMaster& operator<<(LogMaster& logobj, const manip2 fp)
80  {
81  logobj.input(fp);
82  return logobj;
83  }
84 
85  LogMaster& operator<<(LogMaster& logobj, const manip3 fp)
86  {
87  logobj.input(fp);
88  return logobj;
89  }
90 
92  }
93 
94  // Log retriever function
96  {
97  // I assume that these being static, the constructor for x will only get called once.
98  // With the LogMaster constructed last out of these object, it should be destructed first, thus the other objects should be available for use in the LogMaster destructor.
99  static Logging::ensure_construction_order x;
100  static Logging::LogMaster global_log;
101  return global_log;
102  }
103 
104 } // end namespace Gambit
std::map< int, std::string > & tag2str()
Definition: logging.cpp:130
Header for logging classes.
EXPORT_SYMBOLS LogMaster & operator<<(LogMaster &, const std::string &)
Stream functions for use with LogMaster.
Definition: logger.cpp:52
Logging access header for GAMBIT.
std::set< int > & components()
Definition: logging.cpp:81
std::ostream &(* manip1)(std::ostream &)
Definition: logger.hpp:57
EXPORT_SYMBOLS Logging::LogMaster & logger()
Function to retrieve a reference to the Gambit global log object.
Definition: logger.cpp:95
const std::set< LogTag > & flags()
Definition: logging.cpp:65
Logging "controller" object Keeps track of the various "Logger" objects.
Definition: logmaster.hpp:49
Header for logging classes.
Special (empty) struct for signalling end of message to LogMaster stream.
Definition: logger.hpp:44
void input(const std::string &)
Functions for stream input (actual stream operators which use these are defined in logger...
Definition: logmaster.cpp:671
TODO: see if we can use this one:
Definition: Analysis.hpp:33
const std::set< LogTag > & msgtypes()
Definition: logging.cpp:57
std::ios_base &(* manip3)(std::ios_base &)
Definition: logger.hpp:60
ios_type &(* manip2)(ios_type &)
Definition: logger.hpp:59