00001
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
00012
00013
00014
00015
00016
00017
00018
00019
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
00047
00048
00049
00050
00051
00052
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 }