-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsolePrint.hpp
More file actions
50 lines (42 loc) · 1.11 KB
/
Copy pathConsolePrint.hpp
File metadata and controls
50 lines (42 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// ConsolePrint.hpp
#ifndef ConsolePrint_hpp
#define ConsolePrint_hpp
#include <string>
#include <boost/thread.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include "concurrent_queue.h"
#define PRINT ConsolePrint::Inst()->Print
#define PRINT_T ConsolePrint::Inst()->ThreadPrint
class ConsolePrint {
public:
static void Init(bool printToConsole);
static void Close();
static ConsolePrint* Inst();
void ThreadPrint(std::string message, bool overridePrint = false);
void Print(std::string message);
~ConsolePrint();
protected:
ConsolePrint(bool printToConsole);
ConsolePrint(ConsolePrint const&){};
private:
struct print_strct {
std::string message;
bool overridePrint;
};
bool printToConsole;
void Closer();
void thread_function();
boost::thread *print_thread;
static ConsolePrint *inst_pointer;
concurrent_queue<print_strct> print_queue;
};
//void PRINT(std::string message) {
// ConsolePrint::Inst()->Print(message);
//}
//
//void PRINT_T(std::string message, bool overridePrint = false) {
// ConsolePrint::Inst()->ThreadPrint(message, overridePrint);
//}
#endif /* ConsolePrint_hpp */