diff options
author | savrus <savrus@yandex-team.ru> | 2022-02-10 16:50:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:48 +0300 |
commit | 2ee4b26133812e990e7958fc1863d8d5f8ee7f7b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/misc | |
parent | 2056f5ae3bf6e5a65e9885e0add085c708cca5b8 (diff) | |
download | ydb-2ee4b26133812e990e7958fc1863d8d5f8ee7f7b.tar.gz |
Restoring authorship annotation for <savrus@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/misc')
-rw-r--r-- | library/cpp/yt/misc/property.h | 114 | ||||
-rw-r--r-- | library/cpp/yt/misc/variant.h | 2 |
2 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/yt/misc/property.h b/library/cpp/yt/misc/property.h index 898ee47162b..bef8024ae15 100644 --- a/library/cpp/yt/misc/property.h +++ b/library/cpp/yt/misc/property.h @@ -209,26 +209,26 @@ public: \ } //////////////////////////////////////////////////////////////////////////////// - + //! Below are macro helpers for extra properties. -//! Extra properties should be used for lazy memory allocation for properties that -//! hold default values for the majority of objects. - +//! Extra properties should be used for lazy memory allocation for properties that +//! hold default values for the majority of objects. + //! Initializes extra property holder if it is not initialized. #define INITIALIZE_EXTRA_PROPERTY_HOLDER(holder) \ if (!holder##_) { \ holder##_.reset(new decltype(holder##_)::element_type()); \ } -//! Declares an extra property holder. Holder contains extra properties values. -//! Holder is not created until some property is set with a non-default value. -//! If there is no holder property getter returns default value. -#define DECLARE_EXTRA_PROPERTY_HOLDER(type, holder) \ -public: \ - Y_FORCE_INLINE bool HasCustom##holder() const \ - { \ - return static_cast<bool>(holder##_); \ - } \ +//! Declares an extra property holder. Holder contains extra properties values. +//! Holder is not created until some property is set with a non-default value. +//! If there is no holder property getter returns default value. +#define DECLARE_EXTRA_PROPERTY_HOLDER(type, holder) \ +public: \ + Y_FORCE_INLINE bool HasCustom##holder() const \ + { \ + return static_cast<bool>(holder##_); \ + } \ Y_FORCE_INLINE const type* GetCustom##holder() const \ { \ return holder##_.get(); \ @@ -241,49 +241,49 @@ public: \ { \ INITIALIZE_EXTRA_PROPERTY_HOLDER(holder) \ } \ -private: \ - std::unique_ptr<type> holder##_; \ - static const type Default##holder##_; - -//! Defines a storage for extra properties default values. -#define DEFINE_EXTRA_PROPERTY_HOLDER(class, type, holder) \ - const type class::Default##holder##_; - -//! Defines a public read-write extra property that is passed by value. -#define DEFINE_BYVAL_RW_EXTRA_PROPERTY(holder, name) \ -public: \ - Y_FORCE_INLINE decltype(holder##_->name) Get##name() const \ - { \ - if (!holder##_) { \ - return Default##holder##_.name; \ - } \ - return holder##_->name; \ - } \ - Y_FORCE_INLINE void Set##name(decltype(holder##_->name) val) \ - { \ - if (!holder##_) { \ - if (val == Default##holder##_.name) { \ - return; \ - } \ +private: \ + std::unique_ptr<type> holder##_; \ + static const type Default##holder##_; + +//! Defines a storage for extra properties default values. +#define DEFINE_EXTRA_PROPERTY_HOLDER(class, type, holder) \ + const type class::Default##holder##_; + +//! Defines a public read-write extra property that is passed by value. +#define DEFINE_BYVAL_RW_EXTRA_PROPERTY(holder, name) \ +public: \ + Y_FORCE_INLINE decltype(holder##_->name) Get##name() const \ + { \ + if (!holder##_) { \ + return Default##holder##_.name; \ + } \ + return holder##_->name; \ + } \ + Y_FORCE_INLINE void Set##name(decltype(holder##_->name) val) \ + { \ + if (!holder##_) { \ + if (val == Default##holder##_.name) { \ + return; \ + } \ INITIALIZE_EXTRA_PROPERTY_HOLDER(holder); \ - } \ - holder##_->name = val; \ - } - -//! Defines a public read-write extra property that is passed by reference. -#define DEFINE_BYREF_RW_EXTRA_PROPERTY(holder, name) \ -public: \ - Y_FORCE_INLINE const decltype(holder##_->name)& name() const \ - { \ - if (!holder##_) { \ - return Default##holder##_.name; \ - } \ - return holder##_->name; \ - } \ - Y_FORCE_INLINE decltype(holder##_->name)& Mutable##name() \ - { \ + } \ + holder##_->name = val; \ + } + +//! Defines a public read-write extra property that is passed by reference. +#define DEFINE_BYREF_RW_EXTRA_PROPERTY(holder, name) \ +public: \ + Y_FORCE_INLINE const decltype(holder##_->name)& name() const \ + { \ + if (!holder##_) { \ + return Default##holder##_.name; \ + } \ + return holder##_->name; \ + } \ + Y_FORCE_INLINE decltype(holder##_->name)& Mutable##name() \ + { \ INITIALIZE_EXTRA_PROPERTY_HOLDER(holder); \ - return holder##_->name; \ - } - -//////////////////////////////////////////////////////////////////////////////// + return holder##_->name; \ + } + +//////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/misc/variant.h b/library/cpp/yt/misc/variant.h index dd89e08ab31..27c0a2bc086 100644 --- a/library/cpp/yt/misc/variant.h +++ b/library/cpp/yt/misc/variant.h @@ -20,7 +20,7 @@ template <class T, class... Ts> struct TVariantIndex<T, std::variant<Ts...>> : std::integral_constant<size_t, NDetail::TIndexOf<T, Ts...>::Value> { }; - + template <class T, class V> constexpr size_t VariantIndexV = TVariantIndex<T, V>::value; |