HAL
hal::netlist_writer_manager Namespace Reference

Typedefs

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

Functions

ProgramOptions get_cli_options ()
 
const std::unordered_map< std::string, std::vector< std::string > > & get_writer_extensions ()
 Retrieve the extensions for which extensions have been registered. More...
 
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 (Netlist *netlist, const ProgramArguments &args)
 
bool write (Netlist *netlist, const std::filesystem::path &file_path)
 

Detailed Description

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

Typedef Documentation

◆ WriterFactory

using hal::netlist_writer_manager::WriterFactory = typedef std::function<std::unique_ptr<NetlistWriter>()>

Definition at line 50 of file netlist_writer_manager.h.

Function Documentation

◆ get_cli_options()

ProgramOptions hal::netlist_writer_manager::get_cli_options ( )

Return the command line interface options of the netlist writer dispatcher.

Returns
The options.

Definition at line 41 of file netlist_writer_manager.cpp.

References hal::ProgramOptions::A_REQUIRED_PARAMETER, and hal::ProgramOptions::add().

◆ get_writer_extensions()

const std::unordered_map< std::string, std::vector< std::string > > & hal::netlist_writer_manager::get_writer_extensions ( )

Retrieve the extensions for which extensions have been registered.

Returns
Vector of extensions for each registered writer

Definition at line 48 of file netlist_writer_manager.cpp.

◆ register_writer()

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

Register a new netlist 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 53 of file netlist_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::netlist_writer_manager::unregister_writer ( const std::string &  name)

Unregister the specified writer.

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

Definition at line 74 of file netlist_writer_manager.cpp.

References log_info, and name.

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

◆ write() [1/2]

bool hal::netlist_writer_manager::write ( Netlist netlist,
const ProgramArguments args 
)

Write the given netlist into a file at the location specified by command line options.

Parameters
[in]netlist- The netlist.
[in]args- The command line options.
Returns
True on success, false otherwise.

Definition at line 90 of file netlist_writer_manager.cpp.

References control::args, and test_multiple::netlist.

Referenced by hal::ExportRegisteredFormat::exportNetlist(), and hal::netlist_writer_manager_init().

◆ write() [2/2]

bool hal::netlist_writer_manager::write ( Netlist netlist,
const std::filesystem::path &  file_path 
)

Write the given netlist into a file at the given location.

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

Definition at line 101 of file netlist_writer_manager.cpp.

References log_error, log_info, and test_multiple::netlist.