Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

UniMountTreeGen Class Reference

#include <unimounttreegen.h>

Inherits UniConfGen.

Inherited by UniConfFileTreeGen.

Collaboration diagram for UniMountTreeGen:

[legend]
List of all members.

Detailed Description

The UniMountTree implementation realized as a UniConfGen.

Definition at line 120 of file unimounttreegen.h.

Public Member Functions

 UniMountTreeGen ()
 Creates an empty UniConf tree with no mounted stores.

 ~UniMountTreeGen ()
 Destroys the UniConf tree along with all uncommitted data.

virtual UniConfGenmount (const UniConfKey &key, WvStringParm moniker, bool refresh)
 Mounts a generator at a key using a moniker.

virtual UniConfGenmountgen (const UniConfKey &key, UniConfGen *gen, bool refresh)
 Mounts a generator at a key.

virtual void unmount (const UniConfKey &key, UniConfGen *gen, bool commit)
 Unmounts the generator at a key and destroys it.

virtual UniConfGenwhichmount (const UniConfKey &key, UniConfKey *mountpoint)
 Finds the generator that owns a key.

virtual bool ismountpoint (const UniConfKey &key)
 Determines if a key is a mountpoint.

virtual bool exists (const UniConfKey &key)
 Without fetching its value, returns true if a key exists.

virtual bool haschildren (const UniConfKey &key)
 Returns true if a key has children.

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.

virtual bool refresh ()
 Refreshes information about a key recursively.

virtual void commit ()
 Commits any changes.

virtual Iter * iterator (const UniConfKey &key)
 Returns an iterator over the children of the specified key.

void setcallback (const UniConfGenCallback &callback, void *userdata)
 Sets the callback for change notification.

void dispatch_delta (const UniConfKey &key, WvStringParm value)
 Immediately sends notification that a key has possibly changed.

void hold_delta ()
 Pauses notifications until matched with a call to unhold_delta().

void unhold_delta ()
 Resumes notifications when each hold_delta() has been matched.

void clear_delta ()
 Clears the list of pending notifications without sending them.

void flush_delta ()
 Flushes the list of pending notifications by sending them.

void delta (const UniConfKey &key, WvStringParm value)
 Call this when a key's value or children have possibly changed.

virtual bool isok ()
 Determines if the generator is usable and working properly.

virtual int str2int (WvStringParm s, int defvalue) const
 Converts a string to an integer.

virtual unsigned int addRef ()
virtual unsigned int release ()

Protected Member Functions

void seterror (WvStringParm error)
 Raises an error condition.


Constructor & Destructor Documentation

UniMountTreeGen::UniMountTreeGen  ) 
 

Creates an empty UniConf tree with no mounted stores.

Definition at line 12 of file unimounttreegen.cc.

UniMountTreeGen::~UniMountTreeGen  ) 
 

Destroys the UniConf tree along with all uncommitted data.

Definition at line 18 of file unimounttreegen.cc.


Member Function Documentation

virtual unsigned int GenericComponent< IObject >::addRef  )  [inline, virtual, inherited]
 

Implements IObject.

Definition at line 67 of file wvxplc.h.

void UniConfGen::clear_delta  )  [inherited]
 

Clears the list of pending notifications without sending them.

Does not affect the hold nesting count.

Definition at line 38 of file uniconfgen.cc.

void UniMountTreeGen::commit  )  [virtual]
 

Commits any changes.

The default implementation does nothing.

Reimplemented from UniConfGen.

Definition at line 125 of file unimounttreegen.cc.

References UniMountTree::generators, UniConfGen::hold_delta(), and UniConfGen::unhold_delta().

void UniConfGen::delta const UniConfKey key,
WvStringParm  value
[inherited]
 

Call this when a key's value or children have possibly changed.

If the hold nesting count is 0, the notification is sent immediately. Otherwise it is added to a pending list for later.

Definition at line 69 of file uniconfgen.cc.

References UniConfGen::delta(), UniConfGen::dispatch_delta(), UniConfGen::hold_delta(), and UniConfGen::unhold_delta().

Referenced by UniConfGen::delta().

void UniConfGen::dispatch_delta const UniConfKey key,
WvStringParm  value
[inherited]
 

Immediately sends notification that a key has possibly changed.

Takes care of the details of invoking the callback.

Note: You probably want to be using delta() instead.

Definition at line 62 of file uniconfgen.cc.

References UniConfGen::dispatch_delta(), and WvStringParm.

Referenced by UniConfGen::delta(), UniConfGen::dispatch_delta(), and UniConfGen::flush_delta().

bool UniMountTreeGen::exists const UniConfKey key  )  [virtual]
 

Without fetching its value, returns true if a key exists.

This is provided because it is often more efficient to test existance than to actually retrieve the value.

The default implementation returns !get(key).isnull().

