|
degate 0.1.1
|
The project class is a container for project related data. More...
#include <Project.h>
Public Member Functions | |
| Project (length_t width, length_t height) | |
| Create a new and empty project. | |
| Project (length_t width, length_t height, std::string const &_directory, unsigned int layers=0) | |
| Create a new and empty project. | |
| virtual | ~Project () |
| The destructor. | |
| void | set_project_directory (std::string const &_directory) |
| Set the project directory. | |
| std::string const & | get_project_directory () |
| Get the project directory. | |
| BoundingBox const & | get_bounding_box () const |
| Get the bounding box that represents the covered area for this project. | |
| unsigned int | get_width () const |
| Get the width of the project. | |
| unsigned int | get_height () const |
| get the height of a project. | |
| LogicModel_shptr | get_logic_model () |
| Get the logic model. | |
| void | set_logic_model (LogicModel_shptr _logic_model) |
| Set the logic model for a project. | |
| void | set_name (std::string _name) |
| std::string const & | get_name () const |
| void | set_description (std::string _description) |
| std::string const & | get_description () const |
| void | set_degate_version (std::string version_str) |
| std::string const & | get_degate_version () |
| void | set_lambda (length_t l) |
| length_t | get_lambda () const |
| void | set_default_pin_diameter (diameter_t pin_diameter) |
| diameter_t | get_default_pin_diameter () const |
| void | set_default_wire_diameter (diameter_t wire_diameter) |
| diameter_t | get_default_wire_diameter () const |
| void | set_default_port_diameter (diameter_t port_diameter) |
| diameter_t | get_default_port_diameter () const |
| void | set_default_color (ENTITY_COLOR e, color_t c) |
| Set the default color for an entity. | |
| color_t | get_default_color (ENTITY_COLOR e) const |
| Get the default color for an entity. | |
| const default_colors_t | get_default_colors () const |
| Get all color defaults. | |
| void | set_changed (bool state=true) |
| Set changed flag to indicate that the project data was changed. | |
| bool | is_changed () const |
| Check if the project was changed. | |
| time_t | get_time_since_last_save () const |
| Get time since last "save". | |
| void | reset_last_saved_counter () |
| Reset last save counter. | |
| RegularGrid_shptr | get_regular_horizontal_grid () |
| RegularGrid_shptr | get_regular_vertical_grid () |
| IrregularGrid_shptr | get_irregular_horizontal_grid () |
| IrregularGrid_shptr | get_irregular_vertical_grid () |
| PortColorManager_shptr | get_port_color_manager () |
| void | print (std::ostream &) |
| Dump basic meta data for the project as human readable text into an ostream. | |
| void | print_all (std::ostream &) |
| Dump most meta data for the project as human readable text into an ostream. | |
| void | set_server_url (std::string const &server_url) |
| Set server url. | |
| std::string | get_server_url () const |
| Get server url. | |
| transaction_id_t | get_last_pulled_tid () const |
| Get the last pulled transaction ID. | |
| void | set_last_pulled_tid (transaction_id_t tid) |
| Set last pulled transaction ID. | |
| double | get_pixel_per_um () const |
| Get the ratio of pixels per micrometer. | |
| void | set_pixel_per_um (double pix_per_um) |
| Get the ratio of pixels per micrometer. | |
| int | get_template_dimension () const |
| Get the template dimension. | |
| void | set_template_dimension (int template_dimension) |
| Set the template dimension. | |
| void | set_font_size (unsigned int font_size) |
| Set the default font size. | |
| unsigned int | get_font_size () const |
| Get the default font size. | |
| RCBase::container_type & | get_rcv_blacklist () |
| Get a list of blacklisted Rule Check violations. | |
Private Member Functions | |
| void | init_default_values () |
Private Attributes | |
| BoundingBox | bounding_box |
| std::string | name |
| std::string | description |
| std::string | degate_version |
| std::string | directory |
| std::string | server_url |
| RegularGrid_shptr | regular_horizontal_grid |
| RegularGrid_shptr | regular_vertical_grid |
| IrregularGrid_shptr | irregular_horizontal_grid |
| IrregularGrid_shptr | irregular_vertical_grid |
| bool | changed |
| time_t | last_persistent_version |
| diameter_t | default_pin_diameter |
| diameter_t | default_wire_diameter |
| diameter_t | default_port_diameter |
| length_t | lambda |
| transaction_id_t | last_transaction_id |
| LogicModel_shptr | logic_model |
| PortColorManager_shptr | port_color_manager |
| default_colors_t | default_colors |
| double | pixel_per_um |
| int | template_dimension |
| RCBase::container_type | rcv_blacklist |
| unsigned int | font_size |
Create a new and empty project.
It will create an empty logic model as well.
Definition at line 33 of file Project.cc.
References init_default_values().
: bounding_box(width, height), logic_model(new LogicModel(width, height)), port_color_manager(new PortColorManager()) { init_default_values(); }

