|
degate 0.1.1
|
The PortColorManager manages color definitions based on common port names. More...
#include <PortColorManager.h>
Public Types | |
| typedef std::map< std::string, std::pair< color_t, color_t > > | port_color_collection |
Public Member Functions | |
| PortColorManager () | |
| Construct a new port color manager. | |
| ~PortColorManager () | |
| Destroy the port color mananger. | |
| void | set_color (std::string port_name, color_t frame_color_def, color_t fill_color_def) |
| Add a new color definition. | |
| void | remove_color (std::string port_name) |
| Remove a color definition. | |
| color_t | get_fill_color (std::string const &port_name) const |
| Get a fill color definition. | |
| color_t | get_frame_color (std::string const &port_name) const |
| Get a frame color definition. | |
| bool | has_color_definition (std::string const &port_name) const |
| Check if there exists a frame and fill color definition for a port name. | |
| port_color_collection::iterator | begin () |
| Get an iterator to iterate over port color definitions. | |
| port_color_collection::iterator | end () |
| Get an end iterator. | |
Private Attributes | |
| port_color_collection | port_color_map |
The PortColorManager manages color definitions based on common port names.
In degate you can define colors, which are used for the rendering. To make gate ports of the same type drawn in the same color, you can store a color specification in the PortColorManager.
Definition at line 39 of file PortColorManager.h.
| typedef std::map<std::string , std::pair<color_t, color_t> > degate::PortColorManager::port_color_collection |
Definition at line 42 of file PortColorManager.h.
| degate::PortColorManager::PortColorManager | ( | ) | [inline] |
| degate::PortColorManager::~PortColorManager | ( | ) | [inline] |
| port_color_collection::iterator degate::PortColorManager::begin | ( | ) | [inline] |
Get an iterator to iterate over port color definitions.
Definition at line 112 of file PortColorManager.h.
References port_color_map.
{
return port_color_map.begin();
}
| port_color_collection::iterator degate::PortColorManager::end | ( | ) | [inline] |
Get an end iterator.
Definition at line 120 of file PortColorManager.h.
References port_color_map.
{
return port_color_map.end();
}
| color_t degate::PortColorManager::get_fill_color | ( | std::string const & | port_name | ) | const [inline] |
Get a fill color definition.
| CollectionLookupException |
Definition at line 79 of file PortColorManager.h.
References port_color_map.
{
const port_color_collection::const_iterator iter = port_color_map.find(port_name);
if(iter != port_color_map.end()) {
return (*iter).second.second;
}
else throw CollectionLookupException("Can't lookup fill color.");
}
| color_t degate::PortColorManager::get_frame_color | ( | std::string const & | port_name | ) | const [inline] |
Get a frame color definition.
| CollectionLookupException |
Definition at line 91 of file PortColorManager.h.
References port_color_map.
{
const port_color_collection::const_iterator iter = port_color_map.find(port_name);
if(iter != port_color_map.end()) {
return (*iter).second.first;
}
else throw CollectionLookupException("Can't lookup frame color.");
}
| bool degate::PortColorManager::has_color_definition | ( | std::string const & | port_name | ) | const [inline] |
Check if there exists a frame and fill color definition for a port name.
Definition at line 102 of file PortColorManager.h.
References port_color_map.
{
const port_color_collection::const_iterator iter = port_color_map.find(port_name);
return (iter != port_color_map.end());
}
| void degate::PortColorManager::remove_color | ( | std::string | port_name | ) | [inline] |
Remove a color definition.
Definition at line 71 of file PortColorManager.h.
References port_color_map.
{
port_color_map.erase(port_name);
}
| void degate::PortColorManager::set_color | ( | std::string | port_name, |
| color_t | frame_color_def, | ||
| color_t | fill_color_def | ||
| ) | [inline] |
Add a new color definition.
Definition at line 64 of file PortColorManager.h.
References port_color_map.
{
port_color_map[port_name] = std::pair<color_t, color_t>(frame_color_def, fill_color_def);
}
Definition at line 46 of file PortColorManager.h.
Referenced by begin(), end(), get_fill_color(), get_frame_color(), has_color_definition(), remove_color(), and set_color().
1.7.4