CMS 3D CMS Logo

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

std::vector< PluginInfoavailable () const override
 return info about all plugins which are already available in the program More...
 
const std::string & category () const override
 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)
 
 ~PluginCapabilities () override
 
- Public Member Functions inherited from edmplugin::PluginFactoryBase
 PluginFactoryBase ()
 
virtual ~PluginFactoryBase ()
 

Static Public Member Functions

static PluginCapabilitiesget ()
 

Private Member Functions

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

Private Attributes

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

Friends

class DummyFriend
 

Additional Inherited Members

- Public Types inherited from edmplugin::PluginFactoryBase
typedef tbb::concurrent_unordered_map< std::string, PMakersPlugins
 
typedef tbb::concurrent_vector< PluginMakerInfoPMakers
 
- Public Attributes inherited from edmplugin::PluginFactoryBase
edm::signalslot::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
 
void * findPMaker (const std::string &iName) const
 
void finishedConstruction ()
 
void newPlugin (const std::string &iName)
 
void registerPMaker (void *iPMaker, const std::string &iName)
 
void * tryToFindPMaker (const std::string &iName) const
 

Detailed Description

Definition at line 32 of file PluginCapabilities.h.

Constructor & Destructor Documentation

PluginCapabilities::~PluginCapabilities ( )
override

Definition at line 44 of file PluginCapabilities.cc.

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

Member Function Documentation

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

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_, edmplugin::PluginInfo::name_, and AlCaHLTBitMon_QueryRunRegistry::string.

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 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::map< std::string, boost::filesystem::path > classToLoadable_
const std::string & PluginCapabilities::category ( ) const
overridevirtual

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

Implements edmplugin::PluginFactoryBase.

Definition at line 156 of file PluginCapabilities.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 91 of file PluginCapabilities.cc.

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

Referenced by edm::service::LoadAllDictionaries::LoadAllDictionaries().

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.
std::map< std::string, boost::filesystem::path > classToLoadable_
const std::string & category() const override
returns the name of the category to which this plugin factory belongs
const SharedLibrary & load(const std::string &iCategory, const std::string &iPlugin)
static PluginManager * get()
const PluginCapabilities& edmplugin::PluginCapabilities::operator= ( const PluginCapabilities )
privatedelete
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_, mps_fire::i, info(), edmplugin::PluginInfo::loadable_, dataset::name, edmplugin::PluginInfo::name_, names, edmplugin::PluginFactoryBase::newPluginAdded_, edmplugin::SharedLibrary::path(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, 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 }
size
Write out results.
static const TGPicture * info(bool iBackgroundIsBlack)
const std::string names[nVars_]
edm::signalslot::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_
const std::string & category() const override
returns the name of the category to which this plugin factory belongs
bool PluginCapabilities::tryToLoad ( const std::string &  iName)

Definition at line 112 of file PluginCapabilities.cc.

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

113 {
114  if(classToLoadable_.end() == classToLoadable_.find(iName) ) {
116  iName);
117  if( nullptr == 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.
std::map< std::string, boost::filesystem::path > classToLoadable_
const std::string & category() const override
returns the name of the category to which this plugin factory belongs
static PluginManager * get()

Friends And Related Function Documentation

friend class DummyFriend
friend

Definition at line 34 of file PluginCapabilities.h.

Member Data Documentation

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

Definition at line 61 of file PluginCapabilities.h.

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