11 #ifndef PTLIB_PLUGINMGR_H
12 #define PTLIB_PLUGINMGR_H
15 #include <ptlib_config.h>
19 #define P_PTLIB_PLUGIN_DIR_ENV_VAR "PTLIBPLUGINDIR"
20 #define P_PWLIB_PLUGIN_DIR_ENV_VAR "PWLIBPLUGINDIR"
28 class PPluginManager :
public PObject
33 static PPluginManager & GetPluginManager();
40 void SetDirectories(
const PString & dirs);
49 void LoadDirectories();
67 PPluginManager * pluginMgr,
70 ) {
return (pluginMgr != NULL ? pluginMgr : &GetPluginManager())->GetPluginsProviding(serviceType, friendlyNames); }
77 template <
class T>
static T * CreatePluginAs(
78 PPluginManager * pluginMgr,
82 ) {
return dynamic_cast<T *
>((pluginMgr != NULL ? pluginMgr : &GetPluginManager())->CreatePlugin(serviceName, serviceType, userData)); }
91 PPluginManager * pluginMgr,
95 const char *
const * prioritisedDrivers = NULL
96 ) {
return (pluginMgr != NULL ? pluginMgr : &GetPluginManager())->GetPluginDeviceNames(serviceName, serviceType, userData, prioritisedDrivers); }
102 const char *
const * prioritisedDrivers = NULL
105 PBoolean GetPluginsDeviceCapabilities(
113 bool RegisterService(
const char * name);
116 enum NotificationCode {
148 P_DEPRECATED PObject * CreatePluginsDevice(
const PString & serviceName,
const PString & serviceType,
int userData = 0)
const {
return CreatePlugin(serviceName, serviceType, userData); }
154 void CallNotifier(
PDynaLink & dll, NotificationCode code);
162 typedef std::multimap<PCaselessString, const PPluginServiceDescriptor *> ServiceMap;
163 ServiceMap m_services;
175 class PPluginModuleManager :
public PObject
180 PPluginModuleManager(
const char * signatureFunctionName, PPluginManager * pluginMgr = NULL);
185 virtual PluginListType GetPluginList()
const
186 {
return pluginDLLs; }
188 virtual void OnStartup()
190 virtual void OnShutdown()
194 PluginListType pluginDLLs;
198 const char * signatureFunctionName;
199 PPluginManager * pluginMgr;
203 #define PLUGIN_LOADER_STARTUP_NAME "PluginLoaderStartup"
208 #endif // P_PLUGINMGR
210 #endif // PTLIB_PLUGINMGR_H
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
Class specialisation for PNotifierTemplate<P_INT_PTR>
This template class maps the PAbstractDictionary to a specific key and data types.
Definition: dict.h:978
This is an array collection class of PString objects.
Definition: pstring.h:2365
This template class maps the PAbstractList to a specific object type.
Definition: lists.h:322
virtual PBoolean IsEmpty() const
Determine if the string is empty.
#define PDECLARE_MUTEX(...)
Definition: mutex.h:200
Class to represent a directory in the operating system file system.
Definition: pdirect.h:173
#define PFACTORY_LOAD(ConcreteType)
Definition: pfactory.h:557
bool PBoolean
Definition: object.h:174
intptr_t P_INT_PTR
Definition: object.h:2646
The character string class.
Definition: pstring.h:108
A dynamic link library.
Definition: dynalink.h:47
This is a list collection class of PString objects.
Definition: pstring.h:2562
static const PString & Empty()
Return an empty string.
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:925
#define P_DEPRECATED
Definition: object.h:141
#define PDECLARE_NOTIFIER(notifierType, notifiee, func)
Declare PNotifier derived class with P_INT_PTR parameter. Uses PDECLARE_NOTIFIER_EXT macro...
Definition: notifier.h:202
Ultimate parent class for all objects in the class library.
Definition: object.h:2204