MySQL 8.3.0
Source Code Documentation
library_file.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2017, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQLROUTER_PLUGIN_INFO_PLUGIN_FILE_INCLUDED
26#define MYSQLROUTER_PLUGIN_INFO_PLUGIN_FILE_INCLUDED
27
28#include <memory>
29#include <string>
30
31#include "plugin.h"
32
33/** @class Library_file
34 *
35 * @brief Abstraction over the plugin library file, hides system specific
36 * dynamic library handling.
37 *
38 **/
40 public:
41 /** @brief Constructor
42 *
43 * @param file_name path to the plugin file on the filesystem
44 * @param plugin_name name of the plugin (has to match name of the exported
45 *Plugin struct)
46 **/
47 explicit Library_file(const std::string &file_name,
48 const std::string &plugin_name);
49
50 /** @brief Returns ABI version of the plugin represented by the object.
51 **/
52 uint32_t get_abi_version() const;
53
54 /** @brief Returns version specific Plugin struct of the plugin.
55 * Specified by the caller through the template parameter.
56 *
57 * @param symbol name of the struct symbol
58 *
59 **/
60 template <class T>
61 T *get_plugin_struct(const std::string &symbol) const;
62
63 /** @brief Destructor
64 **/
66
67 private:
68 struct Library_file_impl;
69 std::unique_ptr<Library_file_impl> impl_;
70
71 template <class T>
72 T *get_plugin_struct_internal(const std::string &symbol) const;
73
74 const std::string plugin_name_;
75 const std::string file_name_;
76};
77
78#endif
Abstraction over the plugin library file, hides system specific dynamic library handling.
Definition: library_file.h:39
T * get_plugin_struct_internal(const std::string &symbol) const
Definition: library_file.cc:132
~Library_file()
Destructor.
Definition: library_file.cc:164
const std::string file_name_
Definition: library_file.h:75
uint32_t get_abi_version() const
Returns ABI version of the plugin represented by the object.
Definition: library_file.cc:109
std::unique_ptr< Library_file_impl > impl_
Definition: library_file.h:68
const std::string plugin_name_
Definition: library_file.h:74
Library_file(const std::string &file_name, const std::string &plugin_name)
Constructor.
Definition: library_file.cc:80
T * get_plugin_struct(const std::string &symbol) const
Returns version specific Plugin struct of the plugin.
Definition: library_file.cc:116
std::string file_name(Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0pre_8_0_30.cc:93
LEX_CSTRING * plugin_name(st_plugin_int **ref)
Definition: sql_plugin_ref.h:94
Definition: library_file.cc:63