A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/plugin__manager_8hpp_source.html below:

NCBI C++ ToolKit: include/corelib/plugin_manager.hpp Source File

1 #ifndef CORELIB___PLUGIN_MANAGER__HPP 2 #define CORELIB___PLUGIN_MANAGER__HPP 119 template

<

class

TClass>

134 #define NCBI_DECLARE_INTERFACE_VERSION(iface, iface_name, major, minor, patch_level) \ 136 class CInterfaceVersion<iface> \ 142  ePatchLevel = patch_level \ 144  static const char* GetName() { return iface_name; } \ 150 #define NCBI_INTERFACE_VERSION(iface) \ 151 CVersionInfo(ncbi::CInterfaceVersion<iface>::eMajor, \ 152  ncbi::CInterfaceVersion<iface>::eMinor, \ 153  ncbi::CInterfaceVersion<iface>::ePatchLevel) 156 template

<

class

TInterface>

161  eMajor

= ncbi::CInterfaceVersion<TInterface>::eMajor,

162  eMinor

= ncbi::CInterfaceVersion<TInterface>::eMinor,

163  ePatchLevel

= ncbi::CInterfaceVersion<TInterface>::ePatchLevel

177

:

name

(driver_name),

191 template

<

class

TClass>

241  const string

& param_name,

243  const string

& default_value)

const

;

248  const string

&

GetParam

(

const string

& driver_name,

250  const string

& param_name,

251  bool

mandatory)

const

;

267 template

<

class

TClass>

291 template

<

class

TClass>

318  string

driver_name = driver;

322

driver_name = subst_it->second;

328  string msg

=

"Cannot create a driver instance (driver: "

;

340  const string

& driver_list,

346  const string

& driver_key,

443  template

<

typename

TEntryPo

int

>

450  template

<

typename

TEntryPo

int

>

452  const string

& driver_name,

634  string

