NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CPluginManager< TClass > Class Template Reference

Search Toolkit Book for CPluginManager

CPluginManager<> –. More...

#include <corelib/plugin_manager.hpp>

+ Inheritance diagram for CPluginManager< TClass >:
+ Collaboration diagram for CPluginManager< TClass >:

Classes

struct  SDriverInfo
 Information about a driver, with maybe a pointer to an instantiated class factory that contains the driver. More...
 

Public Types

enum  EEntryPointRequest { eGetFactoryInfo , eInstantiateFactory }
 Actions performed by the entry point. More...
 
typedef IClassFactory< TClass > TClassFactory
 
typedef CDefaultDriverVersion< TClass > TDefaultDriverVersion
 
typedef vector< stringTSearchPaths
 Container for the DLL search paths. More...
 
typedef list< SDriverInfoTDriverInfoList
 List of driver information. More...
 
typedef void(* FNCBI_EntryPoint) (TDriverInfoList &info_list, EEntryPointRequest method)
 Entry point to get drivers' info, and (if requested) their class factories. More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

TClass * CreateInstance (const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers(), const TPluginManagerParamTree *params=0)
 Create class instance. More...
 
TClass * CreateInstanceFromList (const TPluginManagerParamTree *params, const string &driver_list, const CVersionInfo &version=GetDefaultDrvVers())
 Create first available driver from the list of drivers. More...
 
TClass * CreateInstanceFromKey (const TPluginManagerParamTree *params, const string &driver_key, const CVersionInfo &version=GetDefaultDrvVers())
 Detect driver from the parameters using the key to get list of drivers. More...
 
TClassFactoryGetFactory (const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers())
 Get class factory. More...
 
bool RegisterFactory (TClassFactory &factory)
 Try to register factory in the manager. More...
 
bool WillExtendCapabilities (TClassFactory &factory) const
 Check if a given factory will extend capabilities of the Plugin Manager (add either new drivers or new driver versions to already available). More...
 
bool UnregisterFactory (TClassFactory &factory)
 Unregister and release (un-own) More...
 
template<typename TEntryPoint >
bool RegisterWithEntryPoint (TEntryPoint plugin_entry_point)
 Register all factories exported by the plugin entry point. More...
 
template<typename TEntryPoint >
bool RegisterWithEntryPoint (TEntryPoint plugin_entry_point, const string &driver_name, const CVersionInfo &driver_version=CVersionInfo::kLatest)
 Register all compatible factories for the driver with the particular version exported by the plugin entry point. More...
 
void AddResolver (CPluginManager_DllResolver *resolver)
 Attach DLL resolver to plugin manager. More...
 
CPluginManager_DllResolverDetachResolver (CPluginManager_DllResolver *resolver)
 Remove resolver from the list of active resolvers. More...
 
void AddDllSearchPath (const string &path)
 Add path for the DLL lookup (for all resolvers) More...
 
void ResetDllSearchPath (TSearchPaths *previous_paths=NULL)
 Delete all user-installed paths for the DLL lookup (for all resolvers) More...
 
CDllResolver::TExtraDllPath SetDllStdSearchPath (CDllResolver::TExtraDllPath standard_paths)
 Specify which standard locations should be used for the DLL lookup (for all resolvers). More...
 
CDllResolver::TExtraDllPath GetDllStdSearchPath (void) const
 Get standard locations which should be used for the DLL lookup. More...
 
void ResolveFile (const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers())
 Scan DLLs for specified driver using attached resolvers. More...
 
void FreezeResolution (bool value=true)
 Disable/enable DLL resolution (search for class factories in DLLs) More...
 
void FreezeResolution (const string &driver, bool value=true)
 Disable/enable DLL resolution (search for class factories in DLLs) for the specified driver. More...
 
 CPluginManager (void)
 
virtual ~CPluginManager (void)
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Static Public Member Functions

static const CVersionInfoGetDefaultDrvVers (void)
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Protected Types

typedef set< FNCBI_EntryPointTEntryPoints
 
typedef set< TClassFactory * > TFactories
 
typedef vector< CDllResolver::SResolvedEntryTResolvedEntries
 
typedef vector< CPluginManager_DllResolver * > TDllResolvers
 
typedef set< stringTStringSet
 
typedef map< string, stringTSubstituteMap
 

Protected Member Functions

TClassFactoryFindClassFactory (const string &driver, const CVersionInfo &version) const
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

CMutex m_Mutex
 Protective mutex to synchronize the access to the plugin manager from different threads. More...
 

Private Attributes

TFactories m_Factories
 List of factories presently registered with (and owned by) the plugin manager. More...
 
TEntryPoints m_EntryPoints
 List of entry points registered in this plugin manager. More...
 
TDllResolvers m_Resolvers
 DLL resolvers. More...
 
TSearchPaths m_DllSearchPaths
 Paths used for DLL search. More...
 
TResolvedEntries m_RegisteredEntries
 DLL entries resolved and registered with dll resolver(s) More...
 
bool m_BlockResolution
 Flag, prohibits DLL resolution. More...
 
TStringSet m_FreezeResolutionDrivers
 Set of drivers prohibited from DLL resolution. More...
 
CDllResolver::TExtraDllPath m_StdDllPath
 Standard locations that should be used for the DLL lookup. More...
 
TSubstituteMap m_SubstituteMap
 Driver name substitution map. More...
 

Additional Inherited Members

- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Detailed Description

template<class TClass>
class CPluginManager< TClass >

CPluginManager<> –.

To register (either directly, or via an "entry point") class factories for the given interface.

Then, to facilitate the process of instantiating the class given the registered pool of drivers, and also taking into account the driver name and/or version as requested by the calling code.

Template class is protected by mutex and safe for use from different threads

Definition at line 292 of file plugin_manager.hpp.


The documentation for this class was generated from the following file:
Modified on Tue Jun 18 13:38:14 2024 by modify_doxy.py rev. 669887