| Project::Project | ( | length_t | width, |
| length_t | height, | ||
| std::string const & | _directory, | ||
| unsigned int | layers = 0 |
||
| ) |
Create a new and empty project.
It will create an empty logic model as well.
Definition at line 41 of file Project.cc.
References init_default_values().
: bounding_box(width, height), directory(_directory), logic_model(new LogicModel(width, height, layers)), port_color_manager(new PortColorManager()) { init_default_values(); }

| Project::~Project | ( | ) | [virtual] |
| BoundingBox const & Project::get_bounding_box | ( | ) | const |
Get the bounding box that represents the covered area for this project.
Definition at line 60 of file Project.cc.
References bounding_box.
{
return bounding_box;
}
| color_t Project::get_default_color | ( | ENTITY_COLOR | e | ) | const |
Get the default color for an entity.
Definition at line 274 of file Project.cc.
References default_colors.
{
default_colors_t::const_iterator i = default_colors.find(e);
if(i == default_colors.end()) return 0;
else return i->second;
}
| const default_colors_t Project::get_default_colors | ( | ) | const |
Get all color defaults.
Definition at line 280 of file Project.cc.
References default_colors.
{
return default_colors;
}
| diameter_t Project::get_default_pin_diameter | ( | ) | const |
Definition at line 118 of file Project.cc.
References default_pin_diameter.
{
return default_pin_diameter;
}
| diameter_t Project::get_default_port_diameter | ( | ) | const |
Definition at line 134 of file Project.cc.
References default_port_diameter.
{
return default_port_diameter;
}
| diameter_t Project::get_default_wire_diameter | ( | ) | const |
Definition at line 126 of file Project.cc.
References default_wire_diameter.
{
return default_wire_diameter;
}
| std::string const & Project::get_degate_version | ( | ) |
| std::string const & Project::get_description | ( | ) | const |
| unsigned int Project::get_font_size | ( | ) | const |
Get the default font size.
Definition at line 305 of file Project.cc.
References font_size.
{
return font_size;
}
| unsigned int Project::get_height | ( | ) | const |
get the height of a project.
Definition at line 68 of file Project.cc.
References bounding_box, and degate::BoundingBox::get_height().
{
return bounding_box.get_height();
}

