Public Member Functions | Protected Member Functions | Protected Attributes | Friends

ctkServiceRegistration Class Reference

#include <Libs/PluginFramework/ctkServiceRegistration.h>

Inheritance diagram for ctkServiceRegistration:
Inheritance graph
[legend]
Collaboration diagram for ctkServiceRegistration:
Collaboration graph
[legend]

List of all members.

Public Member Functions

ctkServiceReferencegetReference ()
bool operator< (const ctkServiceRegistration &o) const
void setProperties (const ServiceProperties &properties)
virtual void unregister ()

Protected Member Functions

 ctkServiceRegistration (ctkPluginPrivate *plugin, QObject *service, const ServiceProperties &props)
 ctkServiceRegistration (ctkServiceRegistrationPrivate &dd)

Protected Attributes

ctkServiceRegistrationPrivate
*const 
d_ptr

Friends

class ctkServices

Detailed Description

A registered service.

The Framework returns a ctkServiceRegistration object when a ctkPluginContext::registerService() method invocation is successful. The ctkServiceRegistration object is for the private use of the registering plugin and should not be shared with other plugins.

The ctkServiceRegistration object may be used to update the properties of the service or to unregister the service.

See also:
ctkPluginContext::registerService()

Definition at line 49 of file ctkServiceRegistration.h.


Constructor & Destructor Documentation

ctkServiceRegistration::ctkServiceRegistration ( ctkPluginPrivate plugin,
QObject *  service,
const ServiceProperties props 
) [protected]

Definition at line 33 of file ctkServiceRegistration.cpp.

ctkServiceRegistration::ctkServiceRegistration ( ctkServiceRegistrationPrivate dd  )  [protected]

Definition at line 40 of file ctkServiceRegistration.cpp.


Member Function Documentation

ctkServiceReference * ctkServiceRegistration::getReference (  ) 

Returns a ctkServiceReference object for a service being registered.

The ctkServiceReference object may be shared with other plugins.

Exceptions:
std::logic_error If this ctkServiceRegistration object has already been unregistered.
Returns:
ctkServiceReference object.

Definition at line 46 of file ctkServiceRegistration.cpp.

bool ctkServiceRegistration::operator< ( const ctkServiceRegistration o  )  const

Definition at line 157 of file ctkServiceRegistration.cpp.

void ctkServiceRegistration::setProperties ( const ServiceProperties properties  ) 

Updates the properties associated with a service.

The PluginConstants#OBJECTCLASS and PluginConstants#SERVICE_ID keys cannot be modified by this method. These values are set by the Framework when the service is registered in the environment.

The following steps are required to modify service properties:

  1. The service's properties are replaced with the provided properties.
  2. A service event of type ServiceEvent#MODIFIED is fired.
Parameters:
properties The properties for this service. See PluginConstants for a list of standard service property keys. Changes should not be made to this object after calling this method. To update the service's properties this method should be called again.
Exceptions:
std::logic_error If this ctkServiceRegistration object has already been unregistered.
std::invalid_argument If properties contains case variants of the same key name.

Definition at line 55 of file ctkServiceRegistration.cpp.

void ctkServiceRegistration::unregister (  )  [virtual]

Unregisters a service. Remove a ctkServiceRegistration object from the Framework service registry. All ctkServiceReference objects associated with this ctkServiceRegistration object can no longer be used to interact with the service once unregistration is complete.

The following steps are required to unregister a service:

  1. The service is removed from the Framework service registry so that it can no longer be obtained.
  2. A service event of type ServiceEvent#UNREGISTERING is fired so that plugins using this service can release their use of the service. Once delivery of the service event is complete, the ctkServiceReference objects for the service may no longer be used to get a service object for the service.
  3. For each plugin whose use count for this service is greater than zero:
    The plugin's use count for this service is set to zero.
    If the service was registered with a ctkServiceFactory object, the ctkServiceFactory::ungetService method is called to release the service object for the plugin.
Exceptions:
std::logic_error If this ctkServiceRegistration object has already been unregistered.
See also:
BundleContext::ungetService
ctkServiceFactory::ungetService

Definition at line 91 of file ctkServiceRegistration.cpp.


Friends And Related Function Documentation

friend class ctkServices [friend]

Definition at line 133 of file ctkServiceRegistration.h.


Member Data Documentation

Definition at line 140 of file ctkServiceRegistration.h.


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