Loading...
Searching...
No Matches
eonc::IPluginLoader Class Referenceabstract

#include <PluginLoader.h>

Inheritance diagram for eonc::IPluginLoader:

Public Member Functions

virtual void add_config_paths (const std::string &colon_paths)=0
 Inject search paths from the eOn config file.
virtual bool lib_present (const char *lib_base) const =0
 Filesystem probe: a matching library file is on the configured search path.
virtual const std::vector< std::string > & search_paths () const noexcept=0
 Get the current search paths (for diagnostics).
virtual void throw_not_found (const char *lib_base, const char *description) const =0
 Throw a descriptive error for a missing potential library.
template<typename Fn>
Fn load_sym (const char *lib_base, const char *sym_name)
 Load a symbol from a named potential library.
virtual ~IPluginLoader ()=default
 IPluginLoader (const IPluginLoader &)=delete
IPluginLoader & operator= (const IPluginLoader &)=delete

Protected Member Functions

 IPluginLoader ()=default
virtual dynlib::Handle open_lib (const char *lib_base)=0

Detailed Description

Definition at line 44 of file PluginLoader.h.

Constructor & Destructor Documentation

◆ ~IPluginLoader()

virtual eonc::IPluginLoader::~IPluginLoader ( )
virtualdefault

◆ IPluginLoader() [1/2]

eonc::IPluginLoader::IPluginLoader ( const IPluginLoader & )
delete

◆ IPluginLoader() [2/2]

eonc::IPluginLoader::IPluginLoader ( )
protecteddefault

Member Function Documentation

◆ add_config_paths()

virtual void eonc::IPluginLoader::add_config_paths ( const std::string & colon_paths)
pure virtual

Inject search paths from the eOn config file.

Parameters
colon_pathscolon-separated directory list (may be empty) These paths are inserted before the EON_POTENTIALS_PATH paths.

Implemented in eonc::PluginLoader.

◆ lib_present()

virtual bool eonc::IPluginLoader::lib_present ( const char * lib_base) const
nodiscardpure virtual

Filesystem probe: a matching library file is on the configured search path.

Does not dlopen, so plugin static initializers (banners) do not run.

Implemented in eonc::PluginLoader.

◆ load_sym()

template<typename Fn>
Fn eonc::IPluginLoader::load_sym ( const char * lib_base,
const char * sym_name )
inline

Load a symbol from a named potential library.

Parameters
lib_baseBase name without platform prefix/suffix (e.g. "eon_sw")
sym_nameSymbol to load (e.g. "sw_")
Returns
Function pointer, or nullptr if not found.

Definition at line 69 of file PluginLoader.h.

69 {
70 dynlib::Handle h = open_lib(lib_base);
71 if (!h)
72 return nullptr;
73 return dynlib::loadSym<Fn>(h, sym_name);
74 }
virtual dynlib::Handle open_lib(const char *lib_base)=0
void * Handle
Definition DynLib.h:60
Fn loadSym(Handle h, const char *name) noexcept
Load a symbol and cast to a function pointer type.
Definition DynLib.h:99

◆ open_lib()

virtual dynlib::Handle eonc::IPluginLoader::open_lib ( const char * lib_base)
protectedpure virtual

Implemented in eonc::PluginLoader.

◆ operator=()

IPluginLoader & eonc::IPluginLoader::operator= ( const IPluginLoader & )
delete

◆ search_paths()

virtual const std::vector< std::string > & eonc::IPluginLoader::search_paths ( ) const
nodiscardpure virtualnoexcept

Get the current search paths (for diagnostics).

Implemented in eonc::PluginLoader.

◆ throw_not_found()

virtual void eonc::IPluginLoader::throw_not_found ( const char * lib_base,
const char * description ) const
pure virtual

Throw a descriptive error for a missing potential library.

Implemented in eonc::PluginLoader.


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