THM1176InstrumentManager
1.0
Qt Object abstraction for Metrolab THM1176
Helpers.h
Go to the documentation of this file.
1
5
#pragma once
6
7
//---------------------------------------------------------------------------//
8
// Standard includes
9
//---------------------------------------------------------------------------//
10
#include <iostream>
// ostream
11
#include <sstream>
// std::cerr, std::cout, std::wcout
12
#include <cassert>
// assert
13
#include <thread>
// std::thread
14
#include <chrono>
// std::chrono
15
16
//---------------------------------------------------------------------------//
17
// String helpers
18
//---------------------------------------------------------------------------//
19
#define MTL__STR_HELPER__(x) #x
20
#define MTL__STR__(x) MTL__STR_HELPER__(x)
21
#define MTL__LOCATION_HELPER__ __FILE__ ":" MTL__STR__(__LINE__)
22
#define MTL__LOCATION__ (MTL__LOCATION_HELPER__)
23
24
//---------------------------------------------------------------------------//
25
// Output helpers
26
//---------------------------------------------------------------------------//
27
#ifndef MTL_MULTITHREAD_APPLICATION
28
#define CERR(__X__) std::cerr << __X__
29
#define COUT(__X__) std::cout << __X__
30
#define WCOUT(__X__) std::wcout << __X__
31
#else
32
// "Synchronized" output helpers : allow to define thread safe methods, redirection to files, etc... To be defined in user code
33
extern
inline
void
MTLLockOutputStream();
34
extern
inline
void
MTLUnlockOutputStream();
35
#define CERR(__X__) {MTLLockOutputStream(); std::cerr << __X__; MTLUnlockOutputStream();}
36
#define COUT(__X__) {MTLLockOutputStream(); std::cout << __X__; MTLUnlockOutputStream();}
37
#define WCOUT(__X__) {MTLLockOutputStream(); std::wcout << __X__; MTLUnlockOutputStream();}
38
#endif
39
40
//---------------------------------------------------------------------------//
41
// Other helpers
42
//---------------------------------------------------------------------------//
43
// Definitions
44
#define MTL_Assert assert
45
#define MTL_StaticAssert static_assert
46
#define MTL_SleepMs(_ms_) std::this_thread::sleep_for(std::chrono::milliseconds(_ms_))
47
#define MTL_Unused(x) (void)x;
Common
Utility
include
Helpers.h
Generated by
1.8.20