![]() |
HAL
|
Classes | |
struct | PluginFeature |
Functions | |
std::filesystem::path | get_plugin_path (std::string plugin_name) |
bool | has_valid_file_extension (std::filesystem::path file_name) |
std::set< std::string > | get_plugin_names () |
std::vector< PluginFeature > | get_plugin_features (std::string name) |
std::unordered_map< std::string, std::string > | get_cli_plugin_flags () |
std::unordered_map< std::string, std::string > | get_ui_plugin_flags () |
ProgramOptions | get_cli_plugin_options () |
bool | load_all_plugins (const std::vector< std::filesystem::path > &directory_names) |
bool | load (const std::string &plugin_name, const std::filesystem::path &file_path_or_empty) |
bool | unload_all_plugins () |
bool | unload (const std::string &plugin_name) |
BasePluginInterface * | get_plugin_instance (const std::string &plugin_name, bool initialize, bool silent) |
u64 | add_model_changed_callback (std::function< void(bool, std::string const &, std::string const &)> callback) |
void | remove_model_changed_callback (u64 id) |
void | add_existing_options_description (const ProgramOptions &existing_options) |
template<typename T > | |
T * | get_plugin_instance (const std::string &plugin_name, bool initialize=true) |
template<typename T > | |
T * | get_first_extension (const std::string &plugin_name, bool initialize=true) |
The plugin manager takes care of loading and unloading plugins at runtime.
void hal::plugin_manager::add_existing_options_description | ( | const ProgramOptions & | existing_options | ) |
TODO Python binding.
Register existing program options to avoid reuse by plugins.
[in] | existing_options | - The program options. |
Definition at line 454 of file plugin_manager.cpp.
u64 hal::plugin_manager::add_model_changed_callback | ( | std::function< void(bool, std::string const &, std::string const &)> | callback | ) |
TODO Python binding.
Add a callback to notify the GUI about loaded or unloaded plugins.
[in] | callback | - The callback function. Parameters are:
|
Definition at line 439 of file plugin_manager.cpp.
References log_error.
Referenced by hal::PluginRelay::PluginRelay().
std::unordered_map< std::string, std::string > hal::plugin_manager::get_cli_plugin_flags | ( | ) |
TODO Python binding.
Get a mapping of flags pointing to their corresponding CLI plugin.
Definition at line 140 of file plugin_manager.cpp.
ProgramOptions hal::plugin_manager::get_cli_plugin_options | ( | ) |
TODO Python binding.
Get command line interface options for all plugins.
Definition at line 150 of file plugin_manager.cpp.
T* hal::plugin_manager::get_first_extension | ( | const std::string & | plugin_name, |
bool | initialize = true |
||
) |
Get first plugin extension of given type T.
[in] | plugin_name | - The name of the plugin. |
[in] | initialize | - If false, the plugin's initialize function is not called. |
Definition at line 167 of file plugin_manager.h.
References hal::BasePluginInterface::get_first_extension(), get_plugin_instance(), hal::initialize(), and hal::T.
std::vector< PluginFeature > hal::plugin_manager::get_plugin_features | ( | std::string | name | ) |
Returns list of features for plugin identified by file name stem
name | file name stem |
Definition at line 133 of file plugin_manager.cpp.
References name.
Referenced by hal::GuiPluginEntry::updateFromLoaded().
BasePluginInterface * hal::plugin_manager::get_plugin_instance | ( | const std::string & | plugin_name, |
bool | initialize = true , |
||
bool | silent = false |
||
) |
Gets the basic interface for a plugin specified by name. By default calls the initialize() function of the plugin.
[in] | plugin_name | - The name of the plugin. |
[in] | initialize | - If false, the plugin's initialize function is not called. |
[in] | silent | - If true error message gets omitted if plugin not found |
Definition at line 421 of file plugin_manager.cpp.
References hal::initialize(), and log_error.
Referenced by get_first_extension(), get_plugin_instance(), hal::GuiPluginManager::getGuiExtensions(), and hal::GuiPluginTable::load().
T* hal::plugin_manager::get_plugin_instance | ( | const std::string & | plugin_name, |
bool | initialize = true |
||
) |
TODO Python bindings for different types and extend by initialize flag.
Gets a specific interface for a plugin specified by name. By default calls the initialize() function of the plugin.
[in] | plugin_name | - The name of the plugin. |
[in] | initialize | - If false, the plugin's initialize function is not called. |
Definition at line 154 of file plugin_manager.h.
References get_plugin_instance(), hal::initialize(), and hal::T.
std::set< std::string > hal::plugin_manager::get_plugin_names | ( | ) |
Get the names of all loaded plugins.
Definition at line 123 of file plugin_manager.cpp.
References names.
Referenced by hal::GuiPluginManager::getGuiExtensions(), hal::plugin_manager_init(), and unload_all_plugins().
std::filesystem::path hal::plugin_manager::get_plugin_path | ( | std::string | plugin_name | ) |
Get the full path for plugin. Will probe several possible extension on MAC
Definition at line 92 of file plugin_manager.cpp.
References ALTERNATE_LIBRARY_FILE_EXTENSION, hal::utils::get_file(), and LIBRARY_FILE_EXTENSION.
Referenced by hal::GuiPluginEntry::GuiPluginEntry(), and load().
std::unordered_map< std::string, std::string > hal::plugin_manager::get_ui_plugin_flags | ( | ) |
TODO Python binding.
Get a mapping of flags pointing to their corresponding UI plugin.
Definition at line 145 of file plugin_manager.cpp.
bool hal::plugin_manager::has_valid_file_extension | ( | std::filesystem::path | file_name | ) |
Returns whether file has an extension which is legal for plugins in OS
file_name |
Definition at line 103 of file plugin_manager.cpp.
References ALTERNATE_LIBRARY_FILE_EXTENSION, hal::utils::ends_with(), and LIBRARY_FILE_EXTENSION.
Referenced by load_all_plugins().
bool hal::plugin_manager::load | ( | const std::string & | plugin_name, |
const std::filesystem::path & | file_path = std::filesystem::path() |
||
) |
Load a single plugin by specifying its name and file path.
[in] | plugin_name | - The desired name that is unique in the framework. |
[in] | file_path | - The path to the plugin file. |
Definition at line 181 of file plugin_manager.cpp.
References hal::FacExtensionInterface::FacGatelibParser, hal::FacExtensionInterface::FacGatelibWriter, hal::FacExtensionInterface::FacNetlistParser, hal::FacExtensionInterface::FacNetlistWriter, hal::FacExtensionInterface::factory_provider, hal::FacExtensionInterface::FacUnknown, hal::CliExtensionInterface::get_cli_options(), hal::FacExtensionInterface::get_description(), hal::FacExtensionInterface::get_feature(), hal::BasePluginInterface::get_name(), get_plugin_path(), hal::FacExtensionInterface::get_supported_file_extensions(), log_debug, log_error, log_info, hal::FacFactoryProvider< T >::m_factory, hal::gate_library_parser_manager::register_parser(), hal::netlist_parser_manager::register_parser(), hal::gate_library_writer_manager::register_writer(), and hal::netlist_writer_manager::register_writer().
Referenced by hal::GuiPluginTable::handleButtonPressed(), hal::GuiPluginTable::load(), load_all_plugins(), and hal::plugin_manager_init().
bool hal::plugin_manager::load_all_plugins | ( | const std::vector< std::filesystem::path > & | directory_names = {} | ) |
Load all plugins in the specified diretories.
If directory_names
is empty, the default directories will be searched.
[in] | directory_names | - A vector of directory paths. |
Definition at line 155 of file plugin_manager.cpp.
References file, has_valid_file_extension(), load(), and log_debug.
Referenced by hal::plugin_manager_init(), and hal::VerilogWriterTest::SetUp().
void hal::plugin_manager::remove_model_changed_callback | ( | u64 | id | ) |
TODO Python binding.
Remove a registered callback.
[in] | id | - The id of the registered callback. |
Definition at line 449 of file plugin_manager.cpp.
Referenced by hal::PluginRelay::~PluginRelay().
bool hal::plugin_manager::unload | ( | const std::string & | plugin_name | ) |
Releases a single plugin and its associated ressources.
[in] | plugin_name | - The name of the plugin to unload. |
Definition at line 346 of file plugin_manager.cpp.
References hal::FacExtensionInterface::FacGatelibParser, hal::FacExtensionInterface::FacGatelibWriter, hal::FacExtensionInterface::FacNetlistParser, hal::FacExtensionInterface::FacNetlistWriter, hal::FacExtensionInterface::get_description(), hal::FacExtensionInterface::get_feature(), log_debug, log_info, name, hal::gate_library_parser_manager::unregister_parser(), hal::netlist_parser_manager::unregister_parser(), hal::gate_library_writer_manager::unregister_writer(), and hal::netlist_writer_manager::unregister_writer().
Referenced by hal::GuiPluginTable::handleButtonPressed(), hal::plugin_manager_init(), and unload_all_plugins().
bool hal::plugin_manager::unload_all_plugins | ( | ) |
Releases all plugins and their associated resources.
Definition at line 327 of file plugin_manager.cpp.
References get_plugin_names(), log_debug, log_error, log_info, name, and unload().
Referenced by hal::plugin_manager_init(), and hal::VerilogWriterTest::TearDown().