diff --git a/README.md b/README.md index 9389c91..2b8b1d4 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,21 @@ # xplugin + +[![ci](https://github.com/QuantStack/xplugin/actions/workflows/ci.yaml/badge.svg)](https://github.com/QuantStack/xplugin/actions/workflows/ci.yaml) + Generic plugin framework in C++. ## Features - [x] Generic plugin framework -- [x] Abitrary abstract base classes can be used as plugin interface +- [x] Arbitrary abstract base classes can be used as plugin interface - [x] Customizable with custom plugin factories (see examples) -- [x] Works on Linux, Mac and Windows and emscripten +- [x] Works on linux, mac, windows and emscripten ## Usage ## Example 1 -All plugins are derived from a a base class, in the first example `MyPluginBase`. +All plugins are derived from a base class, in the first example `MyPluginBase`. All concrete plugins are derived from `MyPluginBase` and implement the pure virtual function (in this example it is only the `do_something()` function). Furthermore, for this example, we assume that all concrete plugins have an empty constructor. (see example 2 for a more complex example) @@ -114,7 +117,7 @@ int main(int argc, char** argv) We again define a plugin interface `MyOtherPluginBase` and a concrete plugin implementations `MyOtherPluginA` and `MyOtherPluginB`. The difference to the first example is that the concrete plugins have a constructor with arguments. -But both plugins have the same constructor signature. (see example 3 for a more complex example) +But both plugins have the same constructor signature. `my_other_plugin_base.hpp`: ```cpp diff --git a/docs/conf.py.in b/docs/conf.py.in index b223135..055f09c 100644 --- a/docs/conf.py.in +++ b/docs/conf.py.in @@ -10,8 +10,6 @@ project = 'xplugin' copyright = '2023, Dr. Thorsten Beier and Johan Mabille' author = 'Dr. Thorsten Beier and Johan Mabille' - - # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -28,13 +26,9 @@ extensions = [ 'breathe' ] - - templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'breathe/*'] - - # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output @@ -59,13 +53,11 @@ html_theme_options = { 'titles_only': False } # html_logo = '' -# github_url = '' -#html_baseurl = 'baZINGA' - +github_url = 'https://github.com/QuantStack/xplugin' +# html_baseurl = '' html_static_path = [] - # -- Breathe configuration ------------------------------------------------- from pathlib import Path CMAKE_CURRENT_BINARY_DIR = Path("@CMAKE_CURRENT_BINARY_DIR@") diff --git a/examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_base.hpp b/examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_base.hpp index d8af6fe..040e75d 100644 --- a/examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_base.hpp +++ b/examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_base.hpp @@ -1,4 +1,6 @@ -#pragma once +#ifndef CUSTOM_FACTORY_WITH_METADATA_PLUGIN_BASE_HPP +#define CUSTOM_FACTORY_WITH_METADATA_PLUGIN_BASE_HPP + #include class PluginBase @@ -24,3 +26,5 @@ class PluginFactoryBase virtual std::string description() const = 0; virtual std::string version() const = 0; }; + +#endif // CUSTOM_FACTORY_WITH_METADATA_PLUGIN_BASE_HPP diff --git a/include/xplugin/xfactory.hpp b/include/xplugin/xfactory.hpp index 8f9bad4..0b53f5e 100644 --- a/include/xplugin/xfactory.hpp +++ b/include/xplugin/xfactory.hpp @@ -27,9 +27,7 @@ class xfactory_base { public: using base_type = BASE_TYPE; - virtual ~xfactory_base() - { - } + virtual ~xfactory_base() = default; virtual std::unique_ptr create(ARGS...) = 0; }; @@ -41,9 +39,7 @@ class xfactory : public xfactory_base using concrete_type = CONCRETE_TYPE; using base_type = BASE_TYPE; using factory_base_type = xfactory_base; - virtual ~xfactory() - { - } + virtual ~xfactory() = default; std::unique_ptr create(ARGS... args) override; }; diff --git a/include/xplugin/xshared_library.hpp b/include/xplugin/xshared_library.hpp index b2f12aa..ef63bad 100644 --- a/include/xplugin/xshared_library.hpp +++ b/include/xplugin/xshared_library.hpp @@ -6,7 +6,6 @@ * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#pragma once #ifndef XPLUGIN_XSHARED_LIBRARY_HPP #define XPLUGIN_XSHARED_LIBRARY_HPP