1 #ifndef CORELIB___PLUGIN_MANAGER__IMPL__HPP
2 #define CORELIB___PLUGIN_MANAGER__IMPL__HPP
59 template <
class IFace,
class TDriver>
114 const string& param_name,
116 const string& default_value)
const
120 params, param_name, mandatory, default_value);
127 const string& param_name,
128 bool mandatory)
const
138 const string& param_name,
140 int default_value)
const
154 const string& param_name,
156 unsigned int default_value)
const
170 const string& param_name,
172 bool default_value)
const
187 const string& param_name,
189 double default_value)
const
212 template<
class TClassFactory>
233 list<TCFDriverInfo> cf_info_list;
234 cf.GetDriverVersions(cf_info_list);
240 typename list<TCFDriverInfo>::const_iterator it =
241 cf_info_list.begin();
242 typename list<TCFDriverInfo>::const_iterator it_end =
245 for (; it != it_end; ++it) {
246 info_list.push_back(
TDriverInfo(it->name, it->version));
253 typename TDriverInfoList::iterator it1 = info_list.begin();
254 typename TDriverInfoList::iterator it1_end = info_list.end();
255 for(; it1 != it1_end; ++it1) {
260 typename list<TCFDriverInfo>::iterator it2 =
261 cf_info_list.begin();
262 typename list<TCFDriverInfo>::iterator it2_end =
265 for (; it2 != it2_end; ++it2) {
266 if (it1->name == it2->name) {
268 if (it1->version.Match(it2->version) ==
273 TClassFactory* cg =
new TClassFactory();
Template class helps to implement one driver class factory.
definition of a Culling tree
Uint8 GetDataSize(const string &driver_name, const string ¶m_name, EErrAction on_error, unsigned int default_value, const list< string > *synonyms=NULL)
Utility function to get an integer element of parameter tree Throws an exception when mandatory param...
double GetDouble(const string &driver_name, const string ¶m_name, EErrAction on_error, double default_value, const list< string > *synonyms=NULL)
Utility function to get a double element of parameter tree Throws an exception when mandatory paramet...
int GetInt(const string &driver_name, const string ¶m_name, EErrAction on_error, int default_value, const list< string > *synonyms=NULL)
Utility function to get an integer element of parameter tree Throws an exception when mandatory param...
bool GetBool(const string &driver_name, const string ¶m_name, EErrAction on_error, bool default_value, const list< string > *synonyms=NULL)
Utility function to get an integer element of parameter tree Throws an exception when mandatory param...
@ eErr_NoThrow
Return default value on error.
IClassFactory< IFace > TParent
CPluginManager< TInterface > TPluginManager
CSimpleClassFactoryImpl(const string &driver_name, int patch_level=-1)
Construction.
CVersionInfo m_DriverVersionInfo
virtual TInterface * CreateInstance(const string &driver=kEmptyStr, CVersionInfo version=TParent::GetDefaultDrvVers(), const TPluginManagerParamTree *=0) const
Create instance of TDriver.
double GetParamDouble(const TPluginManagerParamTree *params, const string ¶m_name, bool, double default_value) const
Utility function to get a double of parameter tree Throws an exception when mandatory parameter is mi...
static const CVersionInfo & GetDefaultDrvVers(void)
ncbi::TDriverList TDriverList
static void NCBI_EntryPointImpl(TDriverInfoList &info_list, EEntryPointRequest method)
Entry point implementation.
void GetDriverVersions(TDriverList &info_list) const
Versions of the interface exported by the factory.
const string & GetParam(const TPluginManagerParamTree *params, const string ¶m_name, bool mandatory) const
This version always defaults to the empty string so that it can safely return a reference.
TParent::SDriverInfo TDriverInfo
#define NCBI_INTERFACE_VERSION(iface)
Macro to construct CVersionInfo class using interface name (relies on CInterfaceVersion class)
Uint8 GetParamDataSize(const TPluginManagerParamTree *params, const string ¶m_name, bool, unsigned int default_value) const
Utility function to get an integer of parameter tree Throws an exception when mandatory parameter is ...
TParent::TDriverList TDriverList
TClassFactory::SDriverInfo TCFDriverInfo
int GetParamInt(const TPluginManagerParamTree *params, const string ¶m_name, bool, int default_value) const
Utility function to get an integer of parameter tree Throws an exception when mandatory parameter is ...
string GetParam(const string &driver_name, const TPluginManagerParamTree *params, const string ¶m_name, bool mandatory, const string &default_value) const
Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...
CPluginManager< TInterface >::TDriverInfoList TDriverInfoList
CPluginManager< TInterface >::EEntryPointRequest EEntryPointRequest
TClassFactory::TInterface TInterface
ncbi::SDriverInfo SDriverInfo
bool GetParamBool(const TPluginManagerParamTree *params, const string ¶m_name, bool, bool default_value) const
Utility function to get an bool of parameter tree Throws an exception when mandatory parameter is mis...
list< SDriverInfo > TDriverInfoList
List of driver information.
CPluginManager< TInterface >::SDriverInfo TDriverInfo
EEntryPointRequest
Actions performed by the entry point.
string GetParam(const TPluginManagerParamTree *params, const string ¶m_name, bool mandatory, const string &default_value) const
Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...
@ 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...
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ eNonCompatible
major, minor does not match
@ eFullyCompatible
exactly the same version
const string version
version string
Plugin manager (using class factory paradigm).
Template implements entry point.
Information about a driver, with maybe a pointer to an instantiated class factory that contains the d...