degate  0.1.2
Public Member Functions | Private Member Functions | Private Attributes
degate::Project Class Reference

The project class is a container for project related data. More...

#include <Project.h>

Inheritance diagram for degate::Project:
Inheritance graph
[legend]

List of all members.

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_typeget_rcv_blacklist ()
 Get a list of blacklisted Rule Check violations.
DeepCopyable_shptr cloneShallow () const
 Return a copy of this object, but with all references to other DeepCopyables cleared (e.g.
void cloneDeepInto (DeepCopyable_shptr destination, oldnew_t *oldnew) const
 Deep-copy all members to destination.

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

Detailed Description

The project class is a container for project related data.

Definition at line 63 of file Project.h.


Constructor & Destructor Documentation

Project::Project ( length_t  width,
length_t  height 
)

Create a new and empty project.

It will create an empty logic model as well.

Definition at line 35 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();
}

Here is the call graph for this function:

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 43 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();
}

Here is the call graph for this function:

Project::~Project ( ) [virtual]

The destructor.

Definition at line 51 of file Project.cc.

                  {
}

Member Function Documentation

void Project::cloneDeepInto ( DeepCopyable_shptr  destination,
oldnew_t oldnew 
) const [virtual]

Deep-copy all members to destination.

Todo:
Find out whether the default assignment operator can be used to simplify implementations of this method.

Implements degate::DeepCopyableBase.

Definition at line 65 of file Project.cc.

References logic_model.

                                                                                  {
  auto clone = std::dynamic_pointer_cast<Project>(destination);
  
  clone->logic_model = std::dynamic_pointer_cast<LogicModel>(logic_model->cloneDeep(oldnew));
  
  // For these members we use the default copy constructors.
  clone->regular_horizontal_grid = std::make_shared<RegularGrid>(*regular_horizontal_grid);
  clone->regular_vertical_grid = std::make_shared<RegularGrid>(*regular_vertical_grid);
  clone->irregular_horizontal_grid = std::make_shared<IrregularGrid>(*irregular_horizontal_grid);
  clone->irregular_vertical_grid = std::make_shared<IrregularGrid>(*irregular_vertical_grid);
  clone->port_color_manager = std::make_shared<PortColorManager>(*port_color_manager);
}

Return a copy of this object, but with all references to other DeepCopyables cleared (e.g.

set to 0-pointer).

Implements degate::DeepCopyable.

Definition at line 54 of file Project.cc.

                                               {
  auto clone = std::make_shared<Project>(*this);
  clone->regular_horizontal_grid.reset();
  clone->regular_vertical_grid.reset();
  clone->irregular_horizontal_grid.reset();
  clone->irregular_vertical_grid.reset();
  clone->logic_model.reset();
  clone->port_color_manager.reset();
  return clone;
}

Get the bounding box that represents the covered area for this project.

Definition at line 86 of file Project.cc.

References bounding_box.

                                                   {
  return bounding_box;
}

Get the default color for an entity.

Returns:
Returns the default color. If there is no default setting 0 is returned.

Definition at line 300 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;
}

Get all color defaults.

Definition at line 306 of file Project.cc.

References default_colors.

                                                         {
  return default_colors;
}

Definition at line 144 of file Project.cc.

References default_pin_diameter.

                                                   {
  return default_pin_diameter;
}

Definition at line 160 of file Project.cc.

References default_port_diameter.

                                                    {
  return default_port_diameter;
}

Definition at line 152 of file Project.cc.

References default_wire_diameter.

                                                    {
  return default_wire_diameter;
}
std::string const & Project::get_degate_version ( )

Definition at line 128 of file Project.cc.

References degate_version.

                                             {
  return degate_version;
}
std::string const & Project::get_description ( ) const

Definition at line 120 of file Project.cc.

References description.

                                                {
  return description;
}
unsigned int Project::get_font_size ( ) const

Get the default font size.

Definition at line 331 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 94 of file Project.cc.

References bounding_box, and degate::BoundingBox::get_height().

                                       {
  return bounding_box.get_height();
}

Here is the call graph for this function:

Definition at line 191 of file Project.cc.

References irregular_horizontal_grid.

Definition at line 195 of file Project.cc.

References irregular_vertical_grid.

Definition at line 136 of file Project.cc.

References lambda.

                                   {
  return lambda;
}

Get the last pulled transaction ID.

Definition at line 287 of file Project.cc.

References last_transaction_id.

                                                    {
  return last_transaction_id;
}

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 98 of file Project.cc.

References logic_model.

                                          {
  return logic_model;
}
std::string const & Project::get_name ( ) const

Definition at line 112 of file Project.cc.

References name.

                                         {
  return name;
}
double Project::get_pixel_per_um ( ) const

Get the ratio of pixels per micrometer.

Definition at line 310 of file Project.cc.

References pixel_per_um.

                                       {
  return pixel_per_um;
}

Definition at line 199 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 82 of file Project.cc.

References directory.

                                                {
  return directory;
}

Get a list of blacklisted Rule Check violations.

Definition at line 336 of file Project.cc.

References rcv_blacklist.

                                                  {
  return rcv_blacklist;
}

Definition at line 183 of file Project.cc.

References regular_horizontal_grid.

Definition at line 187 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 283 of file Project.cc.

