HAL  v4.5.0-124-g47ab54673
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::gate_library_manager Namespace Reference

Functions

GateLibraryload (std::filesystem::path file_path, bool reload=false)
 
void load_all (bool reload=false)
 
std::vector< std::filesystem::path > get_all_path ()
 
bool save (std::filesystem::path file_path, GateLibrary *gate_lib, bool overwrite=false)
 
void remove (std::filesystem::path file_path)
 
GateLibraryget_gate_library (const std::string &file_path)
 
GateLibraryget_gate_library_by_name (const std::string &lib_name)
 
std::vector< GateLibrary * > get_gate_libraries ()
 
std::shared_ptr< GateLibraryget_owning (const GateLibrary *gate_lib)
 

Detailed Description

The gate library manager keeps track of all gate libraries that are used within HAL. Further, it takes care of loading and saving gate libraries on demnand.

Function Documentation

◆ get_all_path()

std::vector< std::filesystem::path > hal::gate_library_manager::get_all_path ( )

Lists all pathnames to gate libraries

Returns
Vector of path

Definition at line 134 of file gate_library_manager.cpp.

References hal::utils::get_gate_library_directories().

Referenced by hal::GateLibrarySelectionTable::GateLibrarySelectionTable(), and hal::NewProjectDialog::NewProjectDialog().

◆ get_gate_libraries()

std::vector< GateLibrary * > hal::gate_library_manager::get_gate_libraries ( )

Get all loaded gate libraries.

Returns
A vector of gate libraries.

Definition at line 239 of file gate_library_manager.cpp.

Referenced by hal::gate_library_manager_init().

◆ get_gate_library()

GateLibrary * hal::gate_library_manager::get_gate_library ( const std::string &  file_path)

Get a gate library by file path. If no library with the given name is loaded, loading the gate library from file will be attempted.

Parameters
[in]file_path- The input path.
Returns
The gate library on success, nullptr otherwise.

Definition at line 193 of file gate_library_manager.cpp.

References hal::utils::get_file(), hal::utils::get_gate_library_directories(), load(), and log_info.

Referenced by hal::gate_library_manager_init(), hal::python_bindings_detail::owner_of(), and hal::netlist_parser_manager::parse().

◆ get_gate_library_by_name()

GateLibrary * hal::gate_library_manager::get_gate_library_by_name ( const std::string &  lib_name)

Get a gate library by name. If no library with the given name is loaded, a nullptr will be returned.

Parameters
[in]lib_name- The name of the gate library.
Returns
The gate library on success, nullptr otherwise.

Definition at line 227 of file gate_library_manager.cpp.

Referenced by hal::gate_library_manager_init().

◆ get_owning()

std::shared_ptr< GateLibrary > hal::gate_library_manager::get_owning ( const GateLibrary gate_lib)

Get the owning pointer to a gate library, so that it can be kept alive independently of the manager.

Reloading a library replaces it in the manager and destroys the one loaded before, which would leave every netlist built against it pointing into freed memory. Holding the owning pointer prevents that.

Parameters
[in]gate_lib- The gate library.
Returns
The owning pointer, non-owning if the library is not managed here.

Definition at line 170 of file gate_library_manager.cpp.

References UNUSED.

Referenced by hal::gate_library_manager_init(), and hal::netlist_init().

◆ load()

GateLibrary * hal::gate_library_manager::load ( std::filesystem::path  file_path,
bool  reload = false 
)

Load a gate library from file.

Parameters
[in]file_path- The input path.
[in]reload- If true, reloads the library in case it is already loaded.
Returns
The gate library on success, nullptr otherwise.

Definition at line 75 of file gate_library_manager.cpp.

References log_error, log_info, and hal::gate_library_parser_manager::parse().

Referenced by hal::gate_library_manager_init(), get_gate_library(), load_all(), hal::netlist_factory::load_netlist(), hal::netlist_factory::load_netlist_from_string(), and hal::FileManager::newProject().

◆ load_all()

void hal::gate_library_manager::load_all ( bool  reload = false)

Load all gate libraries available in standard gate library directories.

Parameters
[in]reload- If true, reloads all libraries that have already been loaded.

Definition at line 114 of file gate_library_manager.cpp.

References hal::utils::get_gate_library_directories(), load(), and log_info.

Referenced by hal::gate_library_manager_init().

◆ remove()

void hal::gate_library_manager::remove ( std::filesystem::path  file_path)

◆ save()