MySQL 8.4.2
Source Code Documentation
library_file.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2017, 2024, 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 designed to work 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 either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef MYSQLROUTER_PLUGIN_INFO_PLUGIN_FILE_INCLUDED
27#define MYSQLROUTER_PLUGIN_INFO_PLUGIN_FILE_INCLUDED
28
29#include <memory>
30#include <string>
31
32#include "plugin.h"
33
34/** @class Library_file
35 *
36 * @brief Abstraction over the plugin library file, hides system specific
37 * dynamic library handling.
38 *
39 **/
41 public:
42 /** @brief Constructor
43 *
44 * @param file_name path to the plugin file on the filesystem
45 * @param plugin_name name of the plugin (has to match name of the exported
46 *Plugin struct)
47 **/
48 explicit Library_file(const std::string &file_name,
49 const std::string &plugin_name);
50
51 /** @brief Returns ABI version of the plugin represented by the object.
52 **/
53 uint32_t get_abi_version() const;
54
55 /** @brief Returns version specific Plugin struct of the plugin.
56 * Specified by the caller through the template parameter.
57 *
58 * @param symbol name of the struct symbol
59 *
60 **/
61 template <class T>
62 T *get_plugin_struct(const std::string &symbol) const;
63
64 /** @brief Destructor
65 **/
67
68 private:
69 struct Library_file_impl;
70 std::unique_ptr<Library_file_impl> impl_;
71
72 template <class T>
73 T *get_plugin_struct_internal(const std::string &symbol) const;
74
75 const std::string plugin_name_;
76 const std::string file_name_;
77};
78
79#endif
Abstraction over the plugin library file, hides system specific dynamic library handling.
Definition: library_file.h:40
T * get_plugin_struct_internal(const std::string &symbol) const
Definition: library_file.cc:133
~Library_file()
Destructor.
Definition: library_file.cc:165
const std::string file_name_
Definition: library_file.h:76
uint32_t get_abi_version() const
Returns ABI version of the plugin represented by the object.
Definition: library_file.cc:110
std::unique_ptr< Library_file_impl > impl_
Definition: library_file.h:69
const std::string plugin_name_
Definition: library_file.h:75
Library_file(const std::string &file_name, const std::string &plugin_name)
Constructor.
Definition: library_file.cc:81
T * get_plugin_struct(const std::string &symbol) const
Returns version specific Plugin struct of the plugin.
Definition: library_file.cc:117
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:94
LEX_CSTRING * plugin_name(st_plugin_int **ref)
Definition: sql_plugin_ref.h:95
Definition: library_file.cc:64