MySQL 8.3.0
Source Code Documentation
service.h File Reference

Go to the source code of this file.

Macros

#define SERVICE_TYPE_NO_CONST(name)   mysql_service_##name##_t
 Generates the standard Service type name. More...
 
#define SERVICE_TYPE(name)   const SERVICE_TYPE_NO_CONST(name)
 Generates the standard Service type name. More...
 
#define BEGIN_SERVICE_DEFINITION(name)   typedef struct s_mysql_##name {
 Declares a new Service. More...
 
#define END_SERVICE_DEFINITION(name)
 A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro. More...
 
#define DECLARE_METHOD(retval, name, args)   retval(*name) args
 Declares a method as a part of the Service definition. More...
 
#define DECLARE_BOOL_METHOD(name, args)    DECLARE_METHOD(mysql_service_status_t, name, args)
 Declares a method that returns bool as a part of the Service definition. More...
 
#define DEFINE_SERVICE_HANDLE(name)   typedef struct name##_imp *name
 Defines an object type that is meant for carrying handles to the implementation-specific objects used in the Service interface, but without their structure exposed, keeping it as an abstraction. More...
 

Typedefs

typedef int mysql_service_status_t
 Specific type for the service status return values. More...
 

Macro Definition Documentation

◆ BEGIN_SERVICE_DEFINITION

#define BEGIN_SERVICE_DEFINITION (   name)    typedef struct s_mysql_##name {

Declares a new Service.

It creates a structure for pointers to Service methods. A list of methods defined using DECLARE_METHOD and DECLARE_BOOL_METHOD macros must follow this macro, with a closing END_SERVICE_DEFINITION macro usage.

Parameters
nameService name, must be a valid C name.

◆ DECLARE_BOOL_METHOD

#define DECLARE_BOOL_METHOD (   name,
  args 
)     DECLARE_METHOD(mysql_service_status_t, name, args)

Declares a method that returns bool as a part of the Service definition.

To be used within the SERVICE_DEFINITION macro.

Parameters
nameName of the method, must be a valid C name.
argsThe list of arguments of the method taken in parentheses.

◆ DECLARE_METHOD

#define DECLARE_METHOD (   retval,
  name,
  args 
)    retval(*name) args

Declares a method as a part of the Service definition.

To be used within the SERVICE_DEFINITION macro.

Parameters
retvalType of the return value for the method declaration. Should be a simple type or structure, not a C++ object with undefined ABI.
nameName of the method, must be a valid C name.
argsThe list of arguments of the method taken in parentheses.

◆ DEFINE_SERVICE_HANDLE

#define DEFINE_SERVICE_HANDLE (   name)    typedef struct name##_imp *name

Defines an object type that is meant for carrying handles to the implementation-specific objects used in the Service interface, but without their structure exposed, keeping it as an abstraction.

This follows a Opaque Pointer design pattern, see more: https://en.wikipedia.org/wiki/Opaque_pointer If you would like to have a C++ RAII class to manage the resource with additional methods to call raw service calls, please create your class {handle_name} instead of following macro. Please make sure it does not use any virtual methods to keep binary compatibility, and try use only one member, the d-pointer to hide all implementation details and keep headers unmodified from the point of publishing it.

Parameters
nameHandle name, must be a valid C name.

◆ END_SERVICE_DEFINITION

#define END_SERVICE_DEFINITION (   name)
Value:
} \
SERVICE_TYPE_NO_CONST(name);
case opt name
Definition: sslopt-case.h:32

A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.

◆ SERVICE_TYPE

#define SERVICE_TYPE (   name)    const SERVICE_TYPE_NO_CONST(name)

Generates the standard Service type name.

◆ SERVICE_TYPE_NO_CONST

#define SERVICE_TYPE_NO_CONST (   name)    mysql_service_##name##_t

Generates the standard Service type name.

It does not have const specifier, it should be used only when really necessary.

Typedef Documentation

◆ mysql_service_status_t

Specific type for the service status return values.

0 is false, non-zero is true. Corresponds to C++ bool.

See also
DEFINE_BOOL_METHOD, DECLARE_BOOL_METHOD