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
tbb::concurrent_unordered_map
< std::string, PMakers
Plugins
 
typedef tbb::concurrent_vector
< PluginMakerInfo
PMakers
 
- 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 ( )
virtual

Definition at line 43 of file PluginCapabilities.cc.

44 {
45 }
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 138 of file PluginCapabilities.cc.

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

139 {
141  std::vector<PluginInfo> infos;
142  infos.reserve(classToLoadable_.size());
143 
144  for(std::map<std::string, boost::filesystem::path>::const_iterator it = classToLoadable_.begin();
145  it != classToLoadable_.end();
146  ++it) {
147  info.name_ = it->first;
148  info.loadable_ = it->second;
149  infos.push_back(info);
150  }
151  return infos;
152 }
static const TGPicture * info(bool iBackgroundIsBlack)
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 155 of file PluginCapabilities.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 90 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::service::LoadAllDictionaries::LoadAllDictionaries(), edm::loadCap(), ora::ClassUtils::loadDictionary(), and cond::lookUpDictionary().

91 {
92  if(classToLoadable_.end() == classToLoadable_.find(iName) ) {
94  iName);
95  //read the items from the 'capabilities' symbol
96  if(not tryToFind(lib) ) {
97  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName <<"' is supposed to be in file\n '"
98  <<lib.path().string()<<"'\n but no dictionaries are in that file.\n"
99  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib.path().string()<<"'.";
100  }
101 
102  if(classToLoadable_.end() == classToLoadable_.find(iName)) {
103  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName<<"' is supposed to be in file\n '"
104  <<lib.path().string()<<"'\n but was not found.\n"
105  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib.path().string()<<"'.";
106  }
107  }
108 }
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 63 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, AlCaHLTBitMon_QueryRunRegistry::string, and edmplugin::SharedLibrary::symbol().

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

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

Definition at line 111 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().

112 {
113  if(classToLoadable_.end() == classToLoadable_.find(iName) ) {
115  iName);
116  if( 0 == lib) {
117  return false;
118  }
119  //read the items from the 'capabilities' symbol
120  if(not tryToFind(*lib) ) {
121  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName <<"' is supposed to be in file\n '"
122  <<lib->path().string()<<"'\n but no dictionaries are in that file.\n"
123  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib->path().string()<<"'.";
124  }
125 
126  if(classToLoadable_.end() == classToLoadable_.find(iName)) {
127  throw cms::Exception("PluginNotFound")<<"The dictionary for class '"<<iName<<"' is supposed to be in file\n '"
128  <<lib->path().string()<<"'\n but was not found.\n"
129  "It appears like the cache is wrong. Please do 'EdmPluginRefresh "<<lib->path().string()<<"'.";
130  }
131  }
132  return true;
133 }
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 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().