From c4019aac50df36fbab743b6dc1a882d9a9e30686 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 12 May 2018 16:25:32 +0100 Subject: Move multi index types Reduce header bloat by moving the types into the .cpp. --- libadhocutil/plugins.cpp | 27 ++++++++++++++++++++------- libadhocutil/plugins.h | 27 +++++---------------------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/libadhocutil/plugins.cpp b/libadhocutil/plugins.cpp index 4ac5992..dc92ca3 100644 --- a/libadhocutil/plugins.cpp +++ b/libadhocutil/plugins.cpp @@ -3,6 +3,9 @@ #include #include #include +#include +#include +#include #include "compileTimeFormatter.h" #include "globalStatic.impl.h" #include @@ -61,16 +64,26 @@ namespace AdHoc { { } - PluginManager::PluginManager() : - plugins(new PluginStore()), - resolvers(new TypePluginResolvers()) + class PluginManager::PluginStore : public boost::multi_index_container>, + boost::multi_index::ordered_non_unique>, + boost::multi_index::ordered_unique< + boost::multi_index::composite_key< + Plugin, + boost::multi_index::member, + boost::multi_index::const_mem_fun + >> + >> { - } + }; - PluginManager::~PluginManager() + class PluginManager::TypePluginResolvers : public std::map { }; + + PluginManager::PluginManager() : + plugins(std::make_unique()), + resolvers(std::make_unique()) { - delete resolvers; - delete plugins; } PluginManager * diff --git a/libadhocutil/plugins.h b/libadhocutil/plugins.h index fe86834..d51ad2b 100644 --- a/libadhocutil/plugins.h +++ b/libadhocutil/plugins.h @@ -4,11 +4,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -106,7 +101,7 @@ namespace AdHoc { typedef std::function (const std::type_info &, const std::string &)> PluginResolver; PluginManager(); - virtual ~PluginManager(); + virtual ~PluginManager() = default; /// Install a plugin. void add(const PluginPtr &); @@ -208,22 +203,10 @@ namespace AdHoc { private: static void loadLibrary(const std::string &); - typedef boost::multi_index_container>, - boost::multi_index::ordered_non_unique>, - boost::multi_index::ordered_unique< - boost::multi_index::composite_key< - Plugin, - boost::multi_index::member, - boost::multi_index::const_mem_fun - >> - >> PluginStore; - - typedef std::map TypePluginResolvers; - - PluginStore * plugins; - TypePluginResolvers * resolvers; + class PluginStore; + std::unique_ptr plugins; + class TypePluginResolvers; + std::unique_ptr resolvers; }; } -- cgit v1.2.3