WvStreams
unicachegen.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 2002 Net Integration Technologies, Inc.
4  *
5  * A UniConf generator that caches keys/values in memory.
6  */
7 #ifndef __UNICACHEGEN_H
8 #define __UNICACHEGEN_H
9 
10 #include "unitempgen.h"
11 #include "uniconftree.h"
12 #include "wvlog.h"
13 
26 class UniCacheGen : public UniTempGen
27 {
28 protected:
29  WvLog log;
30  IUniConfGen *inner;
31  bool refreshed_once; //< we cache forever, so no need to re-refresh()
32 
33  void loadtree(const UniConfKey &key = "");
34  void deltacallback(const UniConfKey &key, WvStringParm value);
35 
36 public:
37  UniCacheGen(IUniConfGen *_inner);
38  virtual ~UniCacheGen();
39 
40  /***** Overridden members *****/
41  virtual bool isok();
42  virtual bool refresh();
43  virtual void commit();
44  virtual void set(const UniConfKey &key, WvStringParm value);
45  virtual WvString get(const UniConfKey &key);
46 };
47 
48 #endif // __UNICACHEGEN_H