DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ers::PluginManager Class Reference

#include <PluginManager.hpp>

Classes

class  SharedLibrary
 

Public Member Functions

 PluginManager ()
 
 ~PluginManager ()
 

Private Types

typedef std::map< std::string, SharedLibrary * > LibMap
 

Private Attributes

LibMap libraries_
 

Detailed Description

Definition at line 37 of file PluginManager.hpp.

Member Typedef Documentation

◆ LibMap

std::map< std::string, SharedLibrary* > ers::PluginManager::LibMap
private

Definition at line 57 of file PluginManager.hpp.

Constructor & Destructor Documentation

◆ PluginManager()

ers::PluginManager::PluginManager ( )

Constructor loads the plugins.

Definition at line 57 of file PluginManager.cpp.

58 {
59 const char * env = ::getenv( EnvironmentName );
60 std::string config( env ? std::string( env ) + SEPARATOR + DefaultLibraryName : DefaultLibraryName );
61
62 std::vector<std::string> libs;
63 ers::tokenize( config, SEPARATOR, libs );
64
65
66 for ( size_t i = 0; i < libs.size(); i++ )
67 {
68 LibMap::iterator it = libraries_.find( libs[i] );
69 if ( it == libraries_.end() )
70 {
71 try
72 {
73 libraries_[libs[i]] = new SharedLibrary( libs[i] );
74 }
75 catch( PluginException & ex )
76 {
77 ERS_INTERNAL_ERROR( "Library " << libs[i] << " can not be loaded because " << ex.reason() )
78 }
79 }
80 }
81 }
#define ERS_INTERNAL_ERROR(message)
Definition macro.hpp:52
void tokenize(const std::string &text, const std::string &separators, std::vector< std::string > &tokens)
Definition Util.cpp:7

◆ ~PluginManager()

ers::PluginManager::~PluginManager ( )

Destructor unloads the plugins.

Definition at line 47 of file PluginManager.cpp.

48 {
49 LibMap::iterator it = libraries_.begin();
50 for ( ; it != libraries_.end(); )
51 {
52 delete it->second;
53 libraries_.erase( it++ );
54 }
55 }

Member Data Documentation

◆ libraries_

LibMap ers::PluginManager::libraries_
private

Definition at line 59 of file PluginManager.hpp.


The documentation for this class was generated from the following files: