00001
00002
00003
00004
00005
00006
00007 #include "unislowgen.h"
00008 #include "wvmoniker.h"
00009 #ifndef _MSC_VER // FIXME:WLACH Is unistd even needed here?!
00010 #include <unistd.h>
00011 #endif
00012
00013 static IUniConfGen *creator(WvStringParm s, IObject *_obj)
00014 {
00015 return new UniSlowGen(wvcreate<IUniConfGen>(s, _obj));
00016 }
00017
00018 static WvMoniker<IUniConfGen> reg("slow", creator);
00019
00020
00021 UniSlowGen::UniSlowGen(IUniConfGen *inner) : UniFilterGen(inner)
00022 {
00023 slowcount = 0;
00024 }
00025
00026
00027 UniSlowGen::~UniSlowGen()
00028 {
00029 fprintf(stderr, "%p: UniSlowGen: ran a total of %d slow operations.\n",
00030 this, how_slow());
00031 }
00032
00033
00034 void UniSlowGen::commit()
00035 {
00036 be_slow("commit()");
00037 UniFilterGen::commit();
00038 }
00039
00040
00041 bool UniSlowGen::refresh()
00042 {
00043 be_slow("refresh()");
00044 return UniFilterGen::refresh();
00045 }
00046
00047
00048 WvString UniSlowGen::get(const UniConfKey &key)
00049 {
00050 be_slow("get(%s)", key);
00051 return UniFilterGen::get(key);
00052 }
00053
00054
00055 bool UniSlowGen::exists(const UniConfKey &key)
00056 {
00057 be_slow("exists(%s)", key);
00058 return UniFilterGen::exists(key);
00059 }
00060
00061
00062 bool UniSlowGen::haschildren(const UniConfKey &key)
00063 {
00064 be_slow("haschildren(%s)", key);
00065 return UniFilterGen::haschildren(key);
00066 }
00067
00068
00069 UniConfGen::Iter *UniSlowGen::iterator(const UniConfKey &key)
00070 {
00071 be_slow("iterator(%s)", key);
00072 return UniFilterGen::iterator(key);
00073 }
00074
00075
00076 UniConfGen::Iter *UniSlowGen::recursiveiterator(const UniConfKey &key)
00077 {
00078 be_slow("recursiveiterator(%s)", key);
00079 return UniFilterGen::recursiveiterator(key);
00080 }
00081
00082
00083 void UniSlowGen::be_slow(WvStringParm what)
00084 {
00085 fprintf(stderr, "%p: UniSlowGen: slow operation: %s\n",
00086 this, what.cstr());
00087
00088 slowcount++;
00089 }
00090
00091