34template <
typename TService>
62 if (registry->acquire_related(
name, related_service, &
m_service)) {
80 other.m_service =
nullptr;
89 operator TService *()
const {
90 return reinterpret_cast<TService *
>(
m_service);
98 TService *
operator->()
const {
return static_cast<TService *
>(*this); }
106 return static_cast<const my_h_service_imp *
>(this->
m_service) !=
nullptr;
117 TService *save =
reinterpret_cast<TService *
>(
m_service);
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
my_service(const char *name, const mysql_service_registry_t *registry)
Acquires service by name.
Definition: my_service.h:45
my_service(my_h_service service, const mysql_service_registry_t *registry)
Wraps service implementation already acquired.
Definition: my_service.h:73
my_h_service m_service
Definition: my_service.h:123
bool is_valid() const
Definition: my_service.h:104
TService * untie()
Unties and returns the underlying service handle.
Definition: my_service.h:116
~my_service()
Definition: my_service.h:83
TService * operator->() const
Returns managed service typed as desired service type to execute operations specified after -> on it.
Definition: my_service.h:98
my_service(my_service< TService > &&other)
Definition: my_service.h:78
my_service(const char *name, my_h_service related_service, const mysql_service_registry_t *registry)
Acquires service by name.
Definition: my_service.h:59
my_service(const my_service< TService > &other)=delete
const mysql_service_registry_t * m_registry
Definition: my_service.h:124
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
case opt name
Definition: sslopt-case.h:29
mysql_service_status_t(* release)(my_h_service service)
Releases the Service Implementation previously acquired.
Definition: registry.h:88