HAL
hal::gate_library_writer_manager Namespace Reference

Typedefs

using WriterFactory = std::function< std::unique_ptr< GateLibraryWriter >()>
 

Functions

void register_writer (const std::string &name, const WriterFactory &writer_factory, const std::vector< std::string > &supported_file_extensions)
 
void unregister_writer (const std::string &name)
 
bool write (const GateLibrary *gate_lib, const std::filesystem::path &file_path)
 

Detailed Description

The gate library writer manager keeps track of all gate library writers that are available within HAL. It is used to dispatch writing tasks to the respective writers.

Typedef Documentation

◆ WriterFactory

using hal::gate_library_writer_manager::WriterFactory = typedef std::function<std::unique_ptr<GateLibraryWriter>()>

Definition at line 46 of file gate_library_writer_manager.h.

Function Documentation

◆ register_writer()

NETLIST_API void hal::gate_library_writer_manager::register_writer ( const std::string &  name,
const WriterFactory writer_factory,
const std::vector< std::string > &  supported_file_extensions 
)

Register a new gate library writer for a selection of file types.
If writers for some of the extensions already exist, they remain unchanged and the new parser is not registered at all.

Parameters
[in]name- The name of the writer.
[in]writer_factory- A factory function that constructs a new writer instance.
[in]supported_file_extensions- The file extensions this writer can process.

Definition at line 40 of file gate_library_writer_manager.cpp.

References log_info, log_warning, name, hal::utils::to_lower(), and hal::utils::trim().

Referenced by hal::plugin_manager::load().

◆ unregister_writer()

NETLIST_API void hal::gate_library_writer_manager::unregister_writer ( const std::string &  name)

Unregister the specified writer.

Parameters
[in]name- The name of the writer.

Definition at line 61 of file gate_library_writer_manager.cpp.

References log_info, and name.

Referenced by hal::plugin_manager::unload().

◆ write()

NETLIST_API bool hal::gate_library_writer_manager::write ( const GateLibrary gate_lib,
const std::filesystem::path &  file_path 
)

Write the gate library into a file at the given location.

Parameters
[in]gate_lib- The gate library.
[in]file_path- The output path.
Returns
True on success, false otherwise.

Definition at line 77 of file gate_library_writer_manager.cpp.

References hal::GateLibrary::get_name(), log_error, and log_info.

Referenced by hal::gate_library_manager::save().