MySQL 8.0.40
Source Code Documentation
service_implementation.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SERVICE_IMPLEMENTATION_H
25#define SERVICE_IMPLEMENTATION_H
26
27#include "service.h"
28
29/**
30 @file include/mysql/components/service_implementation.h
31 Specifies macros to define Service Implementations.
32*/
33
34/**
35 Reference to the name of the service implementation variable
36
37 @ref BEGIN_SERVICE_IMPLEMENTATION defines a local variable of
38 the structure type for the service (see @ref SERVICE_TYPE).
39 The variable is then used by the @ref PROVIDES_SERVICE macro to
40 construct the list of service provided by the component.
41 This macro allows one to use @ref BEGIN_SERVICE_IMPLEMENTATION ,
42 @ref DEFINE_METHOD and @ref END_SERVICE_IMPLEMENTATION macros to build
43 a service definition structure and variable to be used outside of the
44 component definition context.
45
46 @param component Name of the implementation of the service.
47 Usually a component name.
48 @param service Name of the service to create the implementation for.
49
50*/
51#define SERVICE_IMPLEMENTATION(component, service) imp_##component##_##service
52
53/**
54 Declares a Service Implementation. It builds standard implementation
55 info structure. Only a series of pointers to methods the Service
56 Implementation implements as respective Service methods are expected to be
57 used after this macro and before the END_SERVICE_IMPLEMENTATION counterpart.
58
59 @param component Name of the Component to create implementation in.
60 @param service Name of the Service to create implementation for.
61*/
62#define BEGIN_SERVICE_IMPLEMENTATION(component, service) \
63 SERVICE_TYPE(service) SERVICE_IMPLEMENTATION(component, service) = {
64/**
65 A macro to end the last declaration of a Service Implementation.
66*/
67#define END_SERVICE_IMPLEMENTATION() }
68
69/**
70 A macro to ensure method implementation has required properties, that is it
71 does not throw exceptions and is static. This macro should be used with
72 exactly the same arguments as DECLARE_METHOD.
73
74 @param retval Type of return value. It cannot contain comma characters, but
75 as only simple structures are possible, this shouldn't be a problem.
76 @param name Method name.
77 @param args a list of arguments in parenthesis.
78*/
79#define DEFINE_METHOD(retval, name, args) retval name args noexcept
80
81/**
82 A short macro to define method that returns bool, which is the most common
83 case.
84
85 @param name Method name.
86 @param args a list of arguments in parenthesis.
87*/
88#define DEFINE_BOOL_METHOD(name, args) \
89 DEFINE_METHOD(mysql_service_status_t, name, args)
90
91#endif /* SERVICE_IMPLEMENTATION_H */