diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-02-02 21:28:02 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-02-09 19:17:22 +0300 |
commit | e48237b5429bb1870710b6303da89b90a7a53f07 (patch) | |
tree | 8021aef1eb0f6c34873ff715b063586f6437c658 /library | |
parent | ac6be7a8607c3a62daae289c6dac983a013cd486 (diff) | |
download | ydb-e48237b5429bb1870710b6303da89b90a7a53f07.tar.gz |
Intermediate changes
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/yt/misc/property.h | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/library/cpp/yt/misc/property.h b/library/cpp/yt/misc/property.h index d172fcdcfb..4d0577f464 100644 --- a/library/cpp/yt/misc/property.h +++ b/library/cpp/yt/misc/property.h @@ -46,6 +46,24 @@ public: \ } \ static_assert(true) +//! Defines a trivial public read-write property override that is passed by reference +//! and is not inline-initialized. +#define DEFINE_BYREF_RW_PROPERTY_NO_INIT_OVERRIDE(type, name) \ +protected: \ + type name##_; \ + \ +public: \ + Y_FORCE_INLINE type& name() noexcept override \ + { \ + return name##_; \ + } \ + \ + Y_FORCE_INLINE const type& name() const noexcept override \ + { \ + return name##_; \ + } \ + static_assert(true) + //! Forwards a trivial public read-write property that is passed by reference. #define DELEGATE_BYREF_RW_PROPERTY(declaringType, type, name, delegateTo) \ type& declaringType::name() noexcept \ @@ -92,6 +110,19 @@ public: \ } \ static_assert(true) +//! Defines a trivial public read-only property override that is passed by reference +//! and is not inline-initialized. +#define DEFINE_BYREF_RO_PROPERTY_NO_INIT_OVERRIDE(type, name) \ +protected: \ + type name##_; \ + \ +public: \ + Y_FORCE_INLINE const type& name() const noexcept override \ + { \ + return name##_; \ + } \ + static_assert(true) + //! Forwards a trivial public read-only property that is passed by reference. #define DELEGATE_BYREF_RO_PROPERTY(declaringType, type, name, delegateTo) \ const type& declaringType::name() const noexcept \ @@ -153,7 +184,7 @@ public: \ //! Defines a trivial public read-write property that is passed by value //! and is not inline-initialized. -#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT(type, name, ...) \ +#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT(type, name) \ protected: \ type name##_; \ \ @@ -169,6 +200,24 @@ public: \ } \ static_assert(true) +//! Defines a trivial public read-write property override that is passed by value +//! and is not inline-initialized. +#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT_OVERRIDE(type, name) \ +protected: \ + type name##_; \ + \ +public: \ + Y_FORCE_INLINE type Get##name() const override \ + { \ + return name##_; \ + } \ + \ + Y_FORCE_INLINE void Set##name(type value) override \ + { \ + name##_ = value; \ + } \ + static_assert(true) + //! Forwards a trivial public read-write property that is passed by value. #define DELEGATE_BYVAL_RW_PROPERTY(declaringType, type, name, delegateTo) \ type declaringType::Get##name() const \ @@ -202,7 +251,6 @@ public: \ } \ static_assert(true) - //! Defines a trivial public read-only property that is passed by value //! and is not inline-initialized. #define DEFINE_BYVAL_RO_PROPERTY_NO_INIT(type, name) \ @@ -216,6 +264,19 @@ public: \ } \ static_assert(true) +//! Defines a trivial public read-only property override that is passed by value +//! and is not inline-initialized. +#define DEFINE_BYVAL_RO_PROPERTY_NO_INIT_OVERRIDE(type, name) \ +protected: \ + type name##_; \ + \ +public: \ + Y_FORCE_INLINE type Get##name() const override \ + { \ + return name##_; \ + } \ + static_assert(true) + //! Forwards a trivial public read-only property that is passed by value. #define DELEGATE_BYVAL_RO_PROPERTY(declaringType, type, name, delegateTo) \ type declaringType::Get##name() \ |