added is_state method to object_proxy and object_ptr to check state
This commit is contained in:
parent
85d297995d
commit
8753042b3c
|
|
@ -74,10 +74,11 @@ public:
|
|||
[[nodiscard]] const utils::identifier &primary_key() const { return pk_; }
|
||||
void primary_key(const utils::identifier &pk) { pk_ = pk; }
|
||||
|
||||
bool is_persistent() const { return state_ == object_state::Persistent; }
|
||||
bool is_transient() const { return state_ == object_state::Transient; }
|
||||
bool is_detached() const { return state_ == object_state::Detached; }
|
||||
bool is_removed() const { return state_ == object_state::Removed; }
|
||||
bool is_persistent() const { return is_state(object_state::Persistent); }
|
||||
bool is_transient() const { return is_state(object_state::Transient); }
|
||||
bool is_detached() const { return is_state(object_state::Detached); }
|
||||
bool is_removed() const { return is_state(object_state::Removed); }
|
||||
bool is_state(const object_state state) const { return state_ == state; }
|
||||
|
||||
void change_state(const object_state state) {
|
||||
state_.store(state, std::memory_order_release);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public:
|
|||
[[nodiscard]] bool is_transient() const { return proxy_->is_transient(); }
|
||||
[[nodiscard]] bool is_detached() const { return proxy_->is_detached(); }
|
||||
[[nodiscard]] bool is_removed() const { return proxy_->is_removed(); }
|
||||
[[nodiscard]] bool is_state(const object_state state) const { return proxy_->is_state(state); }
|
||||
|
||||
void change_state(object_state s) const {
|
||||
if (proxy_) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue