JANA2
C++ framework for multi-threaded data processing
Loading...
Searching...
No Matches
JPluginLoader Class Reference
Inheritance diagram for JPluginLoader:
[legend]
Collaboration diagram for JPluginLoader:
[legend]

Public Member Functions

void Init () override
 
void add_plugin (std::string plugin_name)
 
void add_plugin_path (std::string path)
 
void attach_plugins (JComponentManager *jcm)
 
void attach_plugin (std::string name, std::string path)
 
void resolve_plugin_paths ()
 
bool is_valid_plugin_name (const std::string &plugin_name) const
 
bool is_valid_path (const std::string &path) const
 
std::string find_first_valid_path (const std::string &name, std::ostringstream &debug_log) const
 
std::string make_path_from_name (const std::string &name, const std::string &path_prefix) const
 
- Public Member Functions inherited from JService
virtual ~JService ()=default
 acquire_services is a callback which allows the user to configure a JService which relies on other JServices.
 
void DoInit (JServiceLocator *)
 
virtual void acquire_services (JServiceLocator *)
 
- Public Member Functions inherited from jana::components::JComponent
void SetLevel (JEventLevel level)
 
void SetCallbackStyle (CallbackStyle style)
 
void SetPrefix (std::string prefix)
 
void SetTypeName (std::string type_name)
 For convenience, we provide a NAME_OF_THIS macro so that the user doesn't have to store the type name as a string, because that could get out of sync if automatic refactoring tools are used.
 
JApplicationGetApplication () const
 
JLoggerGetLogger ()
 
std::string GetPrefix () const
 
JEventLevel GetLevel () const
 
std::string GetLoggerName () const
 
std::string GetPluginName () const
 
void SetLoggerName (std::string logger_name)
 
void SetPluginName (std::string plugin_name)
 
std::string GetTypeName () const
 
virtual void Summarize (JComponentSummary &) const
 
CallbackStyle GetCallbackStyle () const
 
Status GetStatus () const
 
void SetApplication (JApplication *app)
 
void SetLogger (JLogger logger)
 
template<typename F >
void CallWithJExceptionWrapper (std::string func_name, F func)
 
void RegisterParameter (ParameterBase *parameter)
 
void RegisterService (ServiceBase *service)
 
const std::vector< ParameterBase * > GetAllParameters () const
 

Additional Inherited Members

- Public Types inherited from jana::components::JComponent
enum class  Status {
  Uninitialized ,
  Initialized ,
  Opened ,
  Closed ,
  Finalized
}
 
enum class  CallbackStyle {
  LegacyMode ,
  ExpertMode ,
  DeclarativeMode
}
 
- Protected Attributes inherited from jana::components::JComponent
std::vector< ParameterBase * > m_parameters
 
std::vector< ServiceBase * > m_services
 
JEventLevel m_level = JEventLevel::PhysicsEvent
 
CallbackStyle m_callback_style = CallbackStyle::LegacyMode
 
std::string m_prefix
 
std::string m_plugin_name
 
std::string m_logger_name
 
std::string m_type_name
 
Status m_status = Status::Uninitialized
 
std::mutex m_mutex
 
JApplicationm_app = nullptr
 
JLogger m_logger
 

Member Function Documentation

◆ add_plugin()

void JPluginLoader::add_plugin ( std::string  plugin_name)

Add the specified plugin to the list of plugins to be attached. This only records the plugin name. The plugin is not actually attached until AttachPlugins() is called during JApplication::Initialize(). Note that any plugins specified by the 'plugins' parameter are loaded after any plugins specified via 'add_plugin'. This lets the maintainers of a project specify a minimum set of plugins that always get loaded, and enforce that their loading order. This also prevents users from clobbering the minimum plugin set, unless they explicitly intend to, in which case they should use the 'plugins_to_ignore' parameter.

Parameters
plugin_namename of the plugin. Do not include the ".so" or ".dylib" suffix in the name. The path to the plugin will be searched first from the 'jana:plugin_path' parameter, followed by the JANA_PLUGIN_PATH envar, followed by the JANA install prefix.

◆ add_plugin_path()

void JPluginLoader::add_plugin_path ( std::string  path)

Add a path to the directories searched for plugins. This should not include the plugin name itself. This only has an effect when called before AttachPlugins is called (i.e. before Run is called). n.b. if this is called with a path already in the list, then the call is silently ignored.

Generally, users will set the path via the JANA_PLUGIN_PATH environment variable and won't need to call this method. This may be called if it needs to be done programmatically.

Parameters
pathdirectory to search for plugins.

◆ attach_plugin()

void JPluginLoader::attach_plugin ( std::string  name,
std::string  path 
)

Attach a plugin by opening the shared object file and running the InitPlugin_t(JApplication* app) global C-style routine in it. An exception will be thrown if the plugin is not successfully opened. Users will not need to call this directly since it is called automatically from Initialize().

Referenced by attach_plugins().

◆ attach_plugins()

void JPluginLoader::attach_plugins ( JComponentManager jcm)

Loop over list of plugin names added via AddPlugin() and actually attach and initialize them. See AddPlugin method for more.

References attach_plugin().

◆ Init()

void JPluginLoader::Init ( )
overridevirtual

Reimplemented from JService.


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