References server_url.

                                        {
  return server_url;
}

Get the template dimension.

This is either the height or the width of a gate (template).

Definition at line 319 of file Project.cc.

References template_dimension.

                                          {
  return template_dimension;
}

Get time since last "save".

Returns:
Returns the time in seconds since the project change state was set to false.
See also:
set_changed()

Definition at line 175 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 90 of file Project.cc.

References bounding_box, and degate::BoundingBox::get_width().

                                      {
  return bounding_box.get_width();
}

Here is the call graph for this function:

void Project::init_default_values ( ) [private]

Definition at line 233 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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Project::is_changed ( ) const

Check if the project was changed.

Definition at line 171 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 203 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;

}

Here is the caller graph for this function:

void Project::print_all ( std::ostream &  os)

Dump most meta data for the project as human readable text into an ostream.

Definition at line 223 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);
}

Here is the call graph for this function:

Reset last save counter.

Definition at line 179 of file Project.cc.

References last_persistent_version.

Referenced by init_default_values(), and set_changed().

                                       {
  last_persistent_version = time(NULL);
}

Here is the caller graph for this function:

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 165 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();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Set the default color for an entity.

Definition at line 296 of file Project.cc.

References default_colors.

                                                         {
  default_colors[e] = c;
}

Definition at line 140 of file Project.cc.

References default_pin_diameter.

                                                              {
  default_pin_diameter = pin_diameter;
}

Definition at line 156 of file Project.cc.

References default_port_diameter.

                                                                {
  default_port_diameter = port_diameter;
}

Definition at line 148 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 124 of file Project.cc.

References degate_version.

                                                      {
  degate_version = version_str;
}
void Project::set_description ( std::string  _description)

Definition at line 116 of file Project.cc.

References description.

                                                    {
  description = _description;
}
void Project::set_font_size ( unsigned int  font_size)

Set the default font size.

Definition at line 327 of file Project.cc.

References font_size.

                                                  {
  this->font_size = font_size;
}

Definition at line 132 of file Project.cc.

References lambda.

                                   {
  lambda = l;
}

Set last pulled transaction ID.

Definition at line 291 of file Project.cc.

References last_transaction_id.

                                                      {
  last_transaction_id = tid;
}

Set the logic model for a project.

If you reset the logic model, the old logic model will be destroyed.

Definition at line 103 of file Project.cc.

References logic_model.

                                                           {
  logic_model = _logic_model;
}
void Project::set_name ( std::string  _name)

Definition at line 108 of file Project.cc.

References name.

                                      {
  name = _name;
}
void Project::set_pixel_per_um ( double  pix_per_um)

Get the ratio of pixels per micrometer.

Definition at line 314 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 78 of file Project.cc.

References directory.

                                                               {
  directory = _directory;
}
void Project::set_server_url ( std::string const &  server_url)

Set server url.

Definition at line 279 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 323 of file Project.cc.

References template_dimension.


Member Data Documentation

Definition at line 66 of file Project.h.

Referenced by get_bounding_box(), get_height(), and get_width().

bool degate::Project::changed [private]

Definition at line 80 of file Project.h.

Referenced by is_changed(), print(), and set_changed().

std::string degate::Project::degate_version [private]

Definition at line 71 of file Project.h.

Referenced by get_degate_version(), print(), and set_degate_version().

std::string degate::Project::description [private]

Definition at line 70 of file Project.h.

Referenced by get_description(), print(), and set_description().

std::string degate::Project::directory [private]

Definition at line 72 of file Project.h.

Referenced by get_project_directory(), print(), and set_project_directory().

unsigned int degate::Project::font_size [private]

Definition at line 101 of file Project.h.

Referenced by get_font_size(), init_default_values(), and set_font_size().

Definition at line 77 of file Project.h.

Referenced by get_irregular_horizontal_grid(), and init_default_values().

Definition at line 78 of file Project.h.

Referenced by get_irregular_vertical_grid(), and init_default_values().

Definition at line 86 of file Project.h.

Referenced by get_lambda(), init_default_values(), print(), and set_lambda().

Definition at line 81 of file Project.h.

Referenced by get_time_since_last_save(), and reset_last_saved_counter().

Definition at line 88 of file Project.h.

Referenced by get_last_pulled_tid(), init_default_values(), and set_last_pulled_tid().

Definition at line 90 of file Project.h.

Referenced by cloneDeepInto(), get_logic_model(), print_all(), and set_logic_model().

std::string degate::Project::name [private]

Definition at line 69 of file Project.h.

Referenced by get_name(), print(), and set_name().

Definition at line 96 of file Project.h.

Referenced by get_pixel_per_um(), init_default_values(), and set_pixel_per_um().

Definition at line 92 of file Project.h.

Referenced by get_port_color_manager().

Definition at line 99 of file Project.h.

Referenced by get_rcv_blacklist().

Definition at line 75 of file Project.h.

Referenced by get_regular_horizontal_grid(), and init_default_values().

Definition at line 76 of file Project.h.

Referenced by get_regular_vertical_grid(), and init_default_values().

std::string degate::Project::server_url [private]

Definition at line 73 of file Project.h.

Referenced by get_server_url(), init_default_values(), and set_server_url().

Definition at line 97 of file Project.h.

Referenced by get_template_dimension(), and set_template_dimension().


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