blob: ef9e6cdf940cbbc4d5bed540e5007e19fc595ec2 (
plain) (
blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#pragma once
#include <util/generic/string.h>
#include <util/string/builder.h>
#include <util/system/src_location.h>
#define LWTRACE_DEFINE_SYMBOL(variable, text) \
static TString variable##_holder(text); \
::NLWTrace::TSymbol variable(&variable##_holder); \
/**/
#define LWTRACE_INLINE_SYMBOL(text) \
[&] { \
static TString _holder(text); \
return ::NLWTrace::TSymbol(&_holder); \
}() /**/
#define LWTRACE_LOCATION_SYMBOL \
[](const char* func) { \
static TString _holder(TStringBuilder() << func << " (" << __LOCATION__ << ")"); \
return ::NLWTrace::TSymbol(&_holder); \
}(Y_FUNC_SIGNATURE) /**/
namespace NLWTrace {
struct TSymbol {
TString* Str;
TSymbol()
: Str(nullptr)
{
}
explicit TSymbol(TString* str)
: Str(str)
{
}
TSymbol& operator=(const TSymbol& o) {
Str = o.Str;
return *this;
}
TSymbol(const TSymbol& o)
: Str(o.Str)
{
}
bool operator<(const TSymbol& rhs) const {
return Str < rhs.Str;
}
bool operator>(const TSymbol& rhs) const {
return Str > rhs.Str;
}
bool operator<=(const TSymbol& rhs) const {
return Str <= rhs.Str;
}
bool operator>=(const TSymbol& rhs) const {
return Str >= rhs.Str;
}
bool operator==(const TSymbol& rhs) const {
return Str == rhs.Str;
}
bool operator!=(const TSymbol& rhs) const {
return Str != rhs.Str;
}
};
}
|