Reimplemented from UniConfGen.

Definition at line 62 of file unimounttreegen.cc.

References UniConfGen::exists(), exists(), UniConfTree< UniMountTree >::find(), UniConfGen::hold_delta(), UniMountTree::GenIter::next(), UniMountTree::GenIter::ptr(), UniMountTree::GenIter::rewind(), UniMountTree::GenIter::tail(), and UniConfGen::unhold_delta().

Referenced by exists().

void UniConfGen::flush_delta  )  [inherited]
 

Flushes the list of pending notifications by sending them.

Does not affect the hold nesting count.

Definition at line 44 of file uniconfgen.cc.

References UniConfGen::dispatch_delta().

Referenced by UniConfGen::unhold_delta().

WvString UniMountTreeGen::get const UniConfKey key  )  [virtual]
 

Fetches a string value for a key from the registry.

If the key doesn't exist, the return value is WvString::null.

Implements UniConfGen.

Definition at line 25 of file unimounttreegen.cc.

References UniConfTree< UniMountTree >::find(), UniConfGen::get(), get(), UniConfGen::hold_delta(), WvFastString::isnull(), UniMountTree::GenIter::next(), UniMountTree::GenIter::ptr(), UniMountTree::GenIter::rewind(), UniMountTree::GenIter::tail(), and UniConfGen::unhold_delta().

Referenced by get().

bool UniMountTreeGen::haschildren const UniConfKey key  )  [virtual]
 

Returns true if a key has children.

This is provided because it is often more efficient to test existance than to actually retrieve the keys.

The default implementation uses the iterator returned by iterator() to test whether the child has any keys. Subclasses are strongly encouraged to provide a better implementation.

Reimplemented from UniConfGen.

Definition at line 88 of file unimounttreegen.cc.

References UniConfTree< UniMountTree >::find(), UniConfGen::haschildren(), UniHashTreeBase::haschildren(), haschildren(), UniConfGen::hold_delta(), UniMountTree::GenIter::next(), UniMountTree::GenIter::ptr(), UniMountTree::GenIter::rewind(), UniMountTree::GenIter::tail(), and UniConfGen::unhold_delta().

Referenced by haschildren().

void UniConfGen::hold_delta  )  [inherited]
 

Pauses notifications until matched with a call to unhold_delta().

While paused, notification events are placed into a pending list. Redundant notifications may be discarded.

Use this to safeguard non-reentrant code.

Definition at line 23 of file uniconfgen.cc.

Referenced by commit(), UniMountGen::commit(), UniConfGen::delta(), UniClientGen::deltacb(), exists(), get(), haschildren(), UniConfGen::haschildren(), mountgen(), UniMountGen::mountgen(), refresh(), UniMountGen::refresh(), UniIniGen::refresh(), UniMountTreeGen::KeyIter::rewind(), UniTempGen::set(), UniClientGen::set(), unmount(), UniMountGen::unmount(), and whichmount().

bool UniMountTreeGen::ismountpoint const UniConfKey key  )  [virtual]
 

Determines if a key is a mountpoint.

Definition at line 218 of file unimounttreegen.cc.

References UniConfTree< UniMountTree >::find(), UniMountTree::generators, and ismountpoint().

Referenced by ismountpoint().

bool UniConfGen::isok  )  [virtual, inherited]
 

Determines if the generator is usable and working properly.

The default implementation always returns true.

Reimplemented in UniClientGen, UniFilterGen, UniListGen, UniPStoreGen, and UniRegistryGen.

Definition at line 131 of file uniconfgen.cc.

Referenced by UniFilterGen::isok(), and trymount().

UniMountTreeGen::Iter * UniMountTreeGen::iterator const UniConfKey key  )  [virtual]
 

Returns an iterator over the children of the specified key.

Must not return NULL; consider returning a NullIter instead.

The caller takes ownership of the returned iterator and is responsible for deleting it when finished.

Implements UniConfGen.

Definition at line 225 of file unimounttreegen.cc.

References iterator().

Referenced by iterator().

UniConfGen * UniMountTreeGen::mount const UniConfKey key,
WvStringParm  moniker,
bool  refresh
[virtual]
 

Mounts a generator at a key using a moniker.

Returns the generator instance pointer, or NULL on failure.

Definition at line 137 of file unimounttreegen.cc.

References mount(), and mountgen().

Referenced by mount().

UniConfGen * UniMountTreeGen::mountgen const UniConfKey key,
UniConfGen gen,
bool  refresh
[virtual]
 

Mounts a generator at a key.

Takes ownership of the supplied generator instance.

"key" is the key "gen" is the generator instance "refresh" is if true, refreshes the generator after mount Returns: the generator instance pointer, or NULL on failure

Definition at line 148 of file unimounttreegen.cc.