GetDllName(

const string

& interface_name,

648  string

GetDllNameMask(

const string

& interface_name,

651

EVersionLocation ver_lct = eBeforeSuffix)

const

;

664  string

GetEntryPointName(

const string

& interface_name =

kEmptyStr

,

665  const string

& driver_name =

kEmptyStr

)

const

;

669  virtual string

GetEntryPointPrefix()

const

;

672  virtual string

GetDllNamePrefix()

const

;

675  virtual void

SetDllNamePrefix(

const string

& prefix);

681  static bool

IsEnabledGlobally();

684  static bool

IsEnabledGloballyByDefault();

688  static void

EnableGlobally(

bool

enable =

true

);

727 template

<

class

TClass>

730  const string

& driver_list,

735  _TRACE

(

"Creating an instance of a driver having version "

<<

736  version

<<

" from a list "

<< driver_list);

738

list<string> drivers;

740  ITERATE

( list<string>, it, drivers ) {

741  string

drv_name = *it;

745

drv = CreateInstance(drv_name,

version

, driver_params);

747  catch

( exception& e ) {

749

drv_name <<

" is not available ::"

<< e.what());

759 template

<

class

TClass>

762  const string

& driver_key,

765  _TRACE

(

"Creating an instance of a driver having version "

<<

766  version

<<

" from a key "

<< driver_key);

772  if

( !driver_node ) {

775  string

driver_name = driver_node->

GetValue

().value;

777

drv = CreateInstanceFromList(params, driver_name,

version

);

782 template

<

class

TClass>

792  _TRACE

(

"Looking for an already loaded factory for driver "

<<

793

driver <<

" having version "

<<

version

);

795

cf = FindClassFactory(driver,

version

);

800  if

(!m_BlockResolution) {

803

m_FreezeResolutionDrivers.find(driver);

805  if

(it == m_FreezeResolutionDrivers.end()) {

810  _TRACE

(

"Trying to find appropriate files for driver "

<<

811

driver <<

" having version "

<<

version

);

817  _TRACE

(

"Trying to find an appropriate factory for driver "

<<

818

driver <<

" having version "

<<

version

);

819

cf = FindClassFactory(driver,

version

);

826  string msg

=

"Cannot resolve class factory (unknown driver: "

;

833 template

<

class

TClass>

841  int

best_patch_level = -1;

855  if

(!driver.empty()) {

856  if

(driver != drv_info.name) {

862

best_major, best_minor, best_patch_level))

873 template

<

class

TClass>

881  if

( WillExtendCapabilities(factory) ) {

882

m_Factories.insert(&factory);

888 template

<

class

TClass>

896  if

( m_Factories.empty() && !new_drv_list.empty() ) {

911

full_drv_list.merge(drv_list);

913

full_drv_list.unique();

918  bool

has_new_driver =

true

;

923  if

(new_drv_info.name == drv_info.name

924

&& (new_drv_info.version.Match(drv_info.version) ==

926  _TRACE

(

"Driver "

<< new_drv_info.name <<

" having version "

<<

927

new_drv_info.version <<

" is already registered and "

<<

928  "won't extend Plugin Manager's capabilities"

);

929

has_new_driver =

false

;

933  if

(has_new_driver) {

945  Warning

<<

"A duplicate driver factory was found. " 946  "It will be ignored because it won't extend " 947  "Plugin Manager's capabilities."

);

952 template

<

class

TClass>

958  if

(it != m_Factories.end()) {

959  _TRACE

(

"Unregistering factory"

);

961

m_Factories.erase(it);

967 template

<

class

TClass>

968 template

<

typename

TEntryPo

int

>

970

(TEntryPoint plugin_entry_point)

973  if

( !m_EntryPoints.insert(

974  reinterpret_cast<

FNCBI_EntryPoint

>

(plugin_entry_point))

983

plugin_entry_point(drv_list, eGetFactoryInfo);

985  if

( !drv_list.empty() ) {

987

plugin_entry_point(drv_list, eInstantiateFactory);

991  _TRACE

(

"Registering factory for driver "

<< it->name <<

992  " having version "

<< it->version);

993

RegisterFactory(*(it->factory));

1001 template

<

class

TClass>

1023 template

<

class

TClass>

1024 template

<

typename

TEntryPo

int

>

1026  const string

& driver_name,

1030  if

( !m_EntryPoints.insert(

1031  reinterpret_cast<

FNCBI_EntryPoint

>

(plugin_entry_point))

1040

plugin_entry_point(drv_list, eGetFactoryInfo);

1042  if

( !drv_list.empty() ) {

1050  typedef typename

TDriverInfoList::iterator TDrilIt;

1051  for

(TDrilIt it = drv_list.begin(); it != drv_list.end(); ) {

1052  if

(is_invalid(*it)) {

1055

drv_list.erase(cur);

1062

plugin_entry_point(drv_list, eInstantiateFactory);

1064  bool

was_registered =

false

;

1067  _TRACE

(

"Registering factory for driver "

<< it->name <<

1068  " having version "

<< it->version);

1069

was_registered |= RegisterFactory(*(it->factory));

1072  return

was_registered;

1078 template

<

class

TClass>

1082

m_Resolvers.push_back(resolver);

1086 template

<

class

TClass>

1091  if

(resolver == *it) {

1092

m_Resolvers.erase(it);

1100 template

<

class

TClass>

1103

m_DllSearchPaths.push_back(path);

1107 template

<

class

TClass>

1110  if

(previous_paths) {

1111

previous_paths->clear();

1112

previous_paths->swap(m_DllSearchPaths);

1114

m_DllSearchPaths.clear();

1119 template

<

class

TClass>

1125

m_StdDllPath = standard_paths;

1130 template

<

class

TClass>

1134  return

m_StdDllPath;

1138 template

<

class

TClass>

1142

m_FreezeResolutionDrivers.insert(driver);

1144

m_FreezeResolutionDrivers.erase(driver);

1149 template

<

class

TClass>

1153

vector<CDllResolver*> resolvers;

1156  ITERATE

(vector<CPluginManager_DllResolver*>, it, m_Resolvers) {

1159

&(*it)->ResolveFile(m_DllSearchPaths, driver,

version

, m_StdDllPath);

1172  if

( dll_resolver ) {

1173

resolvers.push_back(dll_resolver);

1193

FNCBI_EntryPoint ep = (FNCBI_EntryPoint)(

void

*)epoint.

entry_point

.

func

;

1195  if

( RegisterWithEntryPoint(ep, driver,

version

) ) {

1196

m_RegisteredEntries.push_back(entry);

1199  Info

<<

"Couldn't register an entry point " 1200  "within a DLL '"

<< entry.

dll

->

GetName

() <<

"' " 1201  "because either an entry point with the same name was already " 1202  "registered or it does not provide an appropriate factory."

);

1209

entry_points.clear();

1214 template

<

class

TClass>

1220  static const char

* section_name(

"PLUGIN_MANAGER_SUBST"

);

1233  string

driver_name = *cit;

1234  string

substitute_name =

registry

->

GetString

(section_name, driver_name, driver_name);

1247 template

<

class

TClass>

1259 template

<

class

TClass>

1262  const string

& driver_name,

1264  const string

& param_name,

1266  const string

& default_value)

const 1277 template

<

class

TClass>

1280  const string

& driver_name,

1282  const string

& param_name,

1283  bool

mandatory)

const

Template function to create dll resolver for interface.

Class for entry point resolution when there are several DLL candidates.

CPluginManagerException –.

Service class for DLLs resolution.

definition of a Culling tree

container_type::const_iterator const_iterator

const_iterator end() const

const_iterator find(const key_type &key) const

parent_type::iterator iterator

parent_type::const_iterator const_iterator

static CNcbiApplicationGuard InstanceGuard(void)

Singleton method.

const CNcbiRegistry & GetConfig(void) const

Get the application's cached configuration parameters (read-only).

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

#define NON_CONST_ITERATE(Type, Var, Cont)

Non constant version of ITERATE macro.

#define ERR_POST_XX(error_name, err_subcode, message)

Error posting with error code having given name and with given error subcode.

const string & GetName() const

Get the name of the DLL file.

FEntryPoint func

Do not call this func without type cast!

const TEntries & GetResolvedEntries() const

Get all resolved entry points.

vector< SResolvedEntry > TEntries

Container, keeps list of all resolved entry points.

vector< SNamedEntryPoint > entry_points

list of DLL entry points

EAutoUnload

Whether to unload DLL in the destructor.

CDll::TEntryPoint entry_point

DLL entry point.

CDll * dll

Loaded DLL instance.

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

void Warning(CExceptionArgs_Base &args)

virtual const char * GetErrCodeString(void) const override

Translate from the error code value to its string representation.

EErrCode

Error types that an application can generate.

void Info(CExceptionArgs_Base &args)

string GetString(const string &driver_name, const string &param_name, EErrAction on_error, const string &default_value, const list< string > *synonyms=NULL)

Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...

@ eErr_NoThrow

Return default value on error.

@ eErr_Throw

Throw an exception on error.

NCBI_EXCEPTION_DEFAULT(CPluginManagerException, CCoreException)

const string m_DriverName

bool RegisterFactory(TClassFactory &factory)

Try to register factory in the manager.

CDllResolver::TExtraDllPath SetDllStdSearchPath(CDllResolver::TExtraDllPath standard_paths)

Specify which standard locations should be used for the DLL lookup (for all resolvers).

bool operator()(const TValue &val)

bool UnregisterFactory(TClassFactory &factory)

Unregister and release (un-own)

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.

virtual void GetDriverVersions(TDriverList &driver_list) const =0

Versions of the interface exported by the factory.

void FreezeResolution(const string &driver, bool value=true)

Disable/enable DLL resolution (search for class factories in DLLs) for the specified driver.

SDriverInfo(const string &driver_name, const CVersionInfo &driver_version)

virtual ~IClassFactory(void)

TClass * CreateInstanceFromList(const TPluginManagerParamTree *params, const string &driver_list, const CVersionInfo &version=GetDefaultDrvVers())

Create first available driver from the list of drivers.

CInvalidDrvVer(const string &driver_name, const CVersionInfo &vi)

virtual TClass * CreateInstance(const string &driver=kEmptyStr, CVersionInfo version=GetDefaultDrvVers(), const TPluginManagerParamTree *params=0) const =0

Create driver's instance.

void FreezeResolution(bool value=true)

Disable/enable DLL resolution (search for class factories in DLLs)

set< FNCBI_EntryPoint > TEntryPoints

TDllResolvers m_Resolvers

DLL resolvers.

CVersionInfo version

Driver version.

TResolvedEntries m_RegisteredEntries

DLL entries resolved and registered with dll resolver(s)

vector< CDllResolver::SResolvedEntry > TResolvedEntries

TClassFactory * GetFactory(const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers())

Get class factory.

TSearchPaths m_DllSearchPaths

Paths used for DLL search.

CDefaultDriverVersion< TClass > TDefaultDriverVersion

set< TClassFactory * > TFactories

CPluginManager< TClass >::SDriverInfo TValue

void(* FNCBI_EntryPoint)(TDriverInfoList &info_list, EEntryPointRequest method)

Entry point to get drivers' info, and (if requested) their class factories.

void AddDllSearchPath(const string &path)

Add path for the DLL lookup (for all resolvers)

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 e...

vector< string > TSearchPaths

Container for the DLL search paths.

static const CVersionInfo & GetDefaultDrvVers(void)

static const CVersionInfo & GetDefaultDrvVers(void)

CConfig::TParamTree TPluginManagerParamTree

ncbi::TDriverList TDriverList

CDll::EAutoUnload m_AutoUnloadDll

CDllResolver::TExtraDllPath m_StdDllPath

Standard locations that should be used for the DLL lookup.

TClass * CreateInstance(const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers(), const TPluginManagerParamTree *params=0)

Create class instance.

string m_EntryPointPrefix

vector< string > TSearchPaths

Container for the DLL search paths.

vector< CPluginManager_DllResolver * > TDllResolvers

string GetParam(const string &driver_name, const TPluginManagerParamTree *params, const string &param_name, bool mandatory, const string &default_value) const

Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...

CMutex m_Mutex

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

CDefaultDriverVersion< TClass > TDefaultDriverVersion

map< string, string > TSubstituteMap

CPluginManager_DllResolver * operator()(void)

const CVersionInfo m_VersionInfo

void ResetDllSearchPath(TSearchPaths *previous_paths=NULL)

Delete all user-installed paths for the DLL lookup (for all resolvers)

virtual ~CPluginManager(void)

SDriverInfo(const string &driver_name, const CVersionInfo &driver_version)

const string & GetParam(const string &driver_name, const TPluginManagerParamTree *params, const string &param_name, bool mandatory) const

This version always defaults to the empty string so that it can safely return a reference.

void ResolveFile(const string &driver=kEmptyStr, const CVersionInfo &version=GetDefaultDrvVers())

Scan DLLs for specified driver using attached resolvers.

TEntryPoints m_EntryPoints

List of entry points registered in this plugin manager.

bool operator<(const SDriverInfo &i1, const SDriverInfo &i2)

bool RegisterWithEntryPoint(TEntryPoint plugin_entry_point)

Register all factories exported by the plugin entry point.

ncbi::SDriverInfo SDriverInfo

CDllResolver * m_DllResolver

static void DisableGlobally()

Disable loading plugins from DLLs in general.

TStringSet m_FreezeResolutionDrivers

Set of drivers prohibited from DLL resolution.

IClassFactory< TClass > TClassFactory

list< SDriverInfo > TDriverInfoList

List of driver information.

bool operator==(const SDriverInfo &i1, const SDriverInfo &i2)

void AddResolver(CPluginManager_DllResolver *resolver)

Attach DLL resolver to plugin manager.

bool m_BlockResolution

Flag, prohibits DLL resolution.

TFactories m_Factories

List of factories presently registered with (and owned by) the plugin manager.

EEntryPointRequest

Actions performed by the entry point.

CPluginManager_DllResolver * DetachResolver(CPluginManager_DllResolver *resolver)

Remove resolver from the list of active resolvers.

bool WillExtendCapabilities(TClassFactory &factory) const

Check if a given factory will extend capabilities of the Plugin Manager (add either new drivers or ne...

const string & GetDriverName() const

Return name of the driver.

TSubstituteMap m_SubstituteMap

Driver name substitution map.

list< SDriverInfo > TDriverList

TClassFactory * FindClassFactory(const string &driver, const CVersionInfo &version) const

CDllResolver::TExtraDllPath GetDllStdSearchPath(void) const

Get standard locations which should be used for the DLL lookup.

TClassFactory * factory

Class factory (can be NULL)

@ eResolveFailure

Cannot resolve interface driver.

@ eParameterMissing

Missing mandatory parameter.

@ eGetFactoryInfo

Add info about all drivers exported through the entry point to the end of list.

@ eInstantiateFactory

Scan the driver info list passed to the entry point for the [name,version] pairs exported by the give...

virtual void EnumerateEntries(const string &section, list< string > *entries, TFlags flags=fAllLayers) const

Enumerate parameter names for a specified section.

virtual string GetString(const string &section, const string &name, const string &default_value, TFlags flags=0) const

Get the parameter string value.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

@ fSplit_MergeDelimiters

Merge adjacent delimiters.

const TTreeType * FindNode(const TKeyType &key, TNodeSearchMode sflag=eImmediateAndTop) const

Search for node.

const TValue & GetValue(void) const

Return node's value.

bool IsBetterVersion(const CVersionInfo &info, const CVersionInfo &cinfo, int &best_major, int &best_minor, int &best_patch_level)

Return true if one version info is matches another better than the best variant.

@ eNonCompatible

major, minor does not match

@ eFullyCompatible

exactly the same version

#define NCBI_XNCBI_EXPORT

Definition of all error codes used in corelib (xncbi.lib).

const string version

version string

Magic spell ;-) needed for some weird compilers... very empiric.

const GenericPointer< typename T::ValueType > T2 value

Parameters initialization model.

Define class Dll and for Portable DLL handling.

Multi-threading – mutexes; rw-locks; semaphore.

@ Resolve

Try to resolve provided seq-ids.

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

DLL entry point name -> function pair.

DLL resolution descriptor.

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

static wxAcceleratorEntry entries[3]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4