CppMicroServices

C++ Micro Services: ServiceRegistration< I1, Interfaces > Class Template Reference
ServiceRegistration< I1, Interfaces > Class Template Reference

A registered service. More...

Inheritance diagram for ServiceRegistration< I1, Interfaces >:
Collaboration diagram for ServiceRegistration< I1, Interfaces >:

Public Member Functions

 ServiceRegistration ()
 Creates an invalid ServiceRegistration object. More...
 
template<class Interface >
ServiceReference< Interface > GetReference () const
 Returns a ServiceReference object for a service being registered. More...
 
ServiceReference< I1 > GetReference () const
 Returns a ServiceReference object for a service being registered. More...
 
- Public Member Functions inherited from ServiceRegistrationBase
 ServiceRegistrationBase (const ServiceRegistrationBase &reg)
 
 operator bool_type () const
 A boolean conversion operator converting this ServiceRegistrationBase object to true if it is valid and to false otherwise. More...
 
ServiceRegistrationBaseoperator= (std::nullptr_t)
 Releases any resources held or locked by this ServiceRegistrationBase and renders it invalid. More...
 
 ~ServiceRegistrationBase ()
 
ServiceReferenceBase GetReference (const std::string &interfaceId=std::string()) const
 Returns a ServiceReference object for a service being registered. More...
 
void SetProperties (const ServiceProperties &properties)
 Updates the properties associated with a service. More...
 
void Unregister ()
 Unregisters a service. More...
 
bool operator< (const ServiceRegistrationBase &o) const
 Compare two ServiceRegistrationBase objects. More...
 
bool operator== (const ServiceRegistrationBase &registration) const
 
ServiceRegistrationBaseoperator= (const ServiceRegistrationBase &registration)
 

Detailed Description

template<class I1, class... Interfaces>
class ServiceRegistration< I1, Interfaces >

A registered service.

The framework returns a ServiceRegistration object when a ModuleContext::RegisterService() method invocation is successful. The ServiceRegistration object is for the private use of the registering module and should not be shared with other modules.

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

Template Parameters
SClass tyoe of the service interface
See also
ModuleContext::RegisterService()
Remarks
This class is thread safe.

Constructor & Destructor Documentation

template<class I1, class... Interfaces>
ServiceRegistration< I1, Interfaces >::ServiceRegistration ( )
inline

Creates an invalid ServiceRegistration object.

You can use this object in boolean expressions and it will evaluate to false.

Member Function Documentation

template<class I1, class... Interfaces>
template<class Interface >
ServiceReference<Interface> ServiceRegistration< I1, Interfaces >::GetReference ( ) const
inline

Returns a ServiceReference object for a service being registered.

The ServiceReference object may be shared with other modules.

Exceptions
std::logic_errorIf this ServiceRegistration object has already been unregistered or if it is invalid.
Returns
ServiceReference object.

References ServiceRegistrationBase::GetReference().

template<class I1, class... Interfaces>
ServiceReference<I1> ServiceRegistration< I1, Interfaces >::GetReference ( ) const
inline

Returns a ServiceReference object for a service being registered.

The ServiceReference object refers to the first interface type and may be shared with other modules.

Exceptions
std::logic_errorIf this ServiceRegistration object has already been unregistered or if it is invalid.
Returns
ServiceReference object.

References ServiceRegistrationBase::GetReference().