1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #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;
- }
- };
- }
|