CMS 3D CMS Logo

IgPluginLoader Class Reference

#include <Iguana/Framework/interface/IgPluginLoader.h>

Inheritance diagram for IgPluginLoader:

IgStateElement

List of all members.

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

IgStatem_state


Detailed Description

Definition at line 19 of file IgPluginLoader.h.


Constructor & Destructor Documentation

IgPluginLoader::IgPluginLoader ( IgState in  ) 

Definition at line 23 of file IgPluginLoader.cc.

References ASSERT, m_state, and IgState::put().

00024     : m_state (in)
00025 {
00026     ASSERT (m_state);
00027     m_state->put (s_key, this);
00028 }


Member Function Documentation

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 }

void IgPluginLoader::load ( const std::string &  name,
bool  prefix = false 
) [virtual]

Definition at line 31 of file IgPluginLoader.cc.

References m_state.

Referenced by load().

00032 { load (m_state, name, prefix); }


Member Data Documentation

IgState* IgPluginLoader::m_state [private]

Definition at line 35 of file IgPluginLoader.h.

Referenced by IgPluginLoader(), and load().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:24 2009 for CMSSW by  doxygen 1.5.4