WvStreams
Main Page
Modules
Classes
Files
File List
File Members
include
unireplicategen.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 __UNIREPLICATEGEN_H
8
#define __UNIREPLICATEGEN_H
9
10
#include "uniconftree.h"
11
#include "wvlog.h"
12
26
class
UniReplicateGen
:
public
UniConfGen
27
{
28
private
:
29
struct
Gen
30
{
31
IUniConfGen
*gen;
32
bool
was_ok;
33
bool
auto_free;
34
35
Gen(
IUniConfGen
*_gen,
bool
_auto_free)
36
: gen(_gen), was_ok(gen->isok()), auto_free(_auto_free) {}
37
~Gen() {
if
(auto_free) WVRELEASE(gen); }
38
39
bool
isok
() {
return
was_ok = gen->isok(); }
40
};
41
DeclareWvList(Gen);
42
GenList gens;
43
44
bool
processing_callback;
45
46
Gen *first_ok()
const
;
47
48
void
replicate_if_any_have_become_ok();
49
50
protected
:
51
void
replicate(
const
UniConfKey
&key =
"/"
);
52
void
deltacallback(Gen *src_gen,
const
UniConfKey
&key,
53
WvStringParm
value);
54
55
public
:
56
UniReplicateGen
();
57
UniReplicateGen
(
const
IUniConfGenList &_gens,
bool
autofree =
true
);
58
virtual
~
UniReplicateGen
();
59
60
void
prepend(
IUniConfGen
*gen,
bool
autofree =
true
);
61
void
append(
IUniConfGen
*gen,
bool
autofree =
true
);
62
63
/***** Overridden members *****/
64
virtual
bool
isok
();
65
virtual
void
commit
();
66
virtual
bool
refresh
();
67
virtual
void
flush_buffers
() { }
68
virtual
void
set
(
const
UniConfKey
&key,
WvStringParm
value);
69
virtual
void
setv
(
const
UniConfPairList &pairs);
70
virtual
WvString
get
(
const
UniConfKey
&key);
71
virtual
Iter *
iterator
(
const
UniConfKey
&key);
72
};
73
74
#endif // __UNIREPLICATEGEN_H
Generated on Mon Jul 16 2012 13:15:39 for WvStreams by
1.8.1.1