From cbca1fb5308e135f44b5384c619b37a4ce05558b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 5 Jan 2019 22:39:52 +0100 Subject: [PATCH] Cleaned up a namespace mess (db::Net was duplicated in NetTracer and db itself) - renamed to db::NetTracerNet, but better solution would be to rename db to something else in the plugin. --- .../net_tracer/db_plugin/dbNetTracerIO.cc | 14 ++++----- .../net_tracer/db_plugin/dbNetTracerIO.h | 6 ++-- .../lay_plugin/layNetTracerDialog.cc | 30 +++++++++---------- .../lay_plugin/layNetTracerDialog.h | 6 ++-- .../net_tracer/unit_tests/dbNetTracer.cc | 12 ++++---- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc index 2e52c70ae..bb44ab5bc 100644 --- a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc +++ b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc @@ -338,13 +338,13 @@ NetTracerSymbolInfo::parse (tl::Extractor &ex) // ----------------------------------------------------------------------------------- // Net implementation -Net::Net () +NetTracerNet::NetTracerNet () : m_dbu (0.001), m_incomplete (true), m_trace_path (false) { // .. nothing yet .. } -Net::Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data) +NetTracerNet::NetTracerNet (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data) : m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_trace_path (false) { m_dbu = layout.dbu (); @@ -406,7 +406,7 @@ Net::Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout } std::vector -Net::export_net (db::Layout &layout, db::Cell &export_cell) +NetTracerNet::export_net (db::Layout &layout, db::Cell &export_cell) { std::vector new_layers; std::map layer_map; @@ -446,7 +446,7 @@ Net::export_net (db::Layout &layout, db::Cell &export_cell) } const std::string & -Net::cell_name (db::cell_index_type cell_index) const +NetTracerNet::cell_name (db::cell_index_type cell_index) const { std::map ::const_iterator cn = m_cell_names.find (cell_index); if (cn != m_cell_names.end ()) { @@ -458,7 +458,7 @@ Net::cell_name (db::cell_index_type cell_index) const } db::LayerProperties -Net::representative_layer_for (unsigned int log_layer) const +NetTracerNet::representative_layer_for (unsigned int log_layer) const { std::map >::const_iterator l = m_layers.find (log_layer); if (l != m_layers.end ()) { @@ -469,7 +469,7 @@ Net::representative_layer_for (unsigned int log_layer) const } db::LayerProperties -Net::layer_for (unsigned int log_layer) const +NetTracerNet::layer_for (unsigned int log_layer) const { std::map >::const_iterator l = m_layers.find (log_layer); if (l != m_layers.end ()) { @@ -480,7 +480,7 @@ Net::layer_for (unsigned int log_layer) const } void -Net::define_layer (unsigned int l, const db::LayerProperties &lp, const db::LayerProperties &lp_representative) +NetTracerNet::define_layer (unsigned int l, const db::LayerProperties &lp, const db::LayerProperties &lp_representative) { m_layers.insert (std::make_pair (l, std::make_pair (lp, lp_representative))); } diff --git a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h index 2553cf16d..31e023580 100644 --- a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h +++ b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h @@ -157,7 +157,7 @@ private: std::string m_expression; }; -class DB_PLUGIN_PUBLIC Net +class DB_PLUGIN_PUBLIC NetTracerNet { public: typedef std::vector ::const_iterator iterator; @@ -165,12 +165,12 @@ public: /** * @brief Default constructor */ - Net (); + NetTracerNet (); /** * @brief Constructor */ - Net (const db::NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const db::NetTracerData &data); + NetTracerNet (const db::NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const db::NetTracerData &data); /** * @brief Iterate the shapes (begin) diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc index 18d07bad0..dadf49334 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc @@ -103,7 +103,7 @@ NetTracerDialog::~NetTracerDialog () void NetTracerDialog::clear_nets () { - for (std::vector ::iterator n = mp_nets.begin (); n != mp_nets.end (); ++n) { + for (std::vector ::iterator n = mp_nets.begin (); n != mp_nets.end (); ++n) { delete *n; } mp_nets.clear (); @@ -178,7 +178,7 @@ NetTracerDialog::mouse_click_event (const db::DPoint &p, unsigned int buttons, b stop_search_box = db::DBox (m_mouse_first_point, m_mouse_first_point).enlarged (db::DVector (l, l)); } - db::Net *net = do_trace (start_search_box, stop_search_box, trace_path); + db::NetTracerNet *net = do_trace (start_search_box, stop_search_box, trace_path); if (net) { // create a new net taking the shapes from the tracer @@ -220,7 +220,7 @@ NetTracerDialog::redo_trace_clicked () { BEGIN_PROTECTED - std::set selected_nets; + std::set selected_nets; QList selected_items = net_list->selectedItems (); for (QList::const_iterator item = selected_items.begin (); item != selected_items.end (); ++item) { @@ -230,18 +230,18 @@ BEGIN_PROTECTED } } - std::vector nets; + std::vector nets; nets.swap (mp_nets); m_net_index = 1; std::vector new_selection; - for (std::vector ::const_iterator n = nets.begin (); n != nets.end (); ++n) { + for (std::vector ::const_iterator n = nets.begin (); n != nets.end (); ++n) { try { - db::Net *net = do_trace ((*n)->start_search_box (), (*n)->stop_search_box (), (*n)->trace_path_flag ()); + db::NetTracerNet *net = do_trace ((*n)->start_search_box (), (*n)->stop_search_box (), (*n)->trace_path_flag ()); if (net) { // create a new net taking the shapes from the tracer @@ -281,7 +281,7 @@ BEGIN_PROTECTED END_PROTECTED } -db::Net * +db::NetTracerNet * NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path) { unsigned int start_layer = 0; @@ -401,7 +401,7 @@ NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &sto } else { // create a new net taking the shapes from the tracer - db::Net *net = new db::Net (net_tracer, db::ICplxTrans (cv.context_trans ()), cv->layout (), cv.cell_index (), cv->filename (), cv->name (), tracer_data); + db::NetTracerNet *net = new db::NetTracerNet (net_tracer, db::ICplxTrans (cv.context_trans ()), cv->layout (), cv.cell_index (), cv->filename (), cv->name (), tracer_data); net->set_start_search_box (start_search_box); net->set_stop_search_box (stop_search_box); net->set_trace_path_flag (trace_path); @@ -712,7 +712,7 @@ NetTracerDialog::update_info () std::map::perimeter_type> statinfo_perimeter; size_t tot_shapes = 0; - for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { + for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { if (tot_shapes++ >= max_shapes) { incomplete = true; @@ -917,7 +917,7 @@ NetTracerDialog::update_info () bool incomplete = false; std::set labels; - for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { + for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { if (net_shape->shape ().is_text ()) { @@ -962,7 +962,7 @@ NetTracerDialog::update_info () incomplete = false; std::set cells; - for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { + for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { if (cells.size () >= max_cells) { incomplete = true; @@ -1238,7 +1238,7 @@ BEGIN_PROTECTED w.start_element ("net"); - const db::Net *net = mp_nets[item_index]; + const db::NetTracerNet *net = mp_nets[item_index]; w.start_element ("name"); w.cdata (net->name ()); @@ -1262,7 +1262,7 @@ BEGIN_PROTECTED w.start_element ("shapes"); - for (db::Net::iterator net_shape = net->begin (); net_shape != net->end (); ++net_shape) { + for (db::NetTracerNet::iterator net_shape = net->begin (); net_shape != net->end (); ++net_shape) { w.start_element ("element"); @@ -1443,7 +1443,7 @@ NetTracerDialog::adjust_view () db::DBox cv_bbox; // Create markers for the shapes - for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { + for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) { // Find the actual layer by looking up the layer properties .. std::map ::const_iterator ll = llmap.find (net_shape->layer ()); @@ -1534,7 +1534,7 @@ NetTracerDialog::update_highlights () QColor net_color = mp_nets [item_index]->color (); // Create markers for the shapes - for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) { + for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) { // Find the actual layer by looking up the layer properties .. std::map ::const_iterator ll = llmap.find (net_shape->layer ()); diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h index 3198b52e9..43da7ecda 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h @@ -38,7 +38,7 @@ namespace db { - class Net; + class NetTracerNet; } namespace lay @@ -82,7 +82,7 @@ protected slots: void redo_trace_clicked (); private: - std::vector mp_nets; + std::vector mp_nets; std::vector mp_markers; unsigned int m_cv_index; int m_net_index; @@ -113,7 +113,7 @@ private: void update_info (); void layer_list_changed (int index); void release_mouse (); - db::Net *do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path); + db::NetTracerNet *do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path); }; } diff --git a/src/plugins/tools/net_tracer/unit_tests/dbNetTracer.cc b/src/plugins/tools/net_tracer/unit_tests/dbNetTracer.cc index fdcc08a02..47e42d701 100644 --- a/src/plugins/tools/net_tracer/unit_tests/dbNetTracer.cc +++ b/src/plugins/tools/net_tracer/unit_tests/dbNetTracer.cc @@ -76,18 +76,18 @@ static db::NetTracerShape find_shape (const db::Layout &layout, const db::Cell & } #endif -static db::Net trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start) +static db::NetTracerNet trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start) { db::NetTracerData tracer_data = tc.get_tracer_data (layout); tracer.trace (layout, cell, p_start, l_start, tracer_data); - return db::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data); + return db::NetTracerNet (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data); } -static db::Net trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start, unsigned int l_stop, const db::Point &p_stop) +static db::NetTracerNet trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start, unsigned int l_stop, const db::Point &p_stop) { db::NetTracerData tracer_data = tc.get_tracer_data (layout); tracer.trace (layout, cell, p_start, l_start, p_stop, l_stop, tracer_data); - return db::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data); + return db::NetTracerNet (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data); } void run_test (tl::TestBase *_this, const std::string &file, const db::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const std::string &file_au, const char *net_name = 0) @@ -107,7 +107,7 @@ void run_test (tl::TestBase *_this, const std::string &file, const db::NetTracer const db::Cell &cell = layout_org.cell (*layout_org.begin_top_down ()); db::NetTracer tracer; - db::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start); + db::NetTracerNet net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start); if (net_name) { EXPECT_EQ (net.name (), std::string (net_name)); @@ -141,7 +141,7 @@ void run_test2 (tl::TestBase *_this, const std::string &file, const db::NetTrace const db::Cell &cell = layout_org.cell (*layout_org.begin_top_down ()); db::NetTracer tracer; - db::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start, layer_for (layout_org, lp_stop), p_stop); + db::NetTracerNet net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start, layer_for (layout_org, lp_stop), p_stop); if (net_name) { EXPECT_EQ (net.name (), std::string (net_name));