CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edmplugin::PluginCapabilities Class Reference

#include <PluginCapabilities.h>

Inheritance diagram for edmplugin::PluginCapabilities:
edmplugin::PluginFactoryBase

Public Member Functions

virtual std::vector< PluginInfoavailable () const
 return info about all plugins which are already available in the program More...
 
virtual const std::string & category () const
 returns the name of the category to which this plugin factory belongs More...
 
void load (const std::string &iName)
 
bool tryToFind (const SharedLibrary &iLoadable)
 Check to see if any capabilities are in the file, returns 'true' if found. More...
 
bool tryToLoad (const std::string &iName)
 
virtual ~PluginCapabilities ()
 
- Public Member Functions inherited from edmplugin::PluginFactoryBase
 PluginFactoryBase ()
 
virtual ~PluginFactoryBase ()
 

Static Public Member Functions

static PluginCapabilitiesget ()
 

Private Member Functions

const PluginCapabilitiesoperator= (const PluginCapabilities &)
 
 PluginCapabilities ()
 
 PluginCapabilities (const PluginCapabilities &)
 

Private Attributes

std::map< std::string,
boost::filesystem::path > 
classToLoadable_
 

Friends

class DummyFriend
 

Additional Inherited Members

- Public Types inherited from edmplugin::PluginFactoryBase
typedef std::map< std::string,
PMakers
Plugins
 
typedef std::vector< std::pair
< void *, std::string > > 
PMakers
 
- Public Attributes inherited from edmplugin::PluginFactoryBase
sigc::signal< void, const
std::string &, const
PluginInfo & > 
newPluginAdded_
 signal containing plugin category, and plugin info for newly added plugin More...
 
- Protected Member Functions inherited from edmplugin::PluginFactoryBase
void fillAvailable (std::vector< PluginInfo > &iReturn) const
 
void fillInfo (const PMakers &makers, PluginInfo &iInfo, std::vector< PluginInfo > &iReturn) const
 
Plugins::const_iterator findPMaker (const std::string &iName) const
 
void finishedConstruction ()
 
void newPlugin (const std::string &iName)
 
void registerPMaker (void *iPMaker, const std::string &iName)
 
Plugins::const_iterator tryToFindPMaker (const std::string &iName) const
 
- Protected Attributes inherited from edmplugin::PluginFactoryBase
Plugins m_plugins
 

Detailed Description

Definition at line 33 of file PluginCapabilities.h.

Constructor & Destructor Documentation

PluginCapabilities::~PluginCapabilities ( )
virtual

Definition at line 44 of file PluginCapabilities.cc.

45 {
46 }
PluginCapabilities::PluginCapabilities ( )
private
edmplugin::PluginCapabilities::PluginCapabilities ( const PluginCapabilities )
private

Member Function Documentation

std::vector< PluginInfo > PluginCapabilities::available ( ) const
virtual

return info about all plugins which are already available in the program

Reimplemented from edmplugin::PluginFactoryBase.

Definition at line 139 of file PluginCapabilities.cc.

References classToLoadable_, info, benchmark_cfg::infos, edmplugin::PluginInfo::loadable_, and edmplugin::PluginInfo::name_.

140 {
142  std::vector<PluginInfo> infos;
143  infos.reserve(classToLoadable_.size());
144 
145  for(std::map<std::string, boost::filesystem::path>::const_iterator it = classToLoadable_.begin();
146  it != classToLoadable_.end();
147  ++it) {
148  info.name_ = it->first;
149  info.loadable_ = it->second;
150  infos.push_back(info);
151  }
152  return infos;
153 }
std::map< std::string, boost::filesystem::path > classToLoadable_
const std::string & PluginCapabilities::category ( ) const
virtual

returns the name of the category to which this plugin factory belongs

Implements edmplugin::PluginFactoryBase.

Definition at line 156 of file PluginCapabilities.cc.

Referenced by load(), tryToFind(), and tryToLoad().

157 {
158  static const std::string s_cat("Capability");
159  return s_cat;
160 }
PluginCapabilities * PluginCapabilities::get ( void  )
static
void PluginCapabilities::load ( const std::string &  iName)

Definition at line 91 of file PluginCapabilities.cc.

References category(), classToLoadable_, edm::hlt::Exception, edmplugin::PluginManager::get(), edmplugin::PluginManager::load(), edmplugin::SharedLibrary::path(), and tryToFind().

Referenced by edm::service::InitRootHandlers::InitRootHandlers(), edm::RootAutoLibraryLoader::loadAll(), edm::service::LoadAllDictionaries::LoadAllDictionaries(), edm::loadCap(), and ora::ClassUtils::loadDictionary().

