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 48 of file PluginManager.hpp.

Member Typedef Documentation

◆ LibMap

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

Definition at line 68 of file PluginManager.hpp.

Constructor & Destructor Documentation

◆ PluginManager()

ers::PluginManager::PluginManager ( )

Constructor loads the plugins.

Definition at line 68 of file PluginManager.cpp.

69 {
70 const char * env = ::getenv( EnvironmentName );
71 std::string config( env ? std::string( env ) + SEPARATOR + DefaultLibraryName : DefaultLibraryName );
72
73 std::vector<std::string> libs;
74 ers::tokenize( config, SEPARATOR, libs );
75
76
77 for ( size_t i = 0; i < libs.size(); i++ )
78 {
79 LibMap::iterator it = libraries_.find( libs[i] );
80 if ( it == libraries_.end() )
81 {
82 try
83 {
84 libraries_[libs[i]] = new SharedLibrary( libs[i] );
85 }
86 catch( PluginException & ex )
87 {
88 ERS_INTERNAL_ERROR( "Library " << libs[i] << " can not be loaded because " << ex.reason() )
89 }
90 }
91 }
92 }
#define ERS_INTERNAL_ERROR(message)
Definition macro.hpp:63
void tokenize(const std::string &text, const std::string &separators, std::vector< std::string > &tokens)
Definition Util.cpp:18

◆ ~PluginManager()

ers::PluginManager::~PluginManager ( )

Destructor unloads the plugins.

Definition at line 58 of file PluginManager.cpp.

59 {
60 LibMap::iterator it = libraries_.begin();
61 for ( ; it != libraries_.end(); )
62 {
63 delete it->second;
64 libraries_.erase( it++ );
65 }
66 }

Member Data Documentation

◆ libraries_

LibMap ers::PluginManager::libraries_
private

Definition at line 70 of file PluginManager.hpp.


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