31#ifndef ASYNC_PLUGIN_INCLUDED
32#define ASYNC_PLUGIN_INCLUDED
138 static T*
load(
const std::string& path)
145 T* demop =
dynamic_cast<T*
>(p);
146 if (demop ==
nullptr)
148 std::cerr <<
"*** ERROR: Could not load plugin \"" << path
149 <<
"\": Not a \"" << T::typeName() <<
"\" plugin"
186 const std::string&
pluginPath(
void)
const {
return m_plugin_path; }
195 typedef Plugin* (*ConstructFunc)(void);
197 void* m_handle =
nullptr;
198 std::string m_plugin_path;
200 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.