![]() |
HAL
|
#include <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) |
Protected Attributes | |
std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > | m_data |
Container to hold data that is associated with an entity.
Definition at line 41 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. |
Definition at line 41 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().
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 97 of file data_container.cpp.
References log_debug, log_error, and m_data.
Referenced by hal::data_container_init(), hal::ActionSetObjectData::exec(), and hal::TEST_F().
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 72 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().
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. |
Definition at line 82 of file data_container.cpp.
References m_data.
Referenced by hal::data_container_init(), and hal::ActionSetObjectData::exec().
bool hal::DataContainer::operator!= | ( | const DataContainer & | other | ) | const |
Check whether two data containers are unequal.
[in] | other | - The data container to compare against. |
Definition at line 12 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. |
Definition at line 7 of file data_container.cpp.
References get_data_map(), and m_data.
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. |
Definition at line 17 of file data_container.cpp.
References log_debug, log_error, log_info, and m_data.
Referenced by hal::data_container_init(), hal::ActionSetObjectData::exec(), and hal::TEST_F().
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 77 of file data_container.cpp.
References m_data.
Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::NetlistModificationDecorator::replace_gate().
|
protected |
Definition at line 123 of file data_container.h.
Referenced by delete_data(), get_data(), get_data_map(), has_data(), operator==(), set_data(), and set_data_map().