WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
console_globals.h
Go to the documentation of this file.
1 #pragma once
2 //
3 // Copyright(c) 2018 Gabi Melman.
4 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
5 //
6 
8 #include <cstdio>
9 #include <mutex>
10 
11 #ifdef _WIN32
12 
13 #ifndef NOMINMAX
14 #define NOMINMAX // prevent windows redefining min/max
15 #endif
16 
17 #ifndef WIN32_LEAN_AND_MEAN
18 #define WIN32_LEAN_AND_MEAN
19 #endif
20 
21 #include <windows.h>
22 #endif
23 
24 namespace spdlog {
25 namespace details {
27 {
28  static std::FILE *stream()
29  {
30  return stdout;
31  }
32 #ifdef _WIN32
33  static HANDLE handle()
34  {
35  return ::GetStdHandle(STD_OUTPUT_HANDLE);
36  }
37 #endif
38 };
39 
41 {
42  static std::FILE *stream()
43  {
44  return stderr;
45  }
46 #ifdef _WIN32
47  static HANDLE handle()
48  {
49  return ::GetStdHandle(STD_ERROR_HANDLE);
50  }
51 #endif
52 };
53 
55 {
56  using mutex_t = std::mutex;
57  static mutex_t &mutex()
58  {
59  static mutex_t s_mutex;
60  return s_mutex;
61  }
62 };
63 
65 {
67  static mutex_t &mutex()
68  {
69  static mutex_t s_mutex;
70  return s_mutex;
71  }
72 };
73 } // namespace details
74 } // namespace spdlog
Definition: async.h:27