31#ifndef ASYNC_PLUGIN_INCLUDED
32#define ASYNC_PLUGIN_INCLUDED
132 static T*
load(
const std::string& path)
139 T* plugin =
dynamic_cast<T*
>(p);
140 if (plugin ==
nullptr)
142 std::cerr <<
"*** ERROR: Could not load plugin \"" << path
143 <<
"\": Not a \"" << T::typeName() <<
"\" plugin"
180 const std::string&
pluginPath(
void)
const {
return m_plugin_path; }
189 typedef Plugin* (*ConstructFunc)(void);
191 void* m_handle =
nullptr;
192 std::string m_plugin_path;
194 void setHandle(
void* handle) { m_handle = handle; }
A base class for making a class into a dynamic loadable plugin.
static void unload(Plugin *p)
Plugin(const Plugin &)=delete
Disallow copy construction.
virtual ~Plugin(void)
Destructor.
static T * load(const std::string &path)
Load the plugin from the specified path returning correct type.
Plugin(void)
Default constructor.
void * pluginHandle(void) const
Retrieve the handle returned from the dlopen function.
const std::string & pluginPath(void) const
Retrieve the path used to find the plugin.
Plugin & operator=(const Plugin &)=delete
Disallow copy assignment.
static Plugin * load(const std::string &path)
Load the plugin from the specified path.
Namespace for the asynchronous programming classes.