WvStreams
unislowgen.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 2002 Net Integration Technologies, Inc.
00004  * 
00005  * A UniConfGen that makes everything slow.
00006  */
00007 #ifndef __UNISLOWGEN_H
00008 #define __UNISLOWGEN_H
00009 
00010 #include "unifiltergen.h"
00011 
00027 class UniSlowGen : public UniFilterGen
00028 {
00029 public:
00030     UniSlowGen(IUniConfGen *inner);
00031     virtual ~UniSlowGen();
00032 
00033     virtual void commit();
00034     virtual bool refresh();
00035     virtual void flush_buffers() { }
00036     virtual WvString get(const UniConfKey &key);
00037     virtual bool exists(const UniConfKey &key);
00038     virtual bool haschildren(const UniConfKey &key);
00039     virtual Iter *iterator(const UniConfKey &key);
00040     virtual Iter *recursiveiterator(const UniConfKey &key);
00041     
00042     int how_slow() const
00043         { return slowcount; }
00044     
00045     void reset_slow()
00046         { slowcount = 0; }
00047     
00048 private:
00049     int slowcount;
00050     
00051     void be_slow(WvStringParm what);
00052     void be_slow(WVSTRING_FORMAT_DECL)
00053         { be_slow(WvString(WVSTRING_FORMAT_CALL)); }
00054 };
00055 
00056 #endif //__UNISLOWGEN_H