Skip to content

Commit 2018d81

Browse files
committed
made is_X_in_netlist accept const pointers
1 parent c07a663 commit 2018d81

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

include/hal_core/netlist/netlist.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ namespace hal
208208
* @param[in] gate - The gate to check.
209209
* @returns True if the gate is in the netlist, false otherwise.
210210
*/
211-
bool is_gate_in_netlist(Gate* gate) const;
211+
bool is_gate_in_netlist(const Gate* gate) const;
212212

213213
/**
214214
* Get the gate specified by the given ID.
@@ -342,7 +342,7 @@ namespace hal
342342
* @param[in] net - The net to check.
343343
* @returns True if the net is in the netlist, false otherwise.
344344
*/
345-
bool is_net_in_netlist(Net* net) const;
345+
bool is_net_in_netlist(const Net* net) const;
346346

347347
/**
348348
* Get the net specified by the given ID.
@@ -489,7 +489,7 @@ namespace hal
489489
* @param[in] module - The module to check.
490490
* @returns True if the module is in the netlist, false otherwise.
491491
*/
492-
bool is_module_in_netlist(Module* module) const;
492+
bool is_module_in_netlist(const Module* module) const;
493493

494494
/**
495495
* Get the module specified by the given ID.
@@ -568,7 +568,7 @@ namespace hal
568568
* @param[in] grouping - The grouping to check.
569569
* @returns True if the grouping is in the netlist, false otherwise.
570570
*/
571-
bool is_grouping_in_netlist(Grouping* grouping) const;
571+
bool is_grouping_in_netlist(const Grouping* grouping) const;
572572

573573
/**
574574
* Get the grouping specified by the given ID.
@@ -836,22 +836,22 @@ namespace hal
836836
/* stores the modules */
837837
Module* m_top_module;
838838
std::unordered_map<u32, std::unique_ptr<Module>> m_modules_map;
839-
std::unordered_set<Module*> m_modules_set;
839+
std::unordered_set<const Module*> m_modules_set;
840840
std::vector<Module*> m_modules;
841841

842842
/* stores the nets */
843843
std::unordered_map<u32, std::unique_ptr<Net>> m_nets_map;
844-
std::unordered_set<Net*> m_nets_set;
844+
std::unordered_set<const Net*> m_nets_set;
845845
std::vector<Net*> m_nets;
846846

847847
/* stores the gates */
848848
std::unordered_map<u32, std::unique_ptr<Gate>> m_gates_map;
849-
std::unordered_set<Gate*> m_gates_set;
849+
std::unordered_set<const Gate*> m_gates_set;
850850
std::vector<Gate*> m_gates;
851851

852852
/* stores the groupings */
853853
std::unordered_map<u32, std::unique_ptr<Grouping>> m_groupings_map;
854-
std::unordered_set<Grouping*> m_groupings_set;
854+
std::unordered_set<const Grouping*> m_groupings_set;
855855
std::vector<Grouping*> m_groupings;
856856

857857
/* stores the set of global gates and nets */

src/netlist/netlist.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ namespace hal
185185
return m_manager->delete_gate(gate);
186186
}
187187

188-
bool Netlist::is_gate_in_netlist(Gate* gate) const
188+
bool Netlist::is_gate_in_netlist(const Gate* gate) const
189189
{
190190
return gate != nullptr && m_gates_set.find(gate) != m_gates_set.end();
191191
}
@@ -345,7 +345,7 @@ namespace hal
345345
return m_manager->delete_net(n);
346346
}
347347

348-
bool Netlist::is_net_in_netlist(Net* n) const
348+
bool Netlist::is_net_in_netlist(const Net* n) const
349349
{
350350
return n != nullptr && m_nets_set.find(n) != m_nets_set.end();
351351
}
@@ -610,7 +610,7 @@ namespace hal
610610
return res;
611611
}
612612

613-
bool Netlist::is_module_in_netlist(Module* module) const
613+
bool Netlist::is_module_in_netlist(const Module* module) const
614614
{
615615
return (module != nullptr) && (m_modules_set.find(module) != m_modules_set.end());
616616
}
@@ -649,7 +649,7 @@ namespace hal
649649
return m_manager->delete_grouping(g);
650650
}
651651

652-
bool Netlist::is_grouping_in_netlist(Grouping* n) const
652+
bool Netlist::is_grouping_in_netlist(const Grouping* n) const
653653
{
654654
return n != nullptr && m_groupings_set.find(n) != m_groupings_set.end();
655655
}
@@ -667,7 +667,7 @@ namespace hal
667667

668668
const std::vector<Grouping*>& Netlist::get_groupings() const
669669
{
670-
return m_groupings;
670+
return m_groupings;
671671
}
672672

673673
std::vector<Grouping*> Netlist::get_groupings(const std::function<bool(const Grouping*)>& filter) const

0 commit comments

Comments
 (0)