diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-07 18:57:04 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-07 18:57:04 +0100 |
commit | 9df087ede0b539ecbd2778236c7d1143362b384d (patch) | |
tree | 01a1c0c46da3a09137fcb9ca6e613fd1148f4df1 /src/crepe/ValueBroker.h | |
parent | e36ea050972fcaaf3d85d672755bad4ebb2dcd80 (diff) |
check code standard
Diffstat (limited to 'src/crepe/ValueBroker.h')
-rw-r--r-- | src/crepe/ValueBroker.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/crepe/ValueBroker.h b/src/crepe/ValueBroker.h index c3359a1..88988b4 100644 --- a/src/crepe/ValueBroker.h +++ b/src/crepe/ValueBroker.h @@ -4,10 +4,22 @@ namespace crepe { +/** + * \brief Give reference to value through custom set/get functions + * + * This class can be used to abstract direct access to any arbitrary value + * through a custom get and set function passed to its constructor. Consumers + * of this type may want to wrap it in a \c Proxy so it behaves like a regular + * variable. + * + * \tparam T Type of the underlying variable + */ template <typename T> class ValueBroker { public: + //! Set the value virtual void set(const T &); + //! Retrieve the value virtual const T & get(); typedef std::function<void(const T & target)> setter_t; @@ -16,8 +28,11 @@ private: setter_t setter; getter_t getter; public: - ValueBroker(const setter_t &, const getter_t &); - ValueBroker(T &); + /** + * \param setter Function that sets the variable + * \param getter Function that retrieves the variable + */ + ValueBroker(const setter_t & setter, const getter_t & getter); }; } |