Commit | Line | Data |
---|---|---|
b3f060ed PP |
1 | /* |
2 | * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: MIT | |
5 | */ | |
6 | ||
7 | #ifndef BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP | |
8 | #define BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP | |
9 | ||
b3f060ed PP |
10 | namespace bt2 { |
11 | ||
12 | template <typename ObjT> | |
13 | class RawValueProxy | |
14 | { | |
15 | private: | |
16 | using _RawVal = typename ObjT::Value; | |
17 | ||
18 | public: | |
19 | explicit RawValueProxy(const ObjT obj) : _mObj {obj} | |
20 | { | |
21 | } | |
22 | ||
23 | RawValueProxy& operator=(const _RawVal& rawVal) | |
24 | { | |
25 | _mObj.value(rawVal); | |
26 | return *this; | |
27 | } | |
28 | ||
29 | operator _RawVal() const noexcept | |
30 | { | |
31 | return _mObj.value(); | |
32 | } | |
33 | ||
34 | private: | |
35 | ObjT _mObj; | |
36 | }; | |
37 | ||
b3f060ed PP |
38 | } /* namespace bt2 */ |
39 | ||
40 | #endif /* BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP */ |