Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
console.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_core/target_posix_pc/roc_core/console.h
10 //! @brief Console.
11 
12 #ifndef ROC_CORE_CONSOLE_H_
13 #define ROC_CORE_CONSOLE_H_
14 
15 #include "roc_core/attributes.h"
16 #include "roc_core/mutex.h"
17 #include "roc_core/noncopyable.h"
18 #include "roc_core/singleton.h"
19 
20 namespace roc {
21 namespace core {
22 
23 //! Color ID.
24 enum Color {
25  Color_None,
26  Color_White,
27  Color_Gray,
28  Color_Red,
29  Color_Green,
30  Color_Yellow,
31  Color_Blue,
32  Color_Magenta,
33  Color_Cyan
34 };
35 
36 //! Console.
37 class Console : public NonCopyable<> {
38 public:
39  //! Get logger instance.
40  static Console& instance() {
42  }
43 
44  //! Check if colors can be used.
46 
47  //! Print line.
48  ROC_ATTR_PRINTF(3, 4) void println(Color color, const char* format, ...);
49 
50 private:
51  friend class Singleton<Console>;
52 
53  Console();
54 
55  const bool colors_supported_;
56  Mutex mutex_;
57 };
58 
59 } // namespace core
60 } // namespace roc
61 
62 #endif // ROC_CORE_CONSOLE_H_
Compiler attributes.
#define ROC_ATTR_PRINTF(fmt_pos, args_pos)
Function gets printf-like arguments.
Definition: attributes.h:35
Console.
Definition: console.h:28
static Console & instance()
Get logger instance.
Definition: console.h:40
void println(Color color, const char *format,...)
Print line.
bool colors_supported()
Check if colors can be used.
Mutex.
Definition: mutex.h:31
static T & instance()
Get singleton instance.
Definition: singleton.h:29
Mutex.
Color
Color ID.
Definition: console.h:23
Root namespace.
Non-copyable object.
Singleton.