Files
Work/as68hc11/CACHEITM.HPP
2024-08-07 09:12:07 -04:00

90 lines
1.8 KiB
C++

#ifndef _AS68HC11_CACHEITEM_HPP_
#define _AS68HC11_CACHEITEM_HPP_
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
template <class T,class U>
class CacheItem
{
public:
CacheItem(void);
CacheItem(const CacheItem<T,U> &someCacheItem);
virtual ~CacheItem();
CacheItem<T,U> &operator=(const CacheItem<T,U> &someCacheItem);
WORD operator==(const CacheItem<T,U> &someCacheItem)const;
const SmartPointer<U> &cacheItem(void)const;
void cacheItem(const SmartPointer<U> &cacheItem);
const T &cacheExtraInfo(void)const;
void cacheExtraInfo(const T &cacheExtraInfo);
private:
SmartPointer<U> mCacheItem;
T mCacheExtraInfo;
};
template <class T,class U>
inline
CacheItem<T,U>::CacheItem(void)
{
}
template <class T,class U>
inline
CacheItem<T,U>::CacheItem(const CacheItem<T,U> &someCacheItem)
{
*this=someCacheItem;
}
template <class T,class U>
inline
CacheItem<T,U>::~CacheItem()
{
}
template <class T,class U>
inline
CacheItem<T,U> &CacheItem<T,U>::operator=(const CacheItem<T,U> &someCacheItem)
{
mCacheItem=someCacheItem.mCacheItem;
mCacheExtraInfo=someCacheItem.mCacheExtraInfo;
return *this;
}
template <class T,class U>
inline
WORD CacheItem<T,U>::operator==(const CacheItem<T,U> &someCacheItem)const
{
return (mCacheItem==someCacheItem.mCacheItem&&
mCacheExtraInfo==someCacheItem.mCacheExtraInfo);
}
template <class T,class U>
inline
const SmartPointer<U> &CacheItem<T,U>::cacheItem(void)const
{
return mCacheItem;
}
template <class T,class U>
inline
void CacheItem<T,U>::cacheItem(const SmartPointer<U> &cacheItem)
{
mCacheItem=cacheItem;
}
template <class T,class U>
inline
const T &CacheItem<T,U>::cacheExtraInfo(void)const
{
return mCacheExtraInfo;
}
template <class T,class U>
inline
void CacheItem<T,U>::cacheExtraInfo(const T &cacheExtraInfo)
{
mCacheExtraInfo=cacheExtraInfo;
}
#endif