Skip to content

Commit

Permalink
made is_X_in_netlist accept const pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
SJulianS committed May 9, 2024
1 parent c07a663 commit 2018d81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions include/hal_core/netlist/netlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace hal
* @param[in] gate - The gate to check.
* @returns True if the gate is in the netlist, false otherwise.
*/
bool is_gate_in_netlist(Gate* gate) const;
bool is_gate_in_netlist(const Gate* gate) const;

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

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

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

/**
* Get the grouping specified by the given ID.
Expand Down Expand Up @@ -836,22 +836,22 @@ namespace hal
/* stores the modules */
Module* m_top_module;
std::unordered_map<u32, std::unique_ptr<Module>> m_modules_map;
std::unordered_set<Module*> m_modules_set;
std::unordered_set<const Module*> m_modules_set;
std::vector<Module*> m_modules;

/* stores the nets */
std::unordered_map<u32, std::unique_ptr<Net>> m_nets_map;
std::unordered_set<Net*> m_nets_set;
std::unordered_set<const Net*> m_nets_set;
std::vector<Net*> m_nets;

/* stores the gates */
std::unordered_map<u32, std::unique_ptr<Gate>> m_gates_map;
std::unordered_set<Gate*> m_gates_set;
std::unordered_set<const Gate*> m_gates_set;
std::vector<Gate*> m_gates;

/* stores the groupings */
std::unordered_map<u32, std::unique_ptr<Grouping>> m_groupings_map;
std::unordered_set<Grouping*> m_groupings_set;
std::unordered_set<const Grouping*> m_groupings_set;
std::vector<Grouping*> m_groupings;

/* stores the set of global gates and nets */
Expand Down
10 changes: 5 additions & 5 deletions src/netlist/netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace hal
return m_manager->delete_gate(gate);
}

bool Netlist::is_gate_in_netlist(Gate* gate) const
bool Netlist::is_gate_in_netlist(const Gate* gate) const
{
return gate != nullptr && m_gates_set.find(gate) != m_gates_set.end();
}
Expand Down Expand Up @@ -345,7 +345,7 @@ namespace hal
return m_manager->delete_net(n);
}

bool Netlist::is_net_in_netlist(Net* n) const
bool Netlist::is_net_in_netlist(const Net* n) const
{
return n != nullptr && m_nets_set.find(n) != m_nets_set.end();
}
Expand Down Expand Up @@ -610,7 +610,7 @@ namespace hal
return res;
}

bool Netlist::is_module_in_netlist(Module* module) const
bool Netlist::is_module_in_netlist(const Module* module) const
{
return (module != nullptr) && (m_modules_set.find(module) != m_modules_set.end());
}
Expand Down Expand Up @@ -649,7 +649,7 @@ namespace hal
return m_manager->delete_grouping(g);
}

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

const std::vector<Grouping*>& Netlist::get_groupings() const
{
return m_groupings;
return m_groupings;
}

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

0 comments on commit 2018d81

Please sign in to comment.