CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ctkServiceRegistration Class Reference

#include <Libs/PluginFramework/ctkServiceRegistration.h>

Public Member Functions

 ctkServiceRegistration ()
 
 ctkServiceRegistration (const ctkServiceRegistration &reg)
 
ctkServiceReference getReference () const
 
 operator bool () const
 
bool operator< (const ctkServiceRegistration &o) const
 
ctkServiceRegistrationoperator= (const ctkServiceRegistration &registration)
 
ctkServiceRegistrationoperator= (int null)
 
bool operator== (const ctkServiceRegistration &registration) const
 
void setProperties (const ctkDictionary &properties)
 
void unregister ()
 
 ~ctkServiceRegistration ()
 

Protected Member Functions

 ctkServiceRegistration (ctkPluginPrivate *plugin, QObject *service, const ctkDictionary &props)
 
 ctkServiceRegistration (ctkServiceRegistrationPrivate *registrationPrivate)
 

Protected Attributes

ctkServiceRegistrationPrivate * d_ptr
 

Friends

class ctkServiceReferencePrivate
 
class ctkServices
 
uint CTK_PLUGINFW_EXPORT qHash (const ctkServiceRegistration &)
 

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()
Remarks
This class is thread safe.

Definition at line 50 of file ctkServiceRegistration.h.

Constructor & Destructor Documentation

◆ ctkServiceRegistration() [1/4]

ctkServiceRegistration::ctkServiceRegistration ( )

Creates an invalid ctkServiceRegistration object. You can use this object in boolean expressions and it will evaluate to false.

◆ ctkServiceRegistration() [2/4]

ctkServiceRegistration::ctkServiceRegistration ( const ctkServiceRegistration reg)

◆ ~ctkServiceRegistration()

ctkServiceRegistration::~ctkServiceRegistration ( )

◆ ctkServiceRegistration() [3/4]

ctkServiceRegistration::ctkServiceRegistration ( ctkServiceRegistrationPrivate *  registrationPrivate)
protected

◆ ctkServiceRegistration() [4/4]

ctkServiceRegistration::ctkServiceRegistration ( ctkPluginPrivate *  plugin,
QObject *  service,
const ctkDictionary props 
)
protected

Member Function Documentation

◆ getReference()

ctkServiceReference ctkServiceRegistration::getReference ( ) const

Returns a ctkServiceReference object for a service being registered.

The ctkServiceReference object may be shared with other plugins.

Exceptions
ctkIllegalStateExceptionIf this ctkServiceRegistration object has already been unregistered or if it is invalid.
Returns
ctkServiceReference object.

◆ operator bool()

ctkServiceRegistration::operator bool ( ) const

◆ operator<()

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

◆ operator=() [1/2]

ctkServiceRegistration& ctkServiceRegistration::operator= ( const ctkServiceRegistration registration)

◆ operator=() [2/2]

ctkServiceRegistration& ctkServiceRegistration::operator= ( int  null)

Releases any resources held or locked by this ctkServiceRegistration and renders it invalid.

◆ operator==()

bool ctkServiceRegistration::operator== ( const ctkServiceRegistration registration) const

◆ setProperties()

void ctkServiceRegistration::setProperties ( const ctkDictionary properties)

Updates the properties associated with a service.

The ctkPluginConstants#OBJECTCLASS and ctkPluginConstants#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 ctkServiceEvent#MODIFIED is fired.
Parameters
propertiesThe properties for this service. See ctkPluginConstants 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
ctkIllegalStateExceptionIf this ctkServiceRegistration object has already been unregistered or if it is invalid.
ctkInvalidArgumentExceptionIf properties contains case variants of the same key name.

◆ unregister()

void ctkServiceRegistration::unregister ( )

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 ctkServiceEvent#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
ctkIllegalStateExceptionIf this ctkServiceRegistration object has already been unregistered or if it is invalid.
See also
ctkPluginContext::ungetService
ctkServiceFactory::ungetService

Friends And Related Function Documentation

◆ ctkServiceReferencePrivate

friend class ctkServiceReferencePrivate
friend

Definition at line 157 of file ctkServiceRegistration.h.

◆ ctkServices

friend class ctkServices
friend

Definition at line 156 of file ctkServiceRegistration.h.

◆ qHash

uint CTK_PLUGINFW_EXPORT qHash ( const ctkServiceRegistration )
friend

Member Data Documentation

◆ d_ptr

ctkServiceRegistrationPrivate* ctkServiceRegistration::d_ptr
protected

Definition at line 166 of file ctkServiceRegistration.h.


The documentation for this class was generated from the following file: