diff options
author | vvvv <vvvv@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
commit | ad94e93a059747f4fc3d7add88d1a83daf40b733 (patch) | |
tree | 731d57e580bd143e1136e7747f13b26e6bac95d0 /library/cpp/actors/util | |
parent | 298c6da79f1d8f35089a67f463f0b541bec36d9b (diff) | |
download | ydb-ad94e93a059747f4fc3d7add88d1a83daf40b733.tar.gz |
Restoring authorship annotation for <vvvv@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/actors/util')
-rw-r--r-- | library/cpp/actors/util/local_process_key.h | 112 | ||||
-rw-r--r-- | library/cpp/actors/util/threadparkpad.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/util/ya.make | 2 |
3 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/actors/util/local_process_key.h b/library/cpp/actors/util/local_process_key.h index 172f08fc73..29a81968a8 100644 --- a/library/cpp/actors/util/local_process_key.h +++ b/library/cpp/actors/util/local_process_key.h @@ -1,30 +1,30 @@ -#pragma once - +#pragma once + #include <util/string/builder.h> -#include <util/generic/strbuf.h> -#include <util/generic/vector.h> -#include <util/generic/hash.h> -#include <util/generic/singleton.h> +#include <util/generic/strbuf.h> +#include <util/generic/vector.h> +#include <util/generic/hash.h> +#include <util/generic/singleton.h> #include <util/generic/serialized_enum.h> - -template <typename T> -class TLocalProcessKeyState { - -template <typename U, const char* Name> -friend class TLocalProcessKey; + +template <typename T> +class TLocalProcessKeyState { + +template <typename U, const char* Name> +friend class TLocalProcessKey; template <typename U, typename EnumT> friend class TEnumProcessKey; - -public: - static TLocalProcessKeyState& GetInstance() { - return *Singleton<TLocalProcessKeyState<T>>(); - } - - size_t GetCount() const { + +public: + static TLocalProcessKeyState& GetInstance() { + return *Singleton<TLocalProcessKeyState<T>>(); + } + + size_t GetCount() const { return StartIndex + Names.size(); - } - - TStringBuf GetNameByIndex(size_t index) const { + } + + TStringBuf GetNameByIndex(size_t index) const { if (index < StartIndex) { return StaticNames[index]; } else { @@ -32,24 +32,24 @@ public: Y_ENSURE(index < Names.size()); return Names[index]; } - } - - size_t GetIndexByName(TStringBuf name) const { - auto it = Map.find(name); - Y_ENSURE(it != Map.end()); - return it->second; - } - -private: - size_t Register(TStringBuf name) { + } + + size_t GetIndexByName(TStringBuf name) const { + auto it = Map.find(name); + Y_ENSURE(it != Map.end()); + return it->second; + } + +private: + size_t Register(TStringBuf name) { auto x = Map.emplace(name, Names.size()+StartIndex); - if (x.second) { - Names.emplace_back(name); - } - - return x.first->second; - } - + if (x.second) { + Names.emplace_back(name); + } + + return x.first->second; + } + size_t Register(TStringBuf name, ui32 index) { Y_VERIFY(index < StartIndex); auto x = Map.emplace(name, index); @@ -58,7 +58,7 @@ private: return x.first->second; } -private: +private: static constexpr ui32 StartIndex = 2000; TVector<TString> FillStaticNames() { @@ -73,22 +73,22 @@ private: TVector<TString> StaticNames = FillStaticNames(); TVector<TString> Names; THashMap<TString, size_t> Map; -}; - -template <typename T, const char* Name> -class TLocalProcessKey { -public: - static TStringBuf GetName() { - return Name; - } - - static size_t GetIndex() { - return Index; - } - -private: - inline static size_t Index = TLocalProcessKeyState<T>::GetInstance().Register(Name); -}; +}; + +template <typename T, const char* Name> +class TLocalProcessKey { +public: + static TStringBuf GetName() { + return Name; + } + + static size_t GetIndex() { + return Index; + } + +private: + inline static size_t Index = TLocalProcessKeyState<T>::GetInstance().Register(Name); +}; template <typename T, typename EnumT> class TEnumProcessKey { diff --git a/library/cpp/actors/util/threadparkpad.cpp b/library/cpp/actors/util/threadparkpad.cpp index 74069ff15b..ff1cd248d3 100644 --- a/library/cpp/actors/util/threadparkpad.cpp +++ b/library/cpp/actors/util/threadparkpad.cpp @@ -43,7 +43,7 @@ namespace NActors { }; #elif defined _win32_ -#include <util/generic/bt_exception.h> +#include <util/generic/bt_exception.h> #include <util/generic/yexception.h> namespace NActors { diff --git a/library/cpp/actors/util/ya.make b/library/cpp/actors/util/ya.make index 37488c3962..b3aeabf6b6 100644 --- a/library/cpp/actors/util/ya.make +++ b/library/cpp/actors/util/ya.make @@ -14,7 +14,7 @@ SRCS( funnel_queue.h futex.h intrinsics.h - local_process_key.h + local_process_key.h named_tuple.h queue_chunk.h queue_oneone_inplace.h |