92 {
93  if(classToLoadable_.end() == classToLoadable_.find(iName) ) {
95  iName);
96  //read the items from the 'capabilities' symbol
97  if(not tryToFind(lib) ) {
98  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName <<"' is supposed to be in file\n '"
99  <<lib.path().string()<<"'\n but no dictionaries are in that file.\n"
100  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib.path().string()<<"'.";
101  }
102 
103  if(classToLoadable_.end() == classToLoadable_.find(iName)) {
104  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName<<"' is supposed to be in file\n '"
105  <<lib.path().string()<<"'\n but was not found.\n"
106  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib.path().string()<<"'.";
107  }
108  }
109 }
bool tryToFind(const SharedLibrary &iLoadable)
Check to see if any capabilities are in the file, returns &#39;true&#39; if found.
virtual const std::string & category() const
returns the name of the category to which this plugin factory belongs
std::map< std::string, boost::filesystem::path > classToLoadable_
const SharedLibrary & load(const std::string &iCategory, const std::string &iPlugin)
static PluginManager * get()
const PluginCapabilities& edmplugin::PluginCapabilities::operator= ( const PluginCapabilities )
private
bool PluginCapabilities::tryToFind ( const SharedLibrary iLoadable)

Check to see if any capabilities are in the file, returns 'true' if found.

Definition at line 64 of file PluginCapabilities.cc.

References category(), classToLoadable_, i, info, edmplugin::PluginInfo::loadable_, mergeVDriftHistosByStation::name, edmplugin::PluginInfo::name_, cscdqm::h::names, edmplugin::PluginFactoryBase::newPluginAdded_, edmplugin::SharedLibrary::path(), findQualityFiles::size, and edmplugin::SharedLibrary::symbol().

Referenced by load(), main(), and tryToLoad().

65 {
66  void* sym;
67  if( not iLoadable.symbol("SEAL_CAPABILITIES",sym) ) {
68  return false;
69  }
70 
71  const char** names;
72  int size;
73  //reinterpret_cast<void (*)(const char**&,int&)>(sym)(names,size);
74  reinterpret_cast<void (*)(const char**&,int&)>(reinterpret_cast<unsigned long>(sym))(names,size);
75 
77  for(int i=0; i < size; ++i) {
78  std::string name(names[i]);
79  classToLoadable_[name]=iLoadable.path();
80 
81  //NOTE: can't use newPlugin(name) to do the work since it assumes
82  // we haven't yet returned from PluginManager::load method
83  info.name_ = name;
84  info.loadable_ = iLoadable.path();
85  this->newPluginAdded_(category(),info);
86  }
87  return true;
88 }
int i
Definition: DBlmapReader.cc:9
static const HistoName names[]
virtual const std::string & category() const
returns the name of the category to which this plugin factory belongs
sigc::signal< void, const std::string &, const PluginInfo & > newPluginAdded_
signal containing plugin category, and plugin info for newly added plugin
std::map< std::string, boost::filesystem::path > classToLoadable_
tuple size
Write out results.
bool PluginCapabilities::tryToLoad ( const std::string &  iName)

Definition at line 112 of file PluginCapabilities.cc.

References category(), classToLoadable_, edm::hlt::Exception, edmplugin::PluginManager::get(), edmplugin::SharedLibrary::path(), tryToFind(), and edmplugin::PluginManager::tryToLoad().

Referenced by edm::ProductRegistryHelper::addToRegistry().

113 {
114  if(classToLoadable_.end() == classToLoadable_.find(iName) ) {
116  iName);
117  if( 0 == lib) {
118  return false;
119  }
120  //read the items from the 'capabilities' symbol
121  if(not tryToFind(*lib) ) {
122  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName <<"' is supposed to be in file\n '"
123  <<lib->path().string()<<"'\n but no dictionaries are in that file.\n"
124  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib->path().string()<<"'.";
125  }
126 
127  if(classToLoadable_.end() == classToLoadable_.find(iName)) {
128  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName<<"' is supposed to be in file\n '"
129  <<lib->path().string()<<"'\n but was not found.\n"
130  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib->path().string()<<"'.";
131  }
132  }
133  return true;
134 }
const SharedLibrary * tryToLoad(const std::string &iCategory, const std::string &iPlugin)
bool tryToFind(const SharedLibrary &iLoadable)
Check to see if any capabilities are in the file, returns &#39;true&#39; if found.
virtual const std::string & category() const
returns the name of the category to which this plugin factory belongs
std::map< std::string, boost::filesystem::path > classToLoadable_
static PluginManager * get()

Friends And Related Function Documentation

friend class DummyFriend
friend

Definition at line 35 of file PluginCapabilities.h.

Member Data Documentation

std::map<std::string, boost::filesystem::path> edmplugin::PluginCapabilities::classToLoadable_
private

Definition at line 62 of file PluginCapabilities.h.

Referenced by available(), load(), tryToFind(), and tryToLoad().