Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
48
Src/Plugins/Input/in_wmvdrm/CachedData.h
Normal file
48
Src/Plugins/Input/in_wmvdrm/CachedData.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
#ifndef CACHEDDATAH
|
||||
#define CACHEDDATAH
|
||||
|
||||
template <class DataType>
|
||||
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 <class FromType>
|
||||
bool operator =(FromType from)
|
||||
{
|
||||
data = from;
|
||||
cached=true;
|
||||
return cached;
|
||||
}
|
||||
|
||||
private:
|
||||
bool cached;
|
||||
DataType data;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue