From 469bbcf0701e1eb8a6670c23145b0da87357e178 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 25 Mar 2012 20:00:08 +0000 Subject: Code is all reorganized. We're about ready to release. I should write up a little explenation of the arrangement. --- src/experimental/cachecalc.h | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/experimental/cachecalc.h (limited to 'src/experimental/cachecalc.h') diff --git a/src/experimental/cachecalc.h b/src/experimental/cachecalc.h new file mode 100644 index 0000000..89cfadc --- /dev/null +++ b/src/experimental/cachecalc.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2007-2011 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#ifndef BU_CACHE_CALC_H +#define BU_CACHE_CALC_H + +#include "bu/trace.h" + +#include + +namespace Bu +{ + template class Cache; + + template + class CacheCalc + { + friend class Cache; + private: + typedef Cache MyCache; + public: + CacheCalc() : + pCache( (MyCache *)0 ) + { + TRACE(); + } + + virtual ~CacheCalc() + { + TRACE(); + } + + virtual void onLoad( obtype *pSrc, const keytype &key )=0; + virtual void onUnload( obtype *pSrc, const keytype &key )=0; + virtual void onDestroy( obtype *pSrc, const keytype &key )=0; + virtual void onDestroy( const keytype &key )=0; + virtual bool shouldSync( obtype *pSrc, const keytype &key, + time_t tLastSync )=0; + virtual void onTick() { }; + + protected: + MyCache *getCache() + { + TRACE(); + return pCache; + } + + private: + void setCache( MyCache *pCache ) + { + TRACE(); + this->pCache = pCache; + } + + MyCache *pCache; + }; +}; + +#endif -- cgit v1.2.3