MySQL  8.0.17
Source Code Documentation
service.h File Reference

Go to the source code of this file.

Macros

#define SERVICE_H
 
#define SERVICE_TYPE_NO_CONST(name)   mysql_service_##name##_t
 
#define SERVICE_TYPE(name)   const SERVICE_TYPE_NO_CONST(name)
 
#define BEGIN_SERVICE_DEFINITION(name)   typedef struct s_mysql_##name {
 
#define END_SERVICE_DEFINITION(name)
 
#define DECLARE_METHOD(retval, name, args)   retval(*name) args
 
#define DECLARE_BOOL_METHOD(name, args)   DECLARE_METHOD(mysql_service_status_t, name, args)
 
#define DEFINE_SERVICE_HANDLE(name)   typedef struct name##_imp *name
 
#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 [1/2]

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

◆ BEGIN_SERVICE_DEFINITION [2/2]

#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 [1/2]

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

◆ DECLARE_BOOL_METHOD [2/2]

#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 [1/2]

#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.

◆ DECLARE_METHOD [2/2]

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

◆ DEFINE_SERVICE_HANDLE [1/2]

#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.

◆ DEFINE_SERVICE_HANDLE [2/2]

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

◆ END_SERVICE_DEFINITION [1/2]

#define END_SERVICE_DEFINITION (   name)
Value:
} \
SERVICE_TYPE_NO_CONST(name);
const string name("\ame\)

◆ END_SERVICE_DEFINITION [2/2]

#define END_SERVICE_DEFINITION (   name)
Value:
} \
SERVICE_TYPE_NO_CONST(name);
const string name("\ame\)

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

◆ SERVICE_H

#define SERVICE_H

◆ SERVICE_TYPE [1/2]

#define SERVICE_TYPE (   name)    const SERVICE_TYPE_NO_CONST(name)

Generates the standard Service type name.

◆ SERVICE_TYPE [2/2]

#define SERVICE_TYPE (   name)    const SERVICE_TYPE_NO_CONST(name)

◆ SERVICE_TYPE_NO_CONST [1/2]

#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.

◆ SERVICE_TYPE_NO_CONST [2/2]

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

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