WvStreams
Main Page
Modules
Classes
Files
File List
File Members
uniconf
unislowgen.cc
1
/*
2
* Worldvisions Weaver Software:
3
* Copyright (C) 2002 Net Integration Technologies, Inc.
4
*
5
* A UniConfGen that makes everything slow. See unislowgen.h.
6
*/
7
#include "unislowgen.h"
8
#include "wvmoniker.h"
9
#ifndef _MSC_VER // FIXME:WLACH Is unistd even needed here?!
10
#include <unistd.h>
11
#endif
12
13
static
IUniConfGen
*creator(
WvStringParm
s,
IObject
*_obj)
14
{
15
return
new
UniSlowGen
(wvcreate<IUniConfGen>(s, _obj));
16
}
17
18
static
WvMoniker<IUniConfGen>
reg(
"slow"
, creator);
19
20
21
UniSlowGen::UniSlowGen(
IUniConfGen
*inner) :
UniFilterGen
(inner)
22
{
23
slowcount = 0;
24
}
25
26
27
UniSlowGen::~UniSlowGen()
28
{
29
fprintf(stderr,
"%p: UniSlowGen: ran a total of %d slow operations.\n"
,
30
this
, how_slow());
31
}
32
33
34
void
UniSlowGen::commit
()
35
{
36
be_slow(
"commit()"
);
37
UniFilterGen::commit
();
38
}
39
40
41
bool
UniSlowGen::refresh
()
42
{
43
be_slow(
"refresh()"
);
44
return
UniFilterGen::refresh
();
45
}
46
47
48
WvString
UniSlowGen::get
(
const
UniConfKey
&key)
49
{
50
be_slow(
"get(%s)"
, key);
51
return
UniFilterGen::get
(key);
52
}
53
54
55
bool
UniSlowGen::exists
(
const
UniConfKey
&key)
56
{
57
be_slow(
"exists(%s)"
, key);
58
return
UniFilterGen::exists
(key);
59
}
60
61
62
bool
UniSlowGen::haschildren
(
const
UniConfKey
&key)
63
{
64
be_slow(
"haschildren(%s)"
, key);
65
return
UniFilterGen::haschildren
(key);
66
}
67
68
69
UniConfGen::Iter
*
UniSlowGen::iterator
(
const
UniConfKey
&key)
70
{
71
be_slow(
"iterator(%s)"
, key);
72
return
UniFilterGen::iterator
(key);
73
}
74
75
76
UniConfGen::Iter
*
UniSlowGen::recursiveiterator
(
const
UniConfKey
&key)
77
{
78
be_slow(
"recursiveiterator(%s)"
, key);
79
return
UniFilterGen::recursiveiterator
(key);
80
}
81
82
83
void
UniSlowGen::be_slow(
WvStringParm
what)
84
{
85
fprintf(stderr,
"%p: UniSlowGen: slow operation: %s\n"
,
86
this
, what.
cstr
());
87
// sleep(1);
88
slowcount++;
89
}
90
91
Generated on Fri Mar 14 2014 14:08:52 for WvStreams by
1.8.1.2