#include <Iguana/Framework/interface/IgPluginLoader.h>
Public Member Functions | |
IgPluginLoader (IgState *in) | |
virtual void | load (IgState *state, const std::string &name, bool prefix=false) |
virtual void | load (const std::string &name, bool prefix=false) |
Private Member Functions | |
IG_DECLARE_STATE_ELEMENT (IgPluginLoader) | |
Private Attributes | |
IgState * | m_state |
Definition at line 19 of file IgPluginLoader.h.
IgPluginLoader::IgPluginLoader | ( | IgState * | in | ) |
IgPluginLoader::IG_DECLARE_STATE_ELEMENT | ( | IgPluginLoader | ) | [private] |
void IgPluginLoader::load | ( | IgState * | state, | |
const std::string & | name, | |||
bool | prefix = false | |||
) | [virtual] |
Definition at line 35 of file IgPluginLoader.cc.
References IgPluginFactoryImplBase< Types >::begin(), IgPluginFactory< I >::begin(), IgPluginFactory< I >::end(), IgPluginFactoryImplBase< Types >::end(), IgCapabilityDB::get(), IgExtensionDB::get(), IgState::get(), IgStateKey::index(), load(), IgPluginFactory< void >::load(), and n.
00038 { 00039 IgExtensionDB *edb = IgExtensionDB::get (); 00040 IgCapabilityDB *cdb = IgCapabilityDB::get (); 00041 00042 // If asked for an exact match, get the element or the capability 00043 // if it doesn't already exist in the state. This assumes the 00044 // extensions' state key names match their plug-in catalog names. 00045 // For capabilities we don't care since the whole point is to just 00046 // attach the plug-in, and extra load attempts are simply ignored. 00047 if (! prefix && ! state->get (IgStateKey::index (name))) 00048 { 00049 edb->create (name, state); 00050 cdb->load (name); 00051 } 00052 00053 // Otherwise, if we are looking for a prefix, load all extensions 00054 // and capabilities whose name begins with that prefix. (FIXME: 00055 // Use regex match instead?) (FIXME: std::string `compare' 00056 // methods are not very standard so avoid them.) 00057 else if (prefix) 00058 { 00059 const char *pfx = name.c_str (); 00060 size_t n = name.length (); 00061 00062 IgExtensionDB::Iterator ext = edb->begin (); 00063 IgExtensionDB::Iterator lastext = edb->end (); 00064 for ( ; ext != lastext; ++ext) 00065 if (! strncmp ((*ext)->name ().c_str (), pfx, n)) 00066 load (state, (*ext)->name ()); 00067 00068 IgCapabilityDB::Iterator cap = cdb->begin (); 00069 IgCapabilityDB::Iterator lastcap = cdb->end(); 00070 for ( ; cap != lastcap; ++cap) 00071 if (! strncmp ((*cap)->name ().c_str (), pfx, n)) 00072 load (state, (*cap)->name ()); 00073 } 00074 }
IgState* IgPluginLoader::m_state [private] |