00001
00002
00003
00004
00005
00006
00007 #ifndef __UNITRANSACTIONGEN_H
00008 #define __UNITRANSACTIONGEN_H
00009
00010 #include "uniconfgen.h"
00011
00012 class UniConfChangeTree;
00013 class UniConfValueTree;
00014
00080 class UniTransactionGen : public UniConfGen
00081 {
00082 public:
00087 UniTransactionGen(IUniConfGen *_base);
00088
00093 ~UniTransactionGen();
00094
00095
00096
00097
00098 virtual WvString get(const UniConfKey &key);
00099 virtual void set(const UniConfKey &key, WvStringParm value);
00100 virtual void setv(const UniConfPairList &pairs);
00101 virtual void commit();
00102 virtual bool refresh();
00103 virtual Iter *iterator(const UniConfKey &key);
00104 virtual bool isok();
00105 virtual void flush_buffers();
00106
00107 protected:
00108 UniConfChangeTree *root;
00109 IUniConfGen *base;
00110
00114 void apply_changes(UniConfChangeTree *node,
00115 const UniConfKey §ion);
00116
00120 void apply_values(UniConfValueTree *newcontents,
00121 const UniConfKey §ion);
00122
00126 void cancel_changes(UniConfChangeTree *node,
00127 const UniConfKey §ion);
00128
00132 void cancel_values(UniConfValueTree *newcontents,
00133 const UniConfKey §ion);
00134
00138 void gencallback(const UniConfKey &key,
00139 WvStringParm value);
00140
00145 UniConfValueTree *create_value(UniConfValueTree *parent,
00146 const UniConfKey &key,
00147 int seg,
00148 WvStringParm value);
00149
00150 UniConfChangeTree *create_change(UniConfChangeTree *parent,
00151 const UniConfKey &key,
00152 int seg,
00153 WvStringParm value);
00154
00155 UniConfValueTree *set_value(UniConfValueTree *node,
00156 const UniConfKey &key,
00157 int seg,
00158 WvStringParm value);
00159
00160 UniConfChangeTree *set_change(UniConfChangeTree *node,
00161 const UniConfKey &key,
00162 int seg,
00163 WvStringParm value);
00164
00168 void deletion_simulator(const UniConfKey &key);
00169
00173 void deletion_simulator2(const UniConfKey &key);
00174
00179 void deletion_visitor(const UniConfValueTree *node, void *userdata);
00180 };
00181
00182 #endif