1 // Copyright (c) 2005-2014 Hartmut Kaiser 2 // 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 // Make HPX inspect tool happy: hpxinspect:nounnamed 7 8 #if !defined(HPX_COMPONENTS_STATIC_FACTORY_DATA_HPP) 9 #define HPX_COMPONENTS_STATIC_FACTORY_DATA_HPP 10 11 #include <hpx/config.hpp> 12 #include <hpx/util/detail/pp/stringize.hpp> 13 #include <hpx/util/plugin/export_plugin.hpp> 14 #include <hpx/util/plugin/virtual_constructor.hpp> 15 #include <hpx/util/detail/pp/cat.hpp> 16 17 #include <map> 18 #include <string> 19 20 namespace hpx { namespace components 21 { 22 /////////////////////////////////////////////////////////////////////////// 23 struct static_factory_load_data_type 24 { 25 char const* name; // component name 26 hpx::util::plugin::get_plugins_list_type get_factory; 27 }; 28 29 HPX_EXPORT void init_registry_module(static_factory_load_data_type const&); 30 HPX_EXPORT void init_registry_factory(static_factory_load_data_type const&); 31 HPX_EXPORT void init_registry_commandline(static_factory_load_data_type const&); 32 HPX_EXPORT void init_registry_startup_shutdown(static_factory_load_data_type const&); 33 }} 34 35 /////////////////////////////////////////////////////////////////////////////// 36 #define HPX_DECLARE_FACTORY_STATIC(name, base) \ 37 extern "C" HPX_PLUGIN_EXPORT_API std::map<std::string, boost::any>* \ 38 HPX_PLUGIN_API HPX_PLUGIN_LIST_NAME(name, base)() \ 39 /**/ 40 41 #define HPX_DEFINE_FACTORY_STATIC(module, name, base) \ 42 { \ 43 HPX_PP_STRINGIZE(module), \ 44 HPX_PLUGIN_LIST_NAME(name, base) \ 45 } \ 46 /**/ 47 48 /////////////////////////////////////////////////////////////////////////////// 49 #define HPX_INIT_REGISTRY_MODULE_STATIC(name, base) \ 50 HPX_DECLARE_FACTORY_STATIC(name, base); \ 51 namespace { \ 52 struct HPX_PP_CAT(init_registry_module_static_, name) \ 53 { \ 54 HPX_PP_CAT(init_registry_module_static_, name)() \ 55 { \ 56 hpx::components::static_factory_load_data_type data = \ 57 HPX_DEFINE_FACTORY_STATIC(HPX_COMPONENT_NAME, name, base);\ 58 hpx::components::init_registry_module(data); \ 59 } \ 60 } HPX_PP_CAT(module_data_, __LINE__); \ 61 } \ 62 /**/ 63 64 /////////////////////////////////////////////////////////////////////////////// 65 #define HPX_INIT_REGISTRY_FACTORY_STATIC(name, componentname, base) \ 66 HPX_DECLARE_FACTORY_STATIC(name, base); \ 67 namespace { \ 68 struct HPX_PP_CAT(init_registry_factory_static_, componentname) \ 69 { \ 70 HPX_PP_CAT(init_registry_factory_static_, componentname)() \ 71 { \ 72 hpx::components::static_factory_load_data_type data = \ 73 HPX_DEFINE_FACTORY_STATIC(componentname, name, base); \ 74 hpx::components::init_registry_factory(data); \ 75 } \ 76 } HPX_PP_CAT(componentname, HPX_PP_CAT(_factory_data_, __LINE__)); \ 77 } \ 78 /**/ 79 80 /////////////////////////////////////////////////////////////////////////////// 81 #define HPX_INIT_REGISTRY_COMMANDLINE_STATIC(name, base) \ 82 HPX_DECLARE_FACTORY_STATIC(name, base); \ 83 namespace { \ 84 struct HPX_PP_CAT(init_registry_module_commandline_, name) \ 85 { \ 86 HPX_PP_CAT(init_registry_module_commandline_, name)() \ 87 { \ 88 hpx::components::static_factory_load_data_type data = \ 89 HPX_DEFINE_FACTORY_STATIC(HPX_COMPONENT_NAME, name, base);\ 90 hpx::components::init_registry_commandline(data); \ 91 } \ 92 } HPX_PP_CAT(module_commandline_data_, __LINE__); \ 93 } \ 94 /**/ 95 96 /////////////////////////////////////////////////////////////////////////////// 97 #define HPX_INIT_REGISTRY_STARTUP_SHUTDOWN_STATIC(name, base) \ 98 HPX_DECLARE_FACTORY_STATIC(name, base); \ 99 namespace { \ 100 struct HPX_PP_CAT(init_registry_module_startup_shutdown_, name) \ 101 { \ 102 HPX_PP_CAT(init_registry_module_startup_shutdown_, name)() \ 103 { \ 104 hpx::components::static_factory_load_data_type data = \ 105 HPX_DEFINE_FACTORY_STATIC(HPX_COMPONENT_NAME, name, base);\ 106 hpx::components::init_registry_startup_shutdown(data); \ 107 } \ 108 } HPX_PP_CAT(module_startup_shutdown_data_, __LINE__); \ 109 } \ 110 /**/ 111 112 #endif 113 114