Home · All Classes · All Functions ·

QAbstractValueSpaceLayer Class Reference

The QAbstractValueSpaceLayer class provides support for adding new logical data layers to the Qt Value Space. More...

    #include <QAbstractValueSpaceLayer>

Inherits QObject.


Public Types

typedef Handle
enum Properties { Publish }
enum Type { Server, Client }

Public Functions

virtual void addWatch ( QValueSpacePublisher * creator, Handle handle ) = 0
virtual QSet<QString> children ( Handle handle ) = 0
virtual QUuid id () = 0
virtual Handle item ( Handle parent, const QString & subPath ) = 0
virtual QValueSpace::LayerOptions layerOptions () const = 0
virtual QString name () = 0
virtual bool notifyInterest ( Handle handle, bool interested ) = 0
virtual unsigned int order () = 0
virtual void removeHandle ( Handle handle ) = 0
virtual bool removeSubTree ( QValueSpacePublisher * creator, Handle handle ) = 0
virtual bool removeValue ( QValueSpacePublisher * creator, Handle handle, const QString & subPath ) = 0
virtual void removeWatches ( QValueSpacePublisher * creator, Handle parent ) = 0
virtual void setProperty ( Handle handle, Properties property ) = 0
virtual bool setValue ( QValueSpacePublisher * creator, Handle handle, const QString & subPath, const QVariant & value ) = 0
virtual bool startup ( Type type ) = 0
virtual bool supportsInterestNotification () const = 0
virtual void sync () = 0
virtual bool value ( Handle handle, QVariant * data ) = 0
virtual bool value ( Handle handle, const QString & subPath, QVariant * data ) = 0

Signals

void handleChanged ( quintptr handle )

Protected Functions

void emitInterestChanged ( QValueSpacePublisher * publisher, const QString & path, bool interested )

Macros

QVALUESPACE_AUTO_INSTALL_LAYER ( className )

Additional Inherited Members


Detailed Description

The QAbstractValueSpaceLayer class provides support for adding new logical data layers to the Qt Value Space.

To create a new layer in the Value Space subclass this class and reimplement all of the virtual functions. The new layer is installed by either calling QValueSpace::installLayer() or by adding the QVALUESPACE_AUTO_INSTALL_LAYER() macro in your implementation file.


Member Type Documentation

typedef QAbstractValueSpaceLayer::Handle

The Handle type is an opaque, pointer sized contextual handle used to represent paths within Value Space layers. Handles are only ever created by QAbstractValueSpaceLayer::item() and are always released by calls to QAbstractValueSpaceLayer::removeHandle(). The special value, InvalidHandle is reserved to represent an invalid handle.

enum QAbstractValueSpaceLayer::Properties

To allow for efficient layer implementations, expensive handle operations, currently only monitoring for changes, are enabled and disabled as needed on a per-handle basis. The Properties enumeration is a bitmask representing the different properties that can exist on a handle.

ConstantValueDescription
QAbstractValueSpaceLayer::Publish0x00000001Enable change notification for the handle. When set, the layer should emit QAbstractValueSpaceLayer::handleChanged() signals when appropriate for the handle.

enum QAbstractValueSpaceLayer::Type

Value Space layers are initialized in either a "Server" or a "Client" context. There is only a single server in the Value Space architecture, and its layers are always initialized before any clients. This distinction allows layers to implement Client/Server architecture if required. If not, layers are free to treat Server and Client contexts identically.

ConstantValueDescription
QAbstractValueSpaceLayer::Server0The layer is being initialized in the "server" context.
QAbstractValueSpaceLayer::Client1The layer is being initialized in the "client" context.


Member Function Documentation

void QAbstractValueSpaceLayer::addWatch ( QValueSpacePublisher * creator, Handle handle )   [pure virtual]

Registers creator for change notifications to values under handle.

See also removeWatches().

QSet<QString> QAbstractValueSpaceLayer::children ( Handle handle )   [pure virtual]

Returns the set of children of handle. For example, in a layer providing the following items:

    /Device/Configuration/Applications/FocusedApplication
    /Device/Configuration/Buttons/PrimaryInput
    /Device/Configuration/Name

a request for children of "/Device/Configuration" will return { "Applications", "Buttons", "Name" }.

void QAbstractValueSpaceLayer::emitInterestChanged ( QValueSpacePublisher * publisher, const QString & path, bool interested )   [protected]

Emits the QValueSpacePublisher::interestChanged() signal on publisher with path and interested.

void QAbstractValueSpaceLayer::handleChanged ( quintptr handle )   [signal]

