#pragma once #include "signature.h" #include #include #include #ifndef LWTRACE_DISABLE namespace NLWTrace { template <> struct TParamTraits { using TStoreType = double; using TFuncParam = TInstant; inline static void ToString(TStoreType value, TString* out) { *out = TParamConv::ToString(value); } inline static TStoreType ToStoreType(TInstant value) { if (value == TInstant::Max()) { return std::numeric_limits::infinity(); } else { return static_cast(value.MicroSeconds()) / 1000000.0; // seconds count } } }; template <> struct TParamTraits { using TStoreType = double; using TFuncParam = TDuration; inline static void ToString(TStoreType value, TString* out) { *out = TParamConv::ToString(value); } inline static TStoreType ToStoreType(TDuration value) { if (value == TDuration::Max()) { return std::numeric_limits::infinity(); } else { return static_cast(value.MicroSeconds()) / 1000.0; // milliseconds count } } }; // Param for enum with GENERATE_ENUM_SERIALIZATION enabled or operator<< implemented template struct TEnumParamWithSerialization { using TStoreType = typename TParamTraits>::TStoreType; using TFuncParam = TEnum; inline static void ToString(TStoreType stored, TString* out) { *out = TStringBuilder() << static_cast(stored) << " (" << stored << ")"; } inline static TStoreType ToStoreType(TFuncParam v) { return static_cast(v); } }; } // namespace NLWTrace #endif // LWTRACE_DISABLE