MySQL  8.0.17
Source Code Documentation
component_implementation.h File Reference

Specifies macros to define Components. More...

Go to the source code of this file.

Macros

#define DECLARE_COMPONENT(source_name, name)
 Declares a component. More...
 
#define END_DECLARE_COMPONENT()   }
 A macro to end the last declaration of a Component. More...
 
#define BEGIN_COMPONENT_PROVIDES(name)   static struct mysql_service_ref_t __##name##_provides[] = {
 Creates a service implementation list that are provided by specified component. More...
 
#define PROVIDES_SERVICE(component, service)
 Declare a Service Implementation provided by a Component. More...
 
#define END_COMPONENT_PROVIDES()
 A macro to end the last declaration started with the BEGIN_COMPONENT_PROVIDES. More...
 
#define BEGIN_COMPONENT_REQUIRES(name)
 A macro to specify requirements of the component. More...
 
#define REQUIRES_SERVICE_PLACEHOLDER(service)   SERVICE_TYPE(service) * mysql_service_##service
 Creates a definition for placeholder, in which the specified required service will be provided upon component load. More...
 
#define REQUIRES_SERVICE(service)
 Adds a Service requirement with a pointer to placeholder to the list of components. More...
 
#define END_COMPONENT_REQUIRES()
 A macro to end the last declaration started with the BEGIN_COMPONENT_REQUIRES. More...
 
#define BEGIN_COMPONENT_METADATA(name)   static struct mysql_metadata_ref_t __##name##_metadata[] = {
 A macro to specify metadata of the component. More...
 
#define METADATA(key, value)   { key, value }
 Adds a Service requirement with a pointer to placeholder to the list of components. More...
 
#define END_COMPONENT_METADATA()
 A macro to end the last declaration started with the BEGIN_COMPONENT_METADATA. More...
 
#define DLL_EXPORT   extern "C"
 
#define DECLARE_LIBRARY_COMPONENTS   mysql_component_t *library_components_list = {
 Creates a list of component implementations included in this dynamic library. More...
 
#define END_DECLARE_LIBRARY_COMPONENTS
 A macro to end the last declaration started with the DECLARE_LIBRARY_COMPONENTS. More...
 
#define COMPONENT_REF(name)   mysql_component_##name
 Defines a reference to the specified Component data info structure. More...
 

Detailed Description

Specifies macros to define Components.

Macro Definition Documentation

◆ BEGIN_COMPONENT_METADATA

#define BEGIN_COMPONENT_METADATA (   name)    static struct mysql_metadata_ref_t __##name##_metadata[] = {

A macro to specify metadata of the component.

Creates a list of metadata. Only a series of METADATA macros are expected to be used after this macro and before the END_COMPONENT_METADATA counterpart.

Parameters
nameName of component.

◆ BEGIN_COMPONENT_PROVIDES

#define BEGIN_COMPONENT_PROVIDES (   name)    static struct mysql_service_ref_t __##name##_provides[] = {

Creates a service implementation list that are provided by specified component.

Only a series of PROVIDES_SERVICE and PROVIDES_CUSTOM_SERVICE macros are expected to be used after this macro and before the END_COMPONENT_PROVIDES counterpart.

Parameters
nameComponent name.

◆ BEGIN_COMPONENT_REQUIRES

#define BEGIN_COMPONENT_REQUIRES (   name)
Value:
static struct mysql_service_placeholder_ref_t __##name##_requires[] = { \
REQUIRES_SERVICE(registry),
const string name("\ame\)
Carries information on the specific Service requirement for some Component and a pointer to member wh...
Definition: dynamic_loader.h:242
#define REQUIRES_SERVICE_PLACEHOLDER(service)
Creates a definition for placeholder, in which the specified required service will be provided upon c...
Definition: component_implementation.h:235

A macro to specify requirements of the component.

Creates a placeholder for the Registry service and structure with a list for requirements and pointers to their placeholders, adding the Registry service as first element.

Parameters
nameName of component.

◆ COMPONENT_REF

#define COMPONENT_REF (   name)    mysql_component_##name

Defines a reference to the specified Component data info structure.

◆ DECLARE_COMPONENT

#define DECLARE_COMPONENT (   source_name,
  name 
)
Value:
mysql_component_t mysql_component_##source_name = { \
name, __##source_name##_provides, __##source_name##_requires, \
__##source_name##_metadata,
Carries information on the specific Component, all Service Implementations it provides, all its requirements and metadata.
Definition: dynamic_loader.h:259

