degate  0.1.2
Public Types | Public Member Functions | Private Attributes
degate::PortColorManager Class Reference

The PortColorManager manages color definitions based on common port names. More...

#include <PortColorManager.h>

List of all members.

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

Detailed Description

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.


Member Typedef Documentation

typedef std::map<std::string , std::pair<color_t, color_t> > degate::PortColorManager::port_color_collection

Definition at line 42 of file PortColorManager.h.


Constructor & Destructor Documentation

Construct a new port color manager.

Definition at line 54 of file PortColorManager.h.

{}

Destroy the port color mananger.

Definition at line 59 of file PortColorManager.h.

{};

Member Function Documentation

port_color_collection::iterator degate::PortColorManager::begin ( ) [inline]

Get an iterator to iterate over port color definitions.

See also:
end()

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.

See also:
begin()

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.

Exceptions:
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.

Exceptions:
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);
    }

Member Data Documentation


The documentation for this class was generated from the following file: