base_sink.h
Go to the documentation of this file.
1 //
2 // Copyright(c) 2015 Gabi Melman.
3 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
4 //
5 
6 #pragma once
7 //
8 // base sink templated over a mutex (either dummy or real)
9 // concrete implementation should only override the _sink_it method.
10 // all locking is taken care of here so no locking needed by the implementers..
11 //
12 
13 #include "opc/spdlog/sinks/sink.h"
14 #include "opc/spdlog/formatter.h"
15 #include "opc/spdlog/common.h"
17 
18 #include <mutex>
19 
20 namespace spdlog
21 {
22 namespace sinks
23 {
24 template<class Mutex>
25 class base_sink:public sink
26 {
27 public:
29  virtual ~base_sink() = default;
30 
31  base_sink(const base_sink&) = delete;
32  base_sink& operator=(const base_sink&) = delete;
33 
34  void log(const details::log_msg& msg) SPDLOG_FINAL override
35  {
36  std::lock_guard<Mutex> lock(_mutex);
37  _sink_it(msg);
38  }
39  void flush() SPDLOG_FINAL override
40  {
41  _flush();
42  }
43 
44 protected:
45  virtual void _sink_it(const details::log_msg& msg) = 0;
46  virtual void _flush() = 0;
47  Mutex _mutex;
48 };
49 }
50 }
virtual void _flush()=0
virtual ~base_sink()=default
void log(const details::log_msg &msg) SPDLOG_FINAL override
Definition: base_sink.h:34
base_sink & operator=(const base_sink &)=delete
void flush() SPDLOG_FINAL override
Definition: base_sink.h:39
virtual void _sink_it(const details::log_msg &msg)=0


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:06:03