HAL
hal::netlist_parser_manager Namespace Reference

Typedefs

using ParserFactory = std::function< std::unique_ptr< NetlistParser >()>
 

Functions

ProgramOptions get_cli_options ()
 
bool can_parse (const std::filesystem::path &file_name)
 
void register_parser (const std::string &name, const ParserFactory &parser_factory, const std::vector< std::string > &supported_file_extensions)
 
void unregister_parser (const std::string &name)
 
std::unique_ptr< Netlistparse (const std::filesystem::path &file_name, const ProgramArguments &args)
 
std::unique_ptr< Netlistparse (const std::filesystem::path &file_name, const GateLibrary *gate_library)
 
std::vector< std::unique_ptr< Netlist > > parse_all (const std::filesystem::path &file_name)
 
std::unordered_map< std::string, std::vector< std::string > > get_parser_to_extensions ()
 

Typedef Documentation

◆ ParserFactory

using hal::netlist_parser_manager::ParserFactory = typedef std::function<std::unique_ptr<NetlistParser>()>

Definition at line 47 of file netlist_parser_manager.h.

Function Documentation

◆ can_parse()

bool hal::netlist_parser_manager::can_parse ( const std::filesystem::path &  file_name)

Checks whether there is a parser registered for file extension

Parameters
file_name- The input file
Returns
true if parser could be found.

Definition at line 135 of file netlist_parser_manager.cpp.

References hal::utils::to_lower().

Referenced by hal::FileManager::directoryStatus().

◆ get_cli_options()

NETLIST_API ProgramOptions hal::netlist_parser_manager::get_cli_options ( )

Returns the command line interface options of the hdl parser manager

Returns
The options.

Definition at line 130 of file netlist_parser_manager.cpp.

Referenced by Q_DECLARE_METATYPE().

◆ get_parser_to_extensions()

std::unordered_map< std::string, std::vector< std::string > > hal::netlist_parser_manager::get_parser_to_extensions ( )

Returns parser map

Returns
Vector of extensions for each parser plugin

Definition at line 238 of file netlist_parser_manager.cpp.

◆ parse() [1/2]

NETLIST_API std::unique_ptr< Netlist > hal::netlist_parser_manager::parse ( const std::filesystem::path &  file_name,
const GateLibrary gate_library = nullptr 
)

Returns the netlist for a file, parsed with a defined gate library.

Parameters
[in]file_name- The input file.
[in]gate_library- The gate library used in the file.
Returns
The netlist representation of the hdl code or a nullpointer on error.

Definition at line 209 of file netlist_parser_manager.cpp.

References configuration::netlists.

◆ parse() [2/2]

NETLIST_API std::unique_ptr< Netlist > hal::netlist_parser_manager::parse ( const std::filesystem::path &  file_name,
const ProgramArguments args 
)

Returns the netlist for the file and specified command line options.

Parameters
[in]file_name- The input file.
[in]args- The command line options.
Returns
The netlist representation of the hdl code or a nullpointer on error.

Definition at line 185 of file netlist_parser_manager.cpp.

References control::args, hal::gate_library_manager::get_gate_library(), and log_error.

Referenced by hal::netlist_factory::load_netlist().

◆ parse_all()

std::vector< std::unique_ptr< Netlist > > hal::netlist_parser_manager::parse_all ( const std::filesystem::path &  file_name)

If gatelibrary name is empty : tries to match the HDL file with each of the preloaded gate libraries and returns a vector of netlist objects for which the matching was successful.

Parameters
[in]file_name- The netlist file.
Returns
A vector containing one netlist per matching gate library.

Definition at line 227 of file netlist_parser_manager.cpp.

Referenced by hal::netlist_factory::load_netlists().

◆ register_parser()

NETLIST_API void hal::netlist_parser_manager::register_parser ( const std::string &  name,
const ParserFactory parser_factory,
const std::vector< std::string > &  supported_file_extensions 
)

Registers a new HDL parser for a selection of file types. If parsers for some of the extensions already exist, they are not changed, only the new ones are registered.

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

Definition at line 148 of file netlist_parser_manager.cpp.

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

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

◆ unregister_parser()

NETLIST_API void hal::netlist_parser_manager::unregister_parser ( const std::string &  name)

Unregisters a specific parser.

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

Definition at line 169 of file netlist_parser_manager.cpp.

References log_info, and name.

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