TimeSource.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Logger_TimeSource_
18 #define HH_SENF_Utils_Logger_TimeSource_ 1
19 
20 // Custom includes
21 #include <memory>
22 #include <senf/Utils/Cpp11Support/smart_ptr.hh>
23 #include <senf/config.hh>
24 
25 //#include "TimeSource.mpp"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 namespace log {
30 
32 
43  struct TimeSource
44  {
45  virtual ~TimeSource();
46  virtual time_type operator()() const = 0;
47 
48  static time_type now();
49  };
50 
58  struct SystemTimeSource : public TimeSource
59  {
60  virtual time_type operator()() const;
61  };
62 
73  void timeSource(std::unique_ptr<TimeSource> source);
74 
82  template <class Source> void timeSource();
83 
84 }}
85 
86 //-/////////////////////////////////////////////////////////////////////////////////////////////////
87 #include "TimeSource.cci"
88 //#include "TimeSource.ct"
89 #include "TimeSource.cti"
90 #endif
91 
92 
93 // Local Variables:
94 // mode: c++
95 // fill-column: 100
96 // comment-column: 40
97 // c-file-style: "senf"
98 // indent-tabs-mode: nil
99 // ispell-local-dictionary: "american"
100 // compile-command: "scons -u test"
101 // End:
virtual time_type operator()() const =0
static time_type now()
void timeSource(std::unique_ptr< TimeSource > source)
Change log message time source.
Log message time source abstract base class.
Definition: TimeSource.hh:43
Default log message time source.
Definition: TimeSource.hh:58
config::time_type time_type
Definition: TimeSource.hh:31