aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-02-02 21:28:02 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-02-02 21:40:11 +0300
commit7975803ac2bf9fa5ee89888743a50cd3b382d7c7 (patch)
treedb93ac85834736bac72a80ead96c08dd59eb0745 /library/cpp
parent4c6d9b5352a2b70287e27a9ff29ef751a5bc8d08 (diff)
downloadydb-7975803ac2bf9fa5ee89888743a50cd3b382d7c7.tar.gz
Intermediate changes
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/misc/property.h65
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() \