Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

UniMountTreeGen Class Reference

#include <unimounttreegen.h>

Inheritance diagram for UniMountTreeGen:

Inheritance graph
[legend]
List of all members.

Detailed Description

The UniMountTree implementation realized as a UniConfGen.


Public Member Functions

 UniMountTreeGen ()
 Creates an empty UniConf tree with no mounted stores.
 ~UniMountTreeGen ()
 Destroys the UniConf tree along with all uncommitted data.
virtual IUniConfGenmount (const UniConfKey &key, WvStringParm moniker, bool refresh)
 Mounts a generator at a key using a moniker.
virtual IUniConfGenmountgen (const UniConfKey &key, IUniConfGen *gen, bool refresh)
 Mounts a generator at a key.
virtual void unmount (const UniConfKey &key, IUniConfGen *gen, bool commit)
 Unmounts the generator at a key and destroys it.
virtual IUniConfGenwhichmount (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 void prefetch (const UniConfKey &key, bool recursive)
 Indicate that we will eventually be interested in doing get(), haschildren(), or other "get-like" operations on a particular key or tree of keys.
virtual int str2int (WvStringParm s, int defvalue) const
 Converts a string to an integer.
virtual void flush_buffers ()=0
 Flushes any commitment/notification buffers .
virtual Iter * recursiveiterator (const UniConfKey &key)
 Like iterator(), but the returned iterator is recursive, that is, it will return children of the immediate children, not just the immediate children themselves.
virtual unsigned int addRef ()=0
 Indicate you are using this object.
virtual unsigned int release ()=0
 Indicate that you are finished using this object.
virtual IObjectgetInterface (const UUID &)=0
 Returns the requested XPLC interface.
virtual IWeakRefgetWeakRef ()=0
 Return a weak reference to this object.

Friends

class KeyIter

Classes

class  KeyIter
 An iterator over the keys in a tree of mounted generators. More...


Member Function Documentation

IUniConfGen * 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.

IUniConfGen * UniMountTreeGen::mountgen const UniConfKey key,
IUniConfGen 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

void UniMountTreeGen::unmount const UniConfKey key,
IUniConfGen 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

IUniConfGen * 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

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.

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.

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 has .isnull() == true.

Implements UniConfGen.

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.

bool UniMountTreeGen::refresh  )  [virtual]
 

Refreshes information about a key recursively.

May discard uncommitted data.

The default implementation always returns true.

Reimplemented from UniConfGen.

void UniMountTreeGen::commit  )  [virtual]
 

Commits any changes.

The default implementation does nothing.

Reimplemented from UniConfGen.

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

Returns an iterator over the children of the specified key.

May return NULL or an empty iterator if the key has no children.

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

Implements UniConfGen.

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

Sets the callback for change notification.

Must not be reimplemented by subclasses.

Implements IUniConfGen.

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.

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.

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.

void UniConfGen::clear_delta  )  [inherited]
 

Clears the list of pending notifications without sending them.

Does not affect the hold nesting count.

void UniConfGen::flush_delta  )  [inherited]
 

Flushes the list of pending notifications by sending them.

Does not affect the hold nesting count.

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.

bool UniConfGen::isok  )  [virtual, inherited]
 

Determines if the generator is usable and working properly.

The default implementation always returns true.

Implements IUniConfGen.

Reimplemented in UniCacheGen, UniClientGen, UniFilterGen, UniPStoreGen, UniRegistryGen, UniReplicateGen, UniRetryGen, and UniUnwrapGen.

virtual void UniConfGen::prefetch const UniConfKey key,
bool  recursive
[inline, virtual, inherited]
 

Indicate that we will eventually be interested in doing get(), haschildren(), or other "get-like" operations on a particular key or tree of keys.

The generator may be able to speed up these operations by, say, caching them in advance.

This function is not allowed to do blocking operations. It is allowed to do nothing at all, however, and then get() might block later.

Implements IUniConfGen.

Reimplemented in UniFilterGen, UniRetryGen, and UniUnwrapGen.

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.

Implements IUniConfGen.

virtual void UniConfGen::flush_buffers  )  [pure virtual, inherited]
 

Flushes any commitment/notification buffers .

The default implementation always returns true. NOTE: This method should be 'protected'

Implements IUniConfGen.

Implemented in UniClientGen, UniFilterGen, UniMountGen, UniNullGen, UniPermGen, UniReadOnlyGen, UniReplicateGen, UniRetryGen, UniSecureGen, UniSlowGen, UniTempGen, and UniUnwrapGen.

UniConfGen::Iter * UniConfGen::recursiveiterator const UniConfKey key  )  [virtual, inherited]
 

Like iterator(), but the returned iterator is recursive, that is, it will return children of the immediate children, not just the immediate children themselves.

May return NULL if the key has no immediate children (since that means there are also no indirect children).

Note that UniConfGen::recursiveiterator() is a default implementation that just calls iterator() recursively, so it'll work in any derived class without you overriding this function. However, you might want to do it anyway if it would be more efficient in your particular case.

Implements IUniConfGen.

Reimplemented in UniClientGen, UniFilterGen, UniMountGen, UniRetryGen, UniSecureGen, UniSlowGen, and UniUnwrapGen.

virtual unsigned int IObject::addRef  )  [pure virtual, inherited]
 

Indicate you are using this object.

This increases the reference count of the object by one. Usually, when the reference count reaches zero, the object is freed automatically.

This called a "strong reference", because they will prevent the object from being destroyed. They should thus be used carefully, as they control the lifetime of the object. For example, you do not need to call addRef() on object passed as parameters, unless you intend on keeping them.

addRef() is often called automatically for you in XPLC, but you'll have to call release() by hand sometimes unless you use xplc_ptr.

virtual unsigned int IObject::release  )  [pure virtual, inherited]
 

Indicate that you are finished using this object.

This decreases the reference count of the object by one. Usually, when the reference count reaches zero, the object is freed automatically.

You will usually need to manually release() any object given to you by any other XPLC function, unless you give the object to someone else who will call release.

If you use xplc_ptr, it will do this for you.

virtual IObject* IObject::getInterface const UUID  )  [pure virtual, inherited]
 

Returns the requested XPLC interface.

Will return NULL if the interface is not supported. The returned interface has been addRef()ed, so you will need to release() it when done. Note that the interface returned may be a pointer to the same object or a different one - that's none of your business. Asking for the IObject interface should always return the same pointer for a given logical object, so this can be used for comparison by identity.

You should probably use the convenient mutate() and get() functions instead of this, or use an xplc_ptr, which mutates the object for you.

virtual IWeakRef* IObject::getWeakRef  )  [pure virtual, inherited]
 

Return a weak reference to this object.

A weak reference points at the object, but does not control the lifetime of the object. An object can thus still be deleted while someone holds a weak reference. You will still need to release() the weak reference when you are done with it.

See also:
IWeakRef


The documentation for this class was generated from the following files:
Generated on Sun Jul 10 15:35:47 2005 for WvStreams by  doxygen 1.4.0