ctkServiceReference Class Reference

#include <Libs/PluginFramework/ctkServiceReference.h>

List of all members.

Public Member Functions

ctkPlugingetPlugin () const
QVariant getProperty (const QString &key) const
QStringList getPropertyKeys () const
QList< ctkPlugin * > getUsingPlugins () const
bool operator< (const ctkServiceReference &reference) const
bool operator== (const ctkServiceReference &reference) const
 ~ctkServiceReference ()

Protected Member Functions

 ctkServiceReference (ctkServiceRegistrationPrivate *reg)

Protected Attributes

ctkServiceReferencePrivate *const d_ptr

Friends

class ctkPluginContext
class ctkServiceRegistrationPrivate

Detailed Description

A reference to a service.

The Framework returns ctkServiceReference objects from the ctkPluginContext::getServiceReference and ctkPluginContext::getServiceReferences methods.

A ctkServiceReference object may be shared between plugins and can be used to examine the properties of the service and to get the service object.

Every service registered in the Framework has a unique ctkServiceRegistration object and may have multiple, distinct ctkServiceReference objects referring to it. ctkServiceReference objects associated with a ctkServiceRegistration are considered equal (more specifically, their operator==() method will return true when compared).

If the same service object is registered multiple times, ctkServiceReference objects associated with different ctkServiceRegistration objects are not equal.

See also:
ctkPluginContext::getServiceReference
ctkPluginContext::getServiceReferences
ctkPluginContext::getService

Definition at line 64 of file ctkServiceReference.h.


Constructor & Destructor Documentation

ctkServiceReference::~ctkServiceReference (  ) 

Definition at line 38 of file ctkServiceReference.cpp.

ctkServiceReference::ctkServiceReference ( ctkServiceRegistrationPrivate *  reg  )  [protected]

Definition at line 32 of file ctkServiceReference.cpp.


Member Function Documentation

ctkPlugin * ctkServiceReference::getPlugin (  )  const

Returns the plugin that registered the service referenced by this ctkServiceReference object.

This method must return 0 when the service has been unregistered. This can be used to determine if the service has been unregistered.

Returns:
The plugin that registered the service referenced by this ctkServiceReference object; 0 if that service has already been unregistered.
See also:
ctkPluginContext::registerService(const QStringList&, QObject* , const ServiceProperties&)

Definition at line 61 of file ctkServiceReference.cpp.

QVariant ctkServiceReference::getProperty ( const QString &  key  )  const

Returns the property value to which the specified property key is mapped in the properties ServiceProperties object of the service referenced by this ctkServiceReference object.

Property keys are case-insensitive.

This method must continue to return property values after the service has been unregistered. This is so references to unregistered services can still be interrogated.

Parameters:
key The property key.
Returns:
The property value to which the key is mapped; an invalid QVariant if there is no property named after the key.

Definition at line 43 of file ctkServiceReference.cpp.

QStringList ctkServiceReference::getPropertyKeys (  )  const

Returns a list of the keys in the ServiceProperties object of the service referenced by this ctkServiceReference object.

This method will continue to return the keys after the service has been unregistered. This is so references to unregistered services can still be interrogated.

This method is not case-preserving; this means that every key in the returned array is in lower case, which may not be the case for the corresponding key in the properties ServiceProperties that was passed to the ctkPluginContext::registerService(const QStringList&, QObject*, const ServiceProperties&) or ctkServiceRegistration::setProperties methods.

Returns:
A list of property keys.

Definition at line 52 of file ctkServiceReference.cpp.

QList< ctkPlugin * > ctkServiceReference::getUsingPlugins (  )  const

Returns the plugins that are using the service referenced by this ctkServiceReference object. Specifically, this method returns the plugins whose usage count for that service is greater than zero.

Returns:
A list of plugins whose usage count for the service referenced by this ctkServiceReference object is greater than zero.

Definition at line 66 of file ctkServiceReference.cpp.

bool ctkServiceReference::operator< ( const ctkServiceReference reference  )  const

Compares this ctkServiceReference with the specified ctkServiceReference for order.

If this ctkServiceReference and the specified ctkServiceReference have the same service id they are equal. This ctkServiceReference is less than the specified ctkServiceReference if it has a lower service ranking and greater if it has a higher service ranking. Otherwise, if this ctkServiceReference and the specified ctkServiceReference have the same service ranking, this ctkServiceReference is less than the specified ctkServiceReference if it has a higher service id and greater if it has a lower service id.

Parameters:
reference The ctkServiceReference to be compared.
Returns:
Returns a false or true if this ctkServiceReference is less than or greater than the specified ctkServiceReference.
Exceptions:
std::invalid_argument If the specified ctkServiceReference was not created by the same framework instance as this ctkServiceReference.

Definition at line 82 of file ctkServiceReference.cpp.

bool ctkServiceReference::operator== ( const ctkServiceReference reference  )  const

Definition at line 111 of file ctkServiceReference.cpp.


Friends And Related Function Documentation

friend class ctkPluginContext [friend]

Definition at line 173 of file ctkServiceReference.h.

friend class ctkServiceRegistrationPrivate [friend]

Definition at line 172 of file ctkServiceReference.h.


Member Data Documentation

ctkServiceReferencePrivate* const ctkServiceReference::d_ptr [protected]

Definition at line 177 of file ctkServiceReference.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1