add data::Wrap

This commit is contained in:
falsycat 2023-08-20 11:29:51 +09:00
parent b732d73eb9
commit c274f35265
2 changed files with 22 additions and 0 deletions

View File

@ -21,6 +21,7 @@ target_sources(nf7_iface
common/task_context.hh
common/value.hh
data/interface.hh
data/wrap.hh
subsys/concurrency.hh
subsys/interface.hh
subsys/logger.hh

21
iface/data/wrap.hh Normal file
View File

@ -0,0 +1,21 @@
// No copyright
#pragma once
#include "iface/data/interface.hh"
namespace nf7::data {
template <typename T>
class Wrap : public Interface {
protected:
Wrap(const char* name, T& data) noexcept
: Interface(name), data_(data) { }
public:
T& data() const noexcept { return data_; }
private:
T& data_;
};
} // namespace nf7::data