WvStreams
include/unitransactiongen.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 2002 Net Integration Technologies, Inc.
4 *
5 * A UniConfGen that represents pending transactions to another generator.
6 */
7#ifndef __UNITRANSACTIONGEN_H
8#define __UNITRANSACTIONGEN_H
9
10#include "uniconfgen.h"
11
14
80class UniTransactionGen : public UniConfGen
81{
82public:
88
94
95
96 /***** Overridden methods *****/
97
98 virtual WvString get(const UniConfKey &key);
99 virtual void set(const UniConfKey &key, WvStringParm value);
100 virtual void setv(const UniConfPairList &pairs);
101 virtual void commit();
102 virtual bool refresh();
103 virtual Iter *iterator(const UniConfKey &key);
104 virtual bool isok();
105 virtual void flush_buffers();
106
107protected:
108 UniConfChangeTree *root;
109 IUniConfGen *base;
110
115 const UniConfKey &section);
116
121 const UniConfKey &section);
122
127 const UniConfKey &section);
128
133 const UniConfKey &section);
134
138 void gencallback(const UniConfKey &key,
139 WvStringParm value);
140
146 const UniConfKey &key,
147 int seg,
148 WvStringParm value);
149
150 UniConfChangeTree *create_change(UniConfChangeTree *parent,
151 const UniConfKey &key,
152 int seg,
153 WvStringParm value);
154
155 UniConfValueTree *set_value(UniConfValueTree *node,
156 const UniConfKey &key,
157 int seg,
158 WvStringParm value);
159
160 UniConfChangeTree *set_change(UniConfChangeTree *node,
161 const UniConfKey &key,
162 int seg,
163 WvStringParm value);
164
169
174
179 void deletion_visitor(const UniConfValueTree *node, void *userdata);
180};
181
182#endif
An abstract data container that backs a UniConf tree.
An abstract iterator over keys and values in a generator.
A default implementation of IUniConfGen, providing various handy features that save trouble when impl...
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
A plain UniConfTree that holds keys and values.
A UniConfGen that represents pending transactions to another generator.
void deletion_visitor(const UniConfValueTree *node, void *userdata)
A UniConfTree visitor function for set_value(), cancel_values(), and cancel_changes().
UniConfValueTree * create_value(UniConfValueTree *parent, const UniConfKey &key, int seg, WvStringParm value)
Four functions to implement the functionality of set() so that it isn't two pages long.
void cancel_changes(UniConfChangeTree *node, const UniConfKey &section)
A recursive helper function for refresh().
void apply_values(UniConfValueTree *newcontents, const UniConfKey &section)
A recursive helper function for apply_changes().
void deletion_simulator(const UniConfKey &key)
A recursive helper function for create_change().
UniTransactionGen(IUniConfGen *_base)
Constructs a UniTransactionGen for the given underlying generator, which must be non-null.
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
void deletion_simulator2(const UniConfKey &key)
A recursive helper function for set_change().
virtual bool isok()
Determines if the generator is usable and working properly.
void cancel_values(UniConfValueTree *newcontents, const UniConfKey &section)
A recursive helper function for cancel_changes().
~UniTransactionGen()
Destroys the UniTransactionGen and the underlying generator.
virtual void commit()
Commits any changes.
void gencallback(const UniConfKey &key, WvStringParm value)
The callback function for the underlying generator.
virtual void flush_buffers()
Flushes any commitment/notification buffers .
void apply_changes(UniConfChangeTree *node, const UniConfKey &section)
A recursive helper function for commit().
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
virtual bool refresh()
Refreshes information about a key recursively.
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
WvString is an implementation of a simple and efficient printable-string class.