WvStreams
unicachegen.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 2002 Net Integration Technologies, Inc.
00004  *
00005  * A UniConf generator that caches keys/values in memory.
00006  */
00007 #ifndef __UNICACHEGEN_H
00008 #define __UNICACHEGEN_H
00009 
00010 #include "unitempgen.h"
00011 #include "uniconftree.h"
00012 #include "wvlog.h"
00013 
00026 class UniCacheGen : public UniTempGen
00027 {
00028 protected:
00029     WvLog log;
00030     IUniConfGen *inner;
00031     bool refreshed_once; //< we cache forever, so no need to re-refresh()
00032 
00033     void loadtree(const UniConfKey &key = "");
00034     void deltacallback(const UniConfKey &key, WvStringParm value);
00035 
00036 public:
00037     UniCacheGen(IUniConfGen *_inner);
00038     virtual ~UniCacheGen();
00039 
00040     /***** Overridden members *****/
00041     virtual bool isok();
00042     virtual bool refresh();
00043     virtual void commit();
00044     virtual void set(const UniConfKey &key, WvStringParm value);
00045     virtual WvString get(const UniConfKey &key);
00046 };
00047 
00048 #endif // __UNICACHEGEN_H