|
HAL
v4.5.0-254-g8f9f6a423
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
#include <hal_core/netlist/data_container.h>


Public Member Functions | |
| DataContainer ()=default | |
| virtual | ~DataContainer ()=default |
| bool | operator== (const DataContainer &other) const |
| bool | operator!= (const DataContainer &other) const |
| bool | set_data (const std::string &category, const std::string &key, const std::string &data_type, const std::string &value, const bool log_with_info_level=false) |
| bool | has_data (const std::string &category, const std::string &key) const |
| std::tuple< std::string, std::string > | get_data (const std::string &category, const std::string &key) const |
| bool | delete_data (const std::string &category, const std::string &key, const bool log_with_info_level=false) |
| const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & | get_data_map () const |
| void | set_data_map (const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string >> &map) |
| Result< std::monostate > | set_parameter (const Parameter ¶m, const std::string &value) |
| Result< std::string > | get_parameter_value (const std::string &name) const |
| Result< std::string > | get_parameter_value (const Parameter &name) const |
| Result< Parameter > | get_parameter_declaration (const std::string &name) const |
| bool | has_parameter (const Parameter ¶m) const |
| bool | has_parameter (const std::string &name) const |
| bool | delete_parameter (const std::string &name) |
| const std::unordered_map< std::string, std::pair< Parameter, std::string > > & | get_parameters () const |
Protected Attributes | |
| std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > | m_data |
| std::unordered_map< std::string, std::pair< Parameter, std::string > > | m_parameters |
Container to hold data that is associated with an entity.
Definition at line 45 of file data_container.h.
|
default |
Construct a new data container.
|
virtualdefault |
| bool hal::DataContainer::delete_data | ( | const std::string & | category, |
| const std::string & | key, | ||
| const bool | log_with_info_level = false |
||
| ) |
Delete a data entry.
| [in] | category | - The data category. |
| [in] | key | - The data key. |
| [in] | log_with_info_level | - Force explicit logging channel 'netlist' with log level 'info' to trace GUI events. |
true on success, false otherwise. Definition at line 63 of file data_container.cpp.
References log_debug, log_error, log_info, and m_data.
Referenced by hal::data_container_init(), and hal::ActionSetObjectData::exec().
| bool hal::DataContainer::delete_parameter | ( | const std::string & | name | ) |
Delete an explicitly stored parameter value, if any.
| [in] | name | - The parameter name. |
true if a value was deleted, false otherwise. Definition at line 196 of file data_container.cpp.
References m_parameters, and name.
Referenced by hal::data_container_init(), and hal::ActionSetParameterValue::exec().
| std::tuple< std::string, std::string > hal::DataContainer::get_data | ( | const std::string & | category, |
| const std::string & | key | ||
| ) | const |
Get the data entry specified by the given category and key.
| [in] | category | - The data category. |
| [in] | key | - The data key. |
Definition at line 119 of file data_container.cpp.
References log_debug, log_error, and m_data.
Referenced by hal::data_container_init(), hal::cte::ClockTree::export_dot(), and hal::DataTableEntry::fromContainer().
| const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & hal::DataContainer::get_data_map | ( | ) | const |
Get a map from ((1) category, (2) key) to ((1) type, (2) value) containing all stored data entries.
Definition at line 94 of file data_container.cpp.
References m_data.
Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::data_container_init(), hal::CoordinateFromData::fromNode(), operator==(), hal::NetlistModificationDecorator::replace_gate(), hal::DataTableWidget::setGate(), and hal::DataTableWidget::setModule().
Get the full declaration of a typed parameter.
| [in] | name | - The parameter name. |
Definition at line 175 of file data_container.cpp.
References ERR, m_parameters, name, and OK.
Referenced by hal::ActionSetParameterValue::exec().
Get the value of a typed parameter. Returns the explicitly-stored value or an error if the parameter does not exist.
| [in] | param | - The parameter. |
Definition at line 159 of file data_container.cpp.
References ERR, hal::Parameter::get_name(), m_parameters, and OK.
| Result< std::string > hal::DataContainer::get_parameter_value | ( | const std::string & | name | ) | const |
Get the value of a typed parameter. Returns the explicitly-stored value or an error if the parameter does not exist.
| [in] | name | - The parameter name. |
Definition at line 149 of file data_container.cpp.
References ERR, m_parameters, name, and OK.
Referenced by hal::ActionSetParameterValue::exec(), and hal::xilinx_toolbox::split_shift_register().
| const std::unordered_map< std::string, std::pair< Parameter, std::string > > & hal::DataContainer::get_parameters | ( | ) | const |
Get all explicitly stored parameters as a map from name to (declaration, value).
Definition at line 201 of file data_container.cpp.
References m_parameters.
Referenced by hal::data_container_init(), operator==(), and hal::ParameterTableModel::updateData().
| bool hal::DataContainer::has_data | ( | const std::string & | category, |
| const std::string & | key | ||
| ) | const |
Determine whether an entry of given category and key exists.
| [in] | category | - The data category. |
| [in] | key | - The data key. |
true if the entry exists, false otherwise. Definition at line 104 of file data_container.cpp.
References m_data.
Referenced by hal::data_container_init(), and hal::DataTableEntry::fromContainer().
| bool hal::DataContainer::has_parameter | ( | const Parameter & | param | ) | const |
Check whether a parameter exists and has an explicitly stored value.
| [in] | param | - The parameter. |
true if the parameter is explicitly set, false otherwise. Definition at line 190 of file data_container.cpp.
References hal::Parameter::get_name(), and m_parameters.
Referenced by hal::data_container_init(), hal::ActionSetParameterValue::exec(), and hal::xilinx_toolbox::split_shift_register().
| bool hal::DataContainer::has_parameter | ( | const std::string & | name | ) | const |
Check whether a parameter with the given name exists and has an explicitly stored value.
| [in] | name | - The parameter name. |
true if the parameter is explicitly set, false otherwise. Definition at line 185 of file data_container.cpp.
References m_parameters, and name.
| bool hal::DataContainer::operator!= | ( | const DataContainer & | other | ) | const |
Check whether two data containers are unequal.
| [in] | other | - The data container to compare against. |
true if both data containers are unequal, false otherwise. Definition at line 34 of file data_container.cpp.
References operator==().
| bool hal::DataContainer::operator== | ( | const DataContainer & | other | ) | const |
Check whether two data containers are equal.
| [in] | other | - The data container to compare against. |
true if both data containers are equal, false otherwise. Definition at line 29 of file data_container.cpp.
References get_data_map(), get_parameters(), m_data, and m_parameters.
Referenced by operator!=().
| bool hal::DataContainer::set_data | ( | const std::string & | category, |
| const std::string & | key, | ||
| const std::string & | data_type, | ||
| const std::string & | value, | ||
| const bool | log_with_info_level = false |
||
| ) |
Add a data entry.
May overwrite an existing entry.
| [in] | category | - The data category. |
| [in] | key | - The data key. |
| [in] | data_type | - The data type. |
| [in] | value | - The data value. |
| [in] | log_with_info_level | - Force explicit logging channel 'netlist' with log level 'info' to trace GUI events. |
true on success, false otherwise. Definition at line 39 of file data_container.cpp.
References log_debug, log_error, log_info, and m_data.
Referenced by hal::module_identification::Result::create_modules_in_netlist(), hal::data_container_init(), hal::xilinx_toolbox::split_lut(), and hal::DataTableEntry::toContainer().
| void hal::DataContainer::set_data_map | ( | const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string >> & | map | ) |
Overwrite the existing data with a new map from ((1) category, (2) key) to ((1) type, (2) value).
| [in] | map | - The new data map. |
Definition at line 99 of file data_container.cpp.
References m_data.
Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::NetlistModificationDecorator::replace_gate().
| Result< std::monostate > hal::DataContainer::set_parameter | ( | const Parameter & | param, |
| const std::string & | value | ||
| ) |
Set (or overwrite) the value of a typed parameter as a string. The value is validated and normalized before being stored. Any existing entry with the same name is replaced.
| [in] | param | - The parameter declaration. |
| [in] | value | - The value to store as a string. |
Definition at line 136 of file data_container.cpp.
References ERR, hal::Parameter::get_name(), hal::Parameter::get_type(), m_parameters, OK, and hal::Parameter::validate().
Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::ActionSetParameterValue::exec(), and hal::LUTComponent::set_init_string().
|
protected |
Definition at line 192 of file data_container.h.
Referenced by delete_data(), get_data(), get_data_map(), has_data(), operator==(), set_data(), and set_data_map().
|
protected |
Definition at line 193 of file data_container.h.
Referenced by delete_parameter(), get_parameter_declaration(), get_parameter_value(), get_parameters(), has_parameter(), operator==(), and set_parameter().