aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/param_traits.h
diff options
context:
space:
mode:
authorVasily Gerasimov <UgnineSirdis@gmail.com>2022-02-10 16:49:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:10 +0300
commit1eb755fbca92172a6aec2f57371b2b3a19dfab43 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/lwtrace/param_traits.h
parent6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (diff)
downloadydb-1eb755fbca92172a6aec2f57371b2b3a19dfab43.tar.gz
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/param_traits.h')
-rw-r--r--library/cpp/lwtrace/param_traits.h132
1 files changed, 66 insertions, 66 deletions
diff --git a/library/cpp/lwtrace/param_traits.h b/library/cpp/lwtrace/param_traits.h
index 8ff87efd0b..a0faeb50db 100644
--- a/library/cpp/lwtrace/param_traits.h
+++ b/library/cpp/lwtrace/param_traits.h
@@ -1,66 +1,66 @@
-#pragma once
-#include "signature.h"
-
-#include <util/datetime/base.h>
-#include <util/string/builder.h>
-
-#include <limits>
-
-#ifndef LWTRACE_DISABLE
-
-namespace NLWTrace {
-
- template <>
- struct TParamTraits<TInstant> {
- using TStoreType = double;
- using TFuncParam = TInstant;
-
- inline static void ToString(TStoreType value, TString* out) {
- *out = TParamConv<TStoreType>::ToString(value);
- }
-
- inline static TStoreType ToStoreType(TInstant value) {
- if (value == TInstant::Max()) {
- return std::numeric_limits<TStoreType>::infinity();
- } else {
- return static_cast<TStoreType>(value.MicroSeconds()) / 1000000.0; // seconds count
- }
- }
- };
-
- template <>
- struct TParamTraits<TDuration> {
- using TStoreType = double;
- using TFuncParam = TDuration;
-
- inline static void ToString(TStoreType value, TString* out) {
- *out = TParamConv<TStoreType>::ToString(value);
- }
-
- inline static TStoreType ToStoreType(TDuration value) {
- if (value == TDuration::Max()) {
- return std::numeric_limits<TStoreType>::infinity();
- } else {
- return static_cast<TStoreType>(value.MicroSeconds()) / 1000.0; // milliseconds count
- }
- }
- };
-
- // Param for enum with GENERATE_ENUM_SERIALIZATION enabled or operator<< implemented
- template <class TEnum>
- struct TEnumParamWithSerialization {
- using TStoreType = typename TParamTraits<std::underlying_type_t<TEnum>>::TStoreType;
- using TFuncParam = TEnum;
-
- inline static void ToString(TStoreType stored, TString* out) {
- *out = TStringBuilder() << static_cast<TEnum>(stored) << " (" << stored << ")";
- }
-
- inline static TStoreType ToStoreType(TFuncParam v) {
- return static_cast<TStoreType>(v);
- }
- };
-
-} // namespace NLWTrace
-
-#endif // LWTRACE_DISABLE
+#pragma once
+#include "signature.h"
+
+#include <util/datetime/base.h>
+#include <util/string/builder.h>
+
+#include <limits>
+
+#ifndef LWTRACE_DISABLE
+
+namespace NLWTrace {
+
+ template <>
+ struct TParamTraits<TInstant> {
+ using TStoreType = double;
+ using TFuncParam = TInstant;
+
+ inline static void ToString(TStoreType value, TString* out) {
+ *out = TParamConv<TStoreType>::ToString(value);
+ }
+
+ inline static TStoreType ToStoreType(TInstant value) {
+ if (value == TInstant::Max()) {
+ return std::numeric_limits<TStoreType>::infinity();
+ } else {
+ return static_cast<TStoreType>(value.MicroSeconds()) / 1000000.0; // seconds count
+ }
+ }
+ };
+
+ template <>
+ struct TParamTraits<TDuration> {
+ using TStoreType = double;
+ using TFuncParam = TDuration;
+
+ inline static void ToString(TStoreType value, TString* out) {
+ *out = TParamConv<TStoreType>::ToString(value);
+ }
+
+ inline static TStoreType ToStoreType(TDuration value) {
+ if (value == TDuration::Max()) {
+ return std::numeric_limits<TStoreType>::infinity();
+ } else {
+ return static_cast<TStoreType>(value.MicroSeconds()) / 1000.0; // milliseconds count
+ }
+ }
+ };
+
+ // Param for enum with GENERATE_ENUM_SERIALIZATION enabled or operator<< implemented
+ template <class TEnum>
+ struct TEnumParamWithSerialization {
+ using TStoreType = typename TParamTraits<std::underlying_type_t<TEnum>>::TStoreType;
+ using TFuncParam = TEnum;
+
+ inline static void ToString(TStoreType stored, TString* out) {
+ *out = TStringBuilder() << static_cast<TEnum>(stored) << " (" << stored << ")";
+ }
+
+ inline static TStoreType ToStoreType(TFuncParam v) {
+ return static_cast<TStoreType>(v);
+ }
+ };
+
+} // namespace NLWTrace
+
+#endif // LWTRACE_DISABLE