CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edmplugin::SharedLibrary Class Reference

#include <SharedLibrary.h>

Public Member Functions

const SharedLibraryoperator= (const SharedLibrary &)=delete
 
const std::filesystem::path & path () const
 
 SharedLibrary (const SharedLibrary &)=delete
 
 SharedLibrary (const std::filesystem::path &iName)
 
bool symbol (const std::string &iSymbolName, void *&iSymbol) const
 
 ~SharedLibrary ()
 

Private Attributes

void * libraryHandle_
 
std::filesystem::path path_
 

Detailed Description

Definition at line 29 of file SharedLibrary.h.

Constructor & Destructor Documentation

◆ SharedLibrary() [1/2]

SharedLibrary::SharedLibrary ( const std::filesystem::path &  iName)

Definition at line 34 of file SharedLibrary.cc.

35  : libraryHandle_(::dlopen(iName.string().c_str(), RTLD_LAZY | RTLD_GLOBAL)), path_(iName) {
36  if (libraryHandle_ == nullptr) {
37  char const* err = dlerror();
38  if (err == nullptr) {
39  throw cms::Exception("PluginLibraryLoadError") << "unable to load " << iName.string();
40  }
41  throw cms::Exception("PluginLibraryLoadError") << "unable to load " << iName.string() << " because " << err;
42  }
43  }

References submitPVResolutionJobs::err, Exception, and libraryHandle_.

◆ SharedLibrary() [2/2]

edmplugin::SharedLibrary::SharedLibrary ( const SharedLibrary )
delete

◆ ~SharedLibrary()

SharedLibrary::~SharedLibrary ( )

Definition at line 50 of file SharedLibrary.cc.

50 {}

Member Function Documentation

◆ operator=()

const SharedLibrary& edmplugin::SharedLibrary::operator= ( const SharedLibrary )
delete

◆ path()

const std::filesystem::path& edmplugin::SharedLibrary::path ( ) const
inline

◆ symbol()

bool SharedLibrary::symbol ( const std::string &  iSymbolName,
void *&  iSymbol 
) const

Definition at line 71 of file SharedLibrary.cc.

71  {
72  if (libraryHandle_ == nullptr) {
73  return false;
74  }
75  iSymbol = dlsym(libraryHandle_, iSymbolName.c_str());
76  return (iSymbol != nullptr);
77  }

References libraryHandle_.

Referenced by edmplugin::PluginCapabilities::tryToFind().

Member Data Documentation

◆ libraryHandle_

void* edmplugin::SharedLibrary::libraryHandle_
private

Definition at line 46 of file SharedLibrary.h.

Referenced by SharedLibrary(), and symbol().

◆ path_

std::filesystem::path edmplugin::SharedLibrary::path_
private
edmplugin::SharedLibrary::libraryHandle_
void * libraryHandle_
Definition: SharedLibrary.h:46
edmplugin::SharedLibrary::path_
std::filesystem::path path_
Definition: SharedLibrary.h:47
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
Exception
Definition: hltDiff.cc:245