Emitted whenever the handle's value, or any sub value, changes.

QUuid QAbstractValueSpaceLayer::id ()   [pure virtual]

Returns a globally unique identifier for the layer. This id is used to break ordering ties.

Handle QAbstractValueSpaceLayer::item ( Handle parent, const QString & subPath )   [pure virtual]

Returns a new opaque handle for the requested subPath of parent. If parent is an InvalidHandle, subPath is interpreted as an absolute path.

The caller should call removeHandle() to free resources used by the handle when it is no longer required.

QValueSpace::LayerOptions QAbstractValueSpaceLayer::layerOptions () const   [pure virtual]

Returns the QValueSpace::LayerOptions describing this layer.

See also QValueSpace::LayerOption.

QString QAbstractValueSpaceLayer::name ()   [pure virtual]

Returns the name of the Value Space layer. This name is only used for diagnostics purposes.

bool QAbstractValueSpaceLayer::notifyInterest ( Handle handle, bool interested )   [pure virtual]

Registers or unregisters that the caller is interested in handle and any subpaths under it. If interested is true interest in handle is registered; otherwise it is unregistered.

The caller should ensure that all calls to this function with interested set to true have a matching call with interested set to false.

Returns true if the notification was successfully sent; otherwise returns false.

unsigned int QAbstractValueSpaceLayer::order ()   [pure virtual]

Return the position in the Value Space layer stack that this layer should reside. Higher numbers mean the layer has a higher precedence and its values will "shadow" those below it. If two layers specify the same ordering, the id() value is used to break the tie.

void QAbstractValueSpaceLayer::removeHandle ( Handle handle )   [pure virtual]

Releases a handle previously returned from QAbstractValueSpaceLayer::item().

bool QAbstractValueSpaceLayer::removeSubTree ( QValueSpacePublisher * creator, Handle handle )   [pure virtual]

Process calls to QValueSpacePublisher::~QValueSpacePublisher() by removing the entire sub tree created by creator under handle.

Returns true on success; otherwise returns false.

bool QAbstractValueSpaceLayer::removeValue ( QValueSpacePublisher * creator, Handle handle, const QString & subPath )   [pure virtual]

Process calls to QValueSpacePublisher::resetValue() by removing the Value Space item identified by handle and subPath and created by creator.

Returns true on success; otherwise returns false.

void QAbstractValueSpaceLayer::removeWatches ( QValueSpacePublisher * creator, Handle parent )   [pure virtual]

Removes all registered change notifications for creator under parent.

See also addWatch().

void QAbstractValueSpaceLayer::setProperty ( Handle handle, Properties property )   [pure virtual]

Apply the specified property mask to handle.

bool QAbstractValueSpaceLayer::setValue ( QValueSpacePublisher * creator, Handle handle, const QString & subPath, const QVariant & value )   [pure virtual]

Process calls to QValueSpacePublisher::setValue() by setting the value specified by the subPath under handle to value. Ownership of the Value Space item is assigned to creator.

Returns true on success; otherwise returns false.

See also value().

bool QAbstractValueSpaceLayer::startup ( Type type )   [pure virtual]

Called by the Value Space system to initialize each layer. The type parameter will be set accordingly, and layer implementors can use this to implement a client/server architecture if desired.

Returns true upon success; otherwise returns false.

bool QAbstractValueSpaceLayer::supportsInterestNotification () const   [pure virtual]

Returns true if the layer supports interest notifications; otherwise returns false.

void QAbstractValueSpaceLayer::sync ()   [pure virtual]

Flushes all pending changes made by calls to setValue(), removeValue() and removeSubTree().

bool QAbstractValueSpaceLayer::value ( Handle handle, QVariant * data )   [pure virtual]

Returns the value for a particular handle. If a value is available, the layer will set data and return true. If no value is available, false is returned.

See also setValue().

bool QAbstractValueSpaceLayer::value ( Handle handle, const QString & subPath, QVariant * data )   [pure virtual]

Returns the value for a particular subPath of handle. If a value is available, the layer will set data and return true. If no value is available, false is returned.


Macro Documentation

QVALUESPACE_AUTO_INSTALL_LAYER ( className )

This macro installs new Value Space layer. className is the name of the class implementing the new layer.

The method className *className::instance() must exist and return a pointer to an instance of the layer to install. This method will only be invoked after QApplication has been constructed, making it safe to use any Qt class in your layer's constructor.

This macro can only be used once for any given class and it should be used where the implementation is written rather than in a header file.


Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.2