References UniMountTree::findormake(), UniMountTree::generators, UniConfGen::hold_delta(), mountgen(), UniConfGen::refresh(), UniConfGen::setcallback(), UniConfGen::unhold_delta(), and UniConfGenCallback.

Referenced by mount(), and mountgen().

bool UniMountTreeGen::refresh  )  [virtual]
 

Refreshes information about a key recursively.

May discard uncommitted data.

The default implementation always returns true.

Reimplemented from UniConfGen.

Reimplemented in UniConfFileTreeGen.

Definition at line 111 of file unimounttreegen.cc.

References UniMountTree::generators, UniConfGen::hold_delta(), and UniConfGen::unhold_delta().

Referenced by UniConfFileTreeGen::refresh().

virtual unsigned int GenericComponent< IObject >::release  )  [inline, virtual, inherited]
 

Implements IObject.

Definition at line 70 of file wvxplc.h.

void UniMountTreeGen::set const UniConfKey key,
WvStringParm  value
[virtual]
 

Stores a string value for a key into the registry.

If the value is WvString::null, the key is deleted.

Returns true on success.

Implements UniConfGen.

Definition at line 52 of file unimounttreegen.cc.

References UniConfGen::set(), set(), whichmount(), and WvStringParm.

Referenced by set().

void UniConfGen::setcallback const UniConfGenCallback callback,
void *  userdata
[inherited]
 

Sets the callback for change notification.

Must not be reimplemented by subclasses.

Definition at line 137 of file uniconfgen.cc.

References UniConfGen::setcallback().

Referenced by mountgen(), UniMountGen::mountgen(), UniConfGen::setcallback(), UniFilterGen::setinner(), UniCacheGen::UniCacheGen(), UniConfRoot::UniConfRoot(), unmount(), UniMountGen::unmount(), and UniConfRoot::~UniConfRoot().

void UniConfGen::seterror WvStringParm  error  )  [inline, protected, inherited]
 

Raises an error condition.

Definition at line 57 of file uniconfgen.h.

References UniConfGen::seterror().

Referenced by UniConfGen::seterror().

int UniConfGen::str2int WvStringParm  s,
int  defvalue
const [virtual, inherited]
 

Converts a string to an integer.

If the string is null or not recognized, return defvalue.

This is here to support the common str2int(get(key)).

The default implementation recognizes the booleans 'true', 'yes', 'on' and 'enabled' as 1, and 'false', 'no', 'off' and 'disabled' as 0.

Definition at line 105 of file uniconfgen.cc.

References WvFastString::cstr(), WvFastString::isnull(), and UniConfGen::str2int().

Referenced by UniConfGen::str2int().

void UniConfGen::unhold_delta  )  [inherited]
 

Resumes notifications when each hold_delta() has been matched.

On resumption, dispatches all pending notifications except those that were destined to watches that were removed.

Use this to safeguard non-reentrant code.

Definition at line 29 of file uniconfgen.cc.

References UniConfGen::flush_delta().

Referenced by commit(), UniMountGen::commit(), UniConfGen::delta(), UniClientGen::deltacb(), exists(), get(), haschildren(), UniConfGen::haschildren(), mountgen(), UniMountGen::mountgen(), refresh(), UniMountGen::refresh(), UniIniGen::refresh(), UniMountTreeGen::KeyIter::rewind(), UniTempGen::set(), UniClientGen::set(), unmount(), UniMountGen::unmount(), and whichmount().

void UniMountTreeGen::unmount const UniConfKey key,
UniConfGen gen,
bool  commit
[virtual]
 

Unmounts the generator at a key and destroys it.

"key" is the key "gen" is the generator instance "commit" is if true, commits the generator before unmount

Definition at line 166 of file unimounttreegen.cc.

References UniConfGen::commit(), UniConfTree< UniMountTree >::find(), UniMountTree::generators, UniConfGen::hold_delta(), UniConfGen::setcallback(), UniConfGen::unhold_delta(), UniConfGenCallback, and unmount().

Referenced by unmount().

UniConfGen * UniMountTreeGen::whichmount const UniConfKey key,
UniConfKey mountpoint
[virtual]
 

Finds the generator that owns a key.

If the key exists, returns the generator that provides its contents. Otherwise returns the generator that would be updated if a value were set.

"key" is the key "mountpoint" is if not NULL, replaced with the mountpoint path on success Returns: the handle, or a null handle if none

Definition at line 189 of file unimounttreegen.cc.

References UniConfGen::exists(), UniConfGen::hold_delta(), UniMountTree::GenIter::next(), UniMountTree::GenIter::ptr(), UniMountTree::GenIter::rewind(), UniMountTree::GenIter::tail(), UniConfGen::unhold_delta(), and whichmount().

Referenced by set(), and whichmount().


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 01:09:33 2004 for WvStreams by doxygen 1.3.7