From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/Input/in_wmvdrm/CachedData.h | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Src/Plugins/Input/in_wmvdrm/CachedData.h (limited to 'Src/Plugins/Input/in_wmvdrm/CachedData.h') diff --git a/Src/Plugins/Input/in_wmvdrm/CachedData.h b/Src/Plugins/Input/in_wmvdrm/CachedData.h new file mode 100644 index 00000000..8782ead1 --- /dev/null +++ b/Src/Plugins/Input/in_wmvdrm/CachedData.h @@ -0,0 +1,48 @@ +#ifndef CACHEDDATAH +#define CACHEDDATAH + +template +class CachedData +{ +public: + CachedData() : cached(false) + { + } + CachedData(DataType _data) : cached(true), data(_data) + { + } + operator DataType() + { + return data; + } + + bool IsCached() + { + return cached; + } + void ClearCache() + { + cached=false; + } + DataType *operator &() + { + if (cached) + return &data; + else + return 0; + } + + template + bool operator =(FromType from) + { + data = from; + cached=true; + return cached; + } + +private: + bool cached; + DataType data; +}; + +#endif \ No newline at end of file -- cgit