| IrregularGrid_shptr Project::get_irregular_horizontal_grid | ( | ) |
Definition at line 165 of file Project.cc.
References irregular_horizontal_grid.
{
return irregular_horizontal_grid;
}
| IrregularGrid_shptr Project::get_irregular_vertical_grid | ( | ) |
Definition at line 169 of file Project.cc.
References irregular_vertical_grid.
{
return irregular_vertical_grid;
}
| length_t Project::get_lambda | ( | ) | const |
| transaction_id_t Project::get_last_pulled_tid | ( | ) | const |
Get the last pulled transaction ID.
Definition at line 261 of file Project.cc.
References last_transaction_id.
{
return last_transaction_id;
}
| LogicModel_shptr Project::get_logic_model | ( | ) |
Get the logic model.
The logic model should be present all time. This means that you can call this method and should not receive a NULL pointer.
Definition at line 72 of file Project.cc.
References logic_model.
{
return logic_model;
}
| std::string const & Project::get_name | ( | ) | const |
| double Project::get_pixel_per_um | ( | ) | const |
Get the ratio of pixels per micrometer.
Definition at line 284 of file Project.cc.
References pixel_per_um.
{
return pixel_per_um;
}
| PortColorManager_shptr Project::get_port_color_manager | ( | ) |
Definition at line 173 of file Project.cc.
References port_color_manager.
{
return port_color_manager;
}
| std::string const & Project::get_project_directory | ( | ) |
Get the project directory.
Definition at line 56 of file Project.cc.
References directory.
{
return directory;
}
| RCBase::container_type & Project::get_rcv_blacklist | ( | ) |
Get a list of blacklisted Rule Check violations.
Definition at line 310 of file Project.cc.
References rcv_blacklist.
{
return rcv_blacklist;
}
| RegularGrid_shptr Project::get_regular_horizontal_grid | ( | ) |
Definition at line 157 of file Project.cc.
References regular_horizontal_grid.
{
return regular_horizontal_grid;
}
| RegularGrid_shptr Project::get_regular_vertical_grid | ( | ) |
Definition at line 161 of file Project.cc.
References regular_vertical_grid.
{
return regular_vertical_grid;
}
| std::string Project::get_server_url | ( | ) | const |
Get server url.
Definition at line 257 of file Project.cc.
References server_url.
{
return server_url;
}
| int Project::get_template_dimension | ( | ) | const |
Get the template dimension.
This is either the height or the width of a gate (template).
Definition at line 293 of file Project.cc.
References template_dimension.
{
return template_dimension;
}
| time_t Project::get_time_since_last_save | ( | ) | const |
Get time since last "save".
Definition at line 149 of file Project.cc.
References last_persistent_version.
{
return time(NULL) - last_persistent_version;
}
| unsigned int Project::get_width | ( | ) | const |
Get the width of the project.
Definition at line 64 of file Project.cc.
References bounding_box, and degate::BoundingBox::get_width().
{
return bounding_box.get_width();
}

| void Project::init_default_values | ( | ) | [private] |
Definition at line 207 of file Project.cc.
References degate::DEFAULT_COLOR_ANNOTATION, degate::DEFAULT_COLOR_ANNOTATION_FRAME, degate::DEFAULT_COLOR_EMARKER, degate::DEFAULT_COLOR_GATE, degate::DEFAULT_COLOR_GATE_FRAME, degate::DEFAULT_COLOR_GATE_PORT, degate::DEFAULT_COLOR_GRID, degate::DEFAULT_COLOR_TEXT, degate::DEFAULT_COLOR_VIA_DOWN, degate::DEFAULT_COLOR_VIA_UP, degate::DEFAULT_COLOR_WIRE, default_colors, default_pin_diameter, default_port_diameter, default_wire_diameter, font_size, degate::SingletonBase< Configuration >::get_instance(), degate::Grid::HORIZONTAL, irregular_horizontal_grid, irregular_vertical_grid, lambda, last_transaction_id, pixel_per_um, regular_horizontal_grid, regular_vertical_grid, reset_last_saved_counter(), server_url, set_changed(), and degate::Grid::VERTICAL.
Referenced by Project().
{
default_pin_diameter = 5;
default_wire_diameter = 5;
default_port_diameter = 5;
lambda = 5;
last_transaction_id = 0;
pixel_per_um = 0;
font_size = 12;
// A B G R
default_colors[DEFAULT_COLOR_WIRE] = 0xff00a3fb;
default_colors[DEFAULT_COLOR_VIA_UP] = 0xffff8900;
default_colors[DEFAULT_COLOR_VIA_DOWN] = 0xff0023ff;
default_colors[DEFAULT_COLOR_GRID] = 0xffff1200;
default_colors[DEFAULT_COLOR_ANNOTATION] = 0xa0303030;
default_colors[DEFAULT_COLOR_ANNOTATION_FRAME] = 0xa032d932;
default_colors[DEFAULT_COLOR_GATE] = 0xa0303030;
default_colors[DEFAULT_COLOR_GATE_FRAME] = 0xa032b0d9;
default_colors[DEFAULT_COLOR_GATE_PORT] = 0xff0000ff;
default_colors[DEFAULT_COLOR_TEXT] = 0xffffffff;
default_colors[DEFAULT_COLOR_EMARKER] = 0xffa0a0ff;
set_changed(false);
reset_last_saved_counter();
regular_horizontal_grid = RegularGrid_shptr(new RegularGrid(Grid::HORIZONTAL));
regular_vertical_grid = RegularGrid_shptr(new RegularGrid(Grid::VERTICAL));
irregular_horizontal_grid = IrregularGrid_shptr(new IrregularGrid(Grid::HORIZONTAL));
irregular_vertical_grid = IrregularGrid_shptr(new IrregularGrid(Grid::VERTICAL));
// Generate a server URL
srand(time(NULL));
std::string channel_ident;
while(channel_ident.size() <= 20)
channel_ident += (char)('a'+(int) (26.0*rand()/(RAND_MAX+1.0)));
boost::format f(Configuration::get_instance().get_servers_uri_pattern());
f % channel_ident;
server_url = f.str();
}