Declares a component.

For specified name following macros must be executed earlier: BEGIN_COMPONENT_PROVIDES, BEGIN_COMPONENT_REQUIRES and BEGIN_COMPONENT_METADATA. It fills mysql_component_t structure with all of the component data. The info object will be named mysql_component_{source_name}. After this macro it is required to specify comma-separated pointers to initialize and deinitialize methods for components to be used during loading and unloading of component.

Parameters
source_nameThe source name used in other macros.
nameName string with human readable name.

◆ DECLARE_LIBRARY_COMPONENTS

#define DECLARE_LIBRARY_COMPONENTS   mysql_component_t *library_components_list = {

Creates a list of component implementations included in this dynamic library.

It can be used only once in whole library. It defines an entry point method for library to be used with the Dynamic Loader. A list of pointers to Component structures is required after this macro up to the usage of the END_DECLARE_LIBRARY_COMPONENTS macro. Current implementation of the Dynamic Loader supports only one Component being specified in the library.

◆ DLL_EXPORT

#define DLL_EXPORT   extern "C"

◆ END_COMPONENT_METADATA

#define END_COMPONENT_METADATA ( )
Value:
{ NULL, NULL } \
}
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352

A macro to end the last declaration started with the BEGIN_COMPONENT_METADATA.

◆ END_COMPONENT_PROVIDES

#define END_COMPONENT_PROVIDES ( )
Value:
{ NULL, NULL } \
}
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352

A macro to end the last declaration started with the BEGIN_COMPONENT_PROVIDES.

◆ END_COMPONENT_REQUIRES

#define END_COMPONENT_REQUIRES ( )
Value:
{ NULL, NULL } \
}
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352

A macro to end the last declaration started with the BEGIN_COMPONENT_REQUIRES.

◆ END_DECLARE_COMPONENT

#define END_DECLARE_COMPONENT ( )    }

A macro to end the last declaration of a Component.

◆ END_DECLARE_LIBRARY_COMPONENTS

#define END_DECLARE_LIBRARY_COMPONENTS
Value:
} \
; \
DLL_EXPORT mysql_component_t *list_components() { \
return library_components_list; \
}
Carries information on the specific Component, all Service Implementations it provides, all its requirements and metadata.
Definition: dynamic_loader.h:259

A macro to end the last declaration started with the DECLARE_LIBRARY_COMPONENTS.

◆ METADATA

#define METADATA (   key,
  value 
)    { key, value }

Adds a Service requirement with a pointer to placeholder to the list of components.

Parameters
keyA string name of the metadata to add.
valueA string value of the metadata to add.

◆ PROVIDES_SERVICE

#define PROVIDES_SERVICE (   component,
  service 
)
Value:
{ \
#service "." #component, \
(void *)&SERVICE_IMPLEMENTATION(component, service) \
}

Declare a Service Implementation provided by a Component.

It assumes standard Service Implementation name to be referenced.

See also
SERVICE_IMPLEMENTATION
Parameters
componentComponent name.
serviceA Service name for which the Service Implementation will be added.

◆ REQUIRES_SERVICE

#define REQUIRES_SERVICE (   service)
Value:
{ \
#service, \
static_cast < void **> \
(static_cast <void *>(const_cast <mysql_service_##service##_t **>( \
&mysql_service_##service))) \
}

Adds a Service requirement with a pointer to placeholder to the list of components.

Parameters
serviceA referenced Service name.

◆ REQUIRES_SERVICE_PLACEHOLDER

#define REQUIRES_SERVICE_PLACEHOLDER (   service)    SERVICE_TYPE(service) * mysql_service_##service

Creates a definition for placeholder, in which the specified required service will be provided upon component load.

The placeholder will be named mysql_service_{service name}. Use the "extern" keyword before macro invocation to define a reference to the one real placeholder defined in component source.

Parameters
serviceA referenced Service name.