CMS 3D CMS Logo

IgPluginInfo.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Framework/interface/IgPluginInfo.h"
00004 #include "Iguana/Framework/interface/IgModuleDescriptor.h"
00005 #include "Iguana/Framework/interface/IgPluginManager.h"
00006 #include "Iguana/Framework/interface/IgModule.h"
00007 #include "debug.h"
00008 #include "classlib/utils/DebugAids.h"
00009 #include "classlib/utils/Log.h"
00010 
00011 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00012 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00013 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00014 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00015 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00016 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00017 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00018 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00019 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00020 
00021 IgPluginInfo::IgPluginInfo (IgModule *module,
00022                             const std::string &name,
00023                             const std::string &category)
00024     : m_module (module),
00025       m_name (name),
00026       m_category (category)
00027 {
00028     ASSERT (m_module);
00029     ASSERT (! m_name.empty ());
00030     ASSERT (! m_category.empty ());
00031     LOG (0, trace, LFplugin_manager, "defining " << m_category
00032          << ' ' << m_name << '\n');
00033 }
00034 
00035 IgPluginInfo::~IgPluginInfo (void)
00036 {
00037     ASSERT (m_module);
00038     ASSERT (! m_name.empty ());
00039     ASSERT (! m_category.empty ());
00040     m_module->detachInfo (this);
00041 }
00042 
00043 void
00044 IgPluginInfo::finish (bool needCache)
00045 {
00046     // Derived constructor is complete, tell the module I exist.  This
00047     // adds myself to the module and propagates the notification to
00048     // the relevant factory.  Note that the factory must already exist, so
00049     // it will get notified immediately.  However it might still be in
00050     // the middle of construction, which is why we propagate the
00051     // notification through the base classes and not directly to the
00052     // factory from the derived class.
00053     m_module->addInfo (this, needCache);
00054 }
00055 
00056 IgModule *
00057 IgPluginInfo::module (void) const
00058 {
00059     ASSERT (m_module);
00060     ASSERT (! m_name.empty ());
00061     ASSERT (! m_category.empty ());
00062     return m_module;
00063 }
00064 
00065 const std::string &
00066 IgPluginInfo::name (void) const
00067 {
00068     ASSERT (m_module);
00069     ASSERT (! m_name.empty ());
00070     ASSERT (! m_category.empty ());
00071     return m_name;
00072 }
00073 
00074 const std::string &
00075 IgPluginInfo::category (void) const
00076 {
00077     ASSERT (m_module);
00078     ASSERT (! m_name.empty ());
00079     ASSERT (! m_category.empty ());
00080     return m_category;
00081 }
00082 
00083 void
00084 IgPluginInfo::cache (IgModuleDescriptor *to) const
00085 {
00086     ASSERT (m_module);
00087     ASSERT (! m_name.empty ());
00088     ASSERT (! m_category.empty ());
00089     ASSERT (to);
00090     new IgModuleDescriptor (to, m_category, m_name);
00091 }
00092 
00093 void
00094 IgPluginInfo::detach (void)
00095 {
00096     ASSERT (m_module);
00097     ASSERT (! m_name.empty ());
00098     ASSERT (! m_category.empty ());
00099 }
00100 
00101 void
00102 IgPluginInfo::noFactory (void) const
00103 {
00104     m_module->manager ()->feedback
00105         (IgPluginManager::ErrorNoFactory,
00106          m_name + " (" + m_module->libraryName ().name () + ")");
00107     ASSERT (false);
00108 }

Generated on Tue Jun 9 17:38:29 2009 for CMSSW by  doxygen 1.5.4