| bool Project::is_changed | ( | ) | const |
Check if the project was changed.
Definition at line 145 of file Project.cc.
References changed.
{
return changed;
}
| void Project::print | ( | std::ostream & | os | ) |
Dump basic meta data for the project as human readable text into an ostream.
Definition at line 177 of file Project.cc.
References changed, default_pin_diameter, default_port_diameter, default_wire_diameter, degate_version, description, directory, lambda, and name.
Referenced by print_all().
{
os
<< endl
<< "================================[ "
<< (name.empty() ? "Unnamed project" : name)
<< " ]=================================" << endl
<< "+ Project description: " << description << endl
<< "+ Degate version: " << degate_version << endl
<< "+ Directory: " << directory << endl
<< "+" << endl
<< "+ Changed: " << (changed ? "true" : "false") << endl
<< "+" << endl
<< "+ Default wire diameter: " << default_wire_diameter << endl
<< "+ Default pin diameter: " << default_pin_diameter << endl
<< "+ Default port diameter: " << default_port_diameter << endl
<< "+ Min distance between electrically isolated objects in pixel (lambda value): " << lambda << endl
<< endl;
}

| void Project::print_all | ( | std::ostream & | os | ) |
Dump most meta data for the project as human readable text into an ostream.
Definition at line 197 of file Project.cc.
References logic_model, and print().
{
print(os);
if(logic_model == NULL) {
os << "+ The project has no logic model." << endl
<< endl;
}
else
logic_model->print(os);
}

| void Project::reset_last_saved_counter | ( | ) |
Reset last save counter.
Definition at line 153 of file Project.cc.
References last_persistent_version.
Referenced by init_default_values(), and set_changed().
{
last_persistent_version = time(NULL);
}

| void Project::set_changed | ( | bool | state = true | ) |
Set changed flag to indicate that the project data was changed.
This method is normally called from the GUI. If the project was saved to disc, the code should call set_changed(false). Project saving is implemented in ProjectExporter, but because the ProjectExporter might be used for different purposes, this method must be called from the GUI code.
Definition at line 139 of file Project.cc.
References changed, and reset_last_saved_counter().
Referenced by init_default_values().
{
changed = state;
if(state == false)
reset_last_saved_counter();
}


