/* * CacheSetAsync.hpp * * Created on: 27 нояб. 2023 г. * Author: titov */ #ifndef UMLIBRARY_SCHEMATIC_CACHESETASYNC_HPP_ #define UMLIBRARY_SCHEMATIC_CACHESETASYNC_HPP_ #include "../systemic/IValueAsync.hpp" #include "../systemic/IValue.hpp" namespace schematic { template class CacheSetAsync : public systemic::IValueType { public: CacheSetAsync( systemic::IValueType & async ); const T & getCachedValue() const; void set( T ); T get() const; private: T cached; systemic::IValueType & async; }; } template inline schematic::CacheSetAsync::CacheSetAsync( systemic::IValueType &async) : async(async), cached(async.get()) {} template inline const T & schematic::CacheSetAsync::getCachedValue() const { return cached; } template inline void schematic::CacheSetAsync::set(T valueType) { cached = valueType; async.set(cached); } template inline T schematic::CacheSetAsync::get() const { return cached; } #endif /* UMLIBRARY_SCHEMATIC_CACHESETASYNC_HPP_ */