Kagome
Polkadot Runtime Engine in C++17
|
#include <safe_object.hpp>
Public Member Functions | |
template<typename... Args> | |
SafeObject (Args &&...args) | |
template<typename F > | |
auto | exclusiveAccess (F &&f) |
template<typename F > | |
auto | sharedAccess (F &&f) const |
Private Attributes | |
T | t_ |
M | cs_ |
Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 Protected object wrapper. Allow read-write access.
T | object type Example: SafeObject<std::string> obj("1"); bool const is_one_att1 = obj.sharedAccess([](auto const &str) { return str == "1"; }); obj.exclusiveAccess([](auto &str) { str = "2"; }); bool const is_one_att2 = obj.sharedAccess([](auto const &str) { return str == "1"; }); std::cout << "Attempt 1: " << is_one_att1 << std::endl << "Attempt 2: " << is_one_att2; |
Definition at line 38 of file safe_object.hpp.
|
inline |
Definition at line 40 of file safe_object.hpp.
|
inline |
Definition at line 43 of file safe_object.hpp.
|
inline |
Definition at line 49 of file safe_object.hpp.
|
mutableprivate |
Definition at line 56 of file safe_object.hpp.
|
private |
Definition at line 55 of file safe_object.hpp.