WvStreams
include/uniclientgen.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * UniClientGen is a UniConfGen for retrieving data from the
6 * UniConfDaemon.
7 */
8#ifndef __UNICONFCLIENT_H
9#define __UNICONFCLIENT_H
10
11#include "uniconfgen.h"
12#include "wvlog.h"
13#include "wvstringlist.h"
14#include "uniclientconn.h"
15#include "uniconfkey.h"
16
28class UniClientGen : public UniConfGen
29{
30 UniClientConn *conn;
31
32 WvLog log;
33
34 WvString result_key;
35 WvString result;
37 UniListIter *result_list;
39 bool cmdinprogress;
40 bool cmdsuccess;
42 time_t timeout; // command timeout in ms
43
44 int version;
46public:
52 UniClientGen(IWvStream *stream, WvStringParm dst = WvString::null);
53
54 virtual ~UniClientGen();
55
56 time_t set_timeout(time_t _timeout);
57
58 /***** Overridden members *****/
59
60 virtual bool isok();
61
62 virtual bool refresh();
63 virtual void flush_buffers();
64 virtual void commit();
65 virtual WvString get(const UniConfKey &key);
66 virtual void set(const UniConfKey &key, WvStringParm value);
67 virtual void setv(const UniConfPairList &pairs);
68 virtual bool haschildren(const UniConfKey &key);
69 virtual Iter *iterator(const UniConfKey &key);
70 virtual Iter *recursiveiterator(const UniConfKey &key);
71
72protected:
73 virtual Iter *do_iterator(const UniConfKey &key, bool recursive);
74 void conncallback();
75 bool do_select();
76};
77
78
79#endif // __UNICONFCLIENT_H
Represents a connection to a UniConf daemon via any WvStream.
Communicates with a UniConfDaemon to fetch and store keys and values.
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
virtual void flush_buffers()
Flushes any commitment/notification buffers .
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
UniClientGen(IWvStream *stream, WvStringParm dst=WvString::null)
Creates a generator which can communicate with a daemon using the specified stream.
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
virtual bool isok()
Determines if the generator is usable and working properly.
virtual Iter * recursiveiterator(const UniConfKey &key)
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
virtual void commit()
Commits any changes.
virtual bool refresh()
Refreshes information about a key recursively.
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...
An iterator that iterates through a constant list of keys.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
WvString is an implementation of a simple and efficient printable-string class.