| void Project::set_default_color | ( | ENTITY_COLOR | e, |
| color_t | c | ||
| ) |
Set the default color for an entity.
Definition at line 270 of file Project.cc.
References default_colors.
{
default_colors[e] = c;
}
| void Project::set_default_pin_diameter | ( | diameter_t | pin_diameter | ) |
Definition at line 114 of file Project.cc.
References default_pin_diameter.
{
default_pin_diameter = pin_diameter;
}
| void Project::set_default_port_diameter | ( | diameter_t | port_diameter | ) |
Definition at line 130 of file Project.cc.
References default_port_diameter.
{
default_port_diameter = port_diameter;
}
| void Project::set_default_wire_diameter | ( | diameter_t | wire_diameter | ) |
Definition at line 122 of file Project.cc.
References default_wire_diameter.
{
default_wire_diameter = wire_diameter;
}
| void Project::set_degate_version | ( | std::string | version_str | ) |
Definition at line 98 of file Project.cc.
References degate_version.
{
degate_version = version_str;
}
| void Project::set_description | ( | std::string | _description | ) |
| void Project::set_font_size | ( | unsigned int | font_size | ) |
| void Project::set_lambda | ( | length_t | l | ) |
| void Project::set_last_pulled_tid | ( | transaction_id_t | tid | ) |
Set last pulled transaction ID.
Definition at line 265 of file Project.cc.
References last_transaction_id.
{
last_transaction_id = tid;
}
| void Project::set_logic_model | ( | LogicModel_shptr | _logic_model | ) |
Set the logic model for a project.
If you reset the logic model, the old logic model will be destroyed.
Definition at line 77 of file Project.cc.
References logic_model.
{
logic_model = _logic_model;
}
| void Project::set_name | ( | std::string | _name | ) |
| void Project::set_pixel_per_um | ( | double | pix_per_um | ) |
Get the ratio of pixels per micrometer.
Definition at line 288 of file Project.cc.
References pixel_per_um.
{
pixel_per_um = pix_per_um;
}
| void Project::set_project_directory | ( | std::string const & | _directory | ) |
Set the project directory.
Definition at line 52 of file Project.cc.
References directory.
{
directory = _directory;
}
| void Project::set_server_url | ( | std::string const & | server_url | ) |
Set server url.
Definition at line 253 of file Project.cc.
References server_url.
{
this->server_url = server_url;
}
| void Project::set_template_dimension | ( | int | template_dimension | ) |
Set the template dimension.
Definition at line 297 of file Project.cc.
References template_dimension.
{
this->template_dimension = template_dimension;
}
BoundingBox degate::Project::bounding_box [private] |
Definition at line 57 of file Project.h.
Referenced by get_bounding_box(), get_height(), and get_width().
bool degate::Project::changed [private] |
Definition at line 70 of file Project.h.
Referenced by is_changed(), print(), and set_changed().
Definition at line 84 of file Project.h.
Referenced by get_default_color(), get_default_colors(), init_default_values(), and set_default_color().
Definition at line 73 of file Project.h.
Referenced by get_default_pin_diameter(), init_default_values(), print(), and set_default_pin_diameter().
Definition at line 75 of file Project.h.
Referenced by get_default_port_diameter(), init_default_values(), print(), and set_default_port_diameter().
Definition at line 74 of file Project.h.
Referenced by get_default_wire_diameter(), init_default_values(), print(), and set_default_wire_diameter().
std::string degate::Project::degate_version [private] |
Definition at line 61 of file Project.h.
Referenced by get_degate_version(), print(), and set_degate_version().
std::string degate::Project::description [private] |
Definition at line 60 of file Project.h.
Referenced by get_description(), print(), and set_description().
std::string degate::Project::directory [private] |
Definition at line 62 of file Project.h.
Referenced by get_project_directory(), print(), and set_project_directory().
unsigned int degate::Project::font_size [private] |
Definition at line 91 of file Project.h.
Referenced by get_font_size(), init_default_values(), and set_font_size().
Definition at line 67 of file Project.h.
Referenced by get_irregular_horizontal_grid(), and init_default_values().
Definition at line 68 of file Project.h.
Referenced by get_irregular_vertical_grid(), and init_default_values().
length_t degate::Project::lambda [private] |
Definition at line 76 of file Project.h.
Referenced by get_lambda(), init_default_values(), print(), and set_lambda().
time_t degate::Project::last_persistent_version [private] |
Definition at line 71 of file Project.h.
Referenced by get_time_since_last_save(), and reset_last_saved_counter().
Definition at line 78 of file Project.h.
Referenced by get_last_pulled_tid(), init_default_values(), and set_last_pulled_tid().
LogicModel_shptr degate::Project::logic_model [private] |
Definition at line 80 of file Project.h.
Referenced by get_logic_model(), print_all(), and set_logic_model().
std::string degate::Project::name [private] |
Definition at line 59 of file Project.h.
Referenced by get_name(), print(), and set_name().
double degate::Project::pixel_per_um [private] |
Definition at line 86 of file Project.h.
Referenced by get_pixel_per_um(), init_default_values(), and set_pixel_per_um().
Definition at line 82 of file Project.h.
Referenced by get_port_color_manager().
Definition at line 89 of file Project.h.
Referenced by get_rcv_blacklist().
Definition at line 65 of file Project.h.
Referenced by get_regular_horizontal_grid(), and init_default_values().
Definition at line 66 of file Project.h.
Referenced by get_regular_vertical_grid(), and init_default_values().
std::string degate::Project::server_url [private] |
Definition at line 63 of file Project.h.
Referenced by get_server_url(), init_default_values(), and set_server_url().
int degate::Project::template_dimension [private] |
Definition at line 87 of file Project.h.
Referenced by get_template_dimension(), and set_template_dimension().
1.7.4