MySQL 8.4.0
Source Code Documentation
service_implementation.h File Reference

Specifies macros to define Service Implementations. More...

#include "service.h"

Go to the source code of this file.

Macros

#define SERVICE_IMPLEMENTATION(component, service)   imp_##component##_##service
 Reference to the name of the service implementation variable. More...
 
#define BEGIN_SERVICE_IMPLEMENTATION(component, service)    SERVICE_TYPE(service) SERVICE_IMPLEMENTATION(component, service) = {
 Declares a Service Implementation. More...
 
#define END_SERVICE_IMPLEMENTATION()   }
 A macro to end the last declaration of a Service Implementation. More...
 
#define DEFINE_METHOD(retval, name, args)   retval name args noexcept
 A macro to ensure method implementation has required properties, that is it does not throw exceptions and is static. More...
 
#define DEFINE_BOOL_METHOD(name, args)    DEFINE_METHOD(mysql_service_status_t, name, args)
 A short macro to define method that returns bool, which is the most common case. More...
 

Detailed Description

Specifies macros to define Service Implementations.

Macro Definition Documentation

◆ BEGIN_SERVICE_IMPLEMENTATION

#define BEGIN_SERVICE_IMPLEMENTATION (   component,
  service 
)     SERVICE_TYPE(service) SERVICE_IMPLEMENTATION(component, service) = {

Declares a Service Implementation.

It builds standard implementation info structure. Only a series of pointers to methods the Service Implementation implements as respective Service methods are expected to be used after this macro and before the END_SERVICE_IMPLEMENTATION counterpart.

Parameters
componentName of the Component to create implementation in.
serviceName of the Service to create implementation for.

◆ DEFINE_BOOL_METHOD

#define DEFINE_BOOL_METHOD (   name,
  args 
)     DEFINE_METHOD(mysql_service_status_t, name, args)

A short macro to define method that returns bool, which is the most common case.

Parameters
nameMethod name.
argsa list of arguments in parenthesis.

◆ DEFINE_METHOD

#define DEFINE_METHOD (   retval,
  name,
  args 
)    retval name args noexcept

A macro to ensure method implementation has required properties, that is it does not throw exceptions and is static.

This macro should be used with exactly the same arguments as DECLARE_METHOD.

Parameters
retvalType of return value. It cannot contain comma characters, but as only simple structures are possible, this shouldn't be a problem.
nameMethod name.
argsa list of arguments in parenthesis.

◆ END_SERVICE_IMPLEMENTATION

#define END_SERVICE_IMPLEMENTATION ( )    }

A macro to end the last declaration of a Service Implementation.

◆ SERVICE_IMPLEMENTATION

#define SERVICE_IMPLEMENTATION (   component,
  service 
)    imp_##component##_##service

Reference to the name of the service implementation variable.

BEGIN_SERVICE_IMPLEMENTATION defines a local variable of the structure type for the service (see SERVICE_TYPE). The variable is then used by the PROVIDES_SERVICE macro to construct the list of service provided by the component. This macro allows one to use BEGIN_SERVICE_IMPLEMENTATION , DEFINE_METHOD and END_SERVICE_IMPLEMENTATION macros to build a service definition structure and variable to be used outside of the component definition context.

Parameters
componentName of the implementation of the service. Usually a component name.
serviceName of the service to create the implementation for.