HAL
hal::Grouping Class Reference

#include <grouping.h>

Collaboration diagram for hal::Grouping:
Collaboration graph

Public Member Functions

u32 get_id () const
 
void set_name (std::string name)
 
std::string get_name () const
 
void set_color (utils::Color c)
 
utils::Color get_color () const
 
utils::Color next_color ()
 
Netlistget_netlist () const
 
bool assign_gate (Gate *gate, bool force=false)
 
bool assign_gate_by_id (const u32 gate_id, bool force=false)
 
const std::vector< Gate * > & get_gates () const
 
std::vector< Gate * > get_gates (const std::function< bool(Gate *)> &filter) const
 
std::vector< u32get_gate_ids (const std::function< bool(Gate *)> &filter=nullptr) const
 
bool remove_gate (Gate *gate)
 
bool remove_gate_by_id (const u32 gate_id)
 
bool contains_gate (Gate *gate) const
 
bool contains_gate_by_id (const u32 gate_id) const
 
bool assign_net (Net *net, bool force=false)
 
bool assign_net_by_id (const u32 net_id, bool force=false)
 
const std::vector< Net * > & get_nets () const
 
std::vector< Net * > get_nets (const std::function< bool(Net *)> &filter) const
 
std::vector< u32get_net_ids (const std::function< bool(Net *)> &filter=nullptr) const
 
bool remove_net (Net *net)
 
bool remove_net_by_id (const u32 net_id)
 
bool contains_net (Net *net) const
 
bool contains_net_by_id (const u32 net_id) const
 
bool assign_module (Module *module, bool force=false)
 
bool assign_module_by_id (const u32 module_id, bool force=false)
 
const std::vector< Module * > & get_modules () const
 
std::vector< Module * > get_modules (const std::function< bool(Module *)> &filter) const
 
std::vector< u32get_module_ids (const std::function< bool(Module *)> &filter=nullptr) const
 
bool remove_module (Module *module)
 
bool remove_module_by_id (const u32 module_id)
 
bool contains_module (Module *module) const
 
bool contains_module_by_id (const u32 module_id) const
 

Friends

class NetlistInternalManager
 

Detailed Description

A grouping is an unstructured collection of gates, nets, and modules that do not need to be connected in any way.
It is designed to act as a container to temporarily store related entities during netlist exploration.
In contrast to a module, it does not allow for hierarchization.
Each gate, net, or module within the netlist may only be assigned to a single grouping.

Definition at line 50 of file grouping.h.

Member Function Documentation

◆ assign_gate()

bool hal::Grouping::assign_gate ( Gate gate,
bool  force = false 
)

Assign a gate to the grouping.
Fails if the gate is already contained within another grouping.
If force is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]gate- The gate to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 69 of file grouping.cpp.

Referenced by assign_gate_by_id(), hal::GroupingSerializer::deserialize(), hal::grouping_init(), and hal::NetlistModificationDecorator::replace_gate().

◆ assign_gate_by_id()

bool hal::Grouping::assign_gate_by_id ( const u32  gate_id,
bool  force = false 
)

Assign a gate to the grouping by ID.
Fails if the gate is already contained within another grouping.
If force is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]gate_id- The ID of the gate to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 74 of file grouping.cpp.

References assign_gate(), and hal::Netlist::get_gate_by_id().

Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().

◆ assign_module()

bool hal::Grouping::assign_module ( Module module,
bool  force = false 
)

Assign a module to the grouping.
Fails if the module is already contained within another grouping.
If force is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]module- The module to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 243 of file grouping.cpp.

References hal::ShortestPath::module().

Referenced by assign_module_by_id(), hal::GroupingSerializer::deserialize(), and hal::grouping_init().

◆ assign_module_by_id()

bool hal::Grouping::assign_module_by_id ( const u32  module_id,
bool  force = false 
)

Assign a module to the grouping by ID.
Fails if the module is already contained within another grouping.
If force is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]module_id- The ID of the module to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 248 of file grouping.cpp.

References assign_module(), hal::Netlist::get_module_by_id(), and hal::ShortestPath::module().

Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().

◆ assign_net()

bool hal::Grouping::assign_net ( Net net,
bool  force = false 
)

Assign a net to the grouping.
Fails if the net is already contained within another grouping.
If force is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]net- The net to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 156 of file grouping.cpp.

References net.

Referenced by assign_net_by_id(), hal::GroupingSerializer::deserialize(), and hal::grouping_init().

◆ assign_net_by_id()

bool hal::Grouping::assign_net_by_id ( const u32  net_id,
bool  force = false 
)

Assign a net to the grouping by ID.
Fails if the net is already contained within another grouping.
If force is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.

Parameters
[in]net_id- The ID of the net to assign.
[in]force- Overwrite previous assignment.
Returns
True on success, false otherwise.

Definition at line 161 of file grouping.cpp.

References assign_net(), hal::Netlist::get_net_by_id(), and net.

Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().

◆ contains_gate()

bool hal::Grouping::contains_gate ( Gate gate) const

Check whether a gate is in the grouping.

Parameters
[in]gate- The gate to check for.
Returns
True on success, false otherwise.

Definition at line 141 of file grouping.cpp.

References contains_gate_by_id(), and hal::Gate::get_id().

Referenced by hal::grouping_init().

◆ contains_gate_by_id()

bool hal::Grouping::contains_gate_by_id ( const u32  gate_id) const

Check whether a gate is in the grouping by ID.

Parameters
[in]gate_id- The ID of the gate to check for.
Returns
True on success, false otherwise.

Definition at line 151 of file grouping.cpp.

Referenced by contains_gate(), and hal::grouping_init().

◆ contains_module()

bool hal::Grouping::contains_module ( Module module) const

Check whether a module is in the grouping.

Parameters
[in]module- The module to check for.
Returns
True on success, false otherwise.

Definition at line 315 of file grouping.cpp.

References contains_module_by_id(), hal::Module::get_id(), and hal::ShortestPath::module().

Referenced by hal::grouping_init().

◆ contains_module_by_id()

bool hal::Grouping::contains_module_by_id ( const u32  module_id) const

Check whether a module is in the grouping by ID.

Parameters
[in]module_id- The ID of the module to check for.
Returns
True on success, false otherwise.

Definition at line 325 of file grouping.cpp.

Referenced by contains_module(), and hal::grouping_init().

◆ contains_net()

bool hal::Grouping::contains_net ( Net net) const

Check whether a net is in the grouping.

Parameters
[in]net- The net to check for.
Returns
True on success, false otherwise.

Definition at line 228 of file grouping.cpp.

References contains_net_by_id(), and net.

Referenced by hal::grouping_init().

◆ contains_net_by_id()

bool hal::Grouping::contains_net_by_id ( const u32  net_id) const

Check whether a net is in the grouping by ID.

Parameters
[in]net_id- The ID of the net to check for.
Returns
True on success, false otherwise.

Definition at line 238 of file grouping.cpp.

Referenced by contains_net(), and hal::grouping_init().

◆ get_color()

utils::Color hal::Grouping::get_color ( ) const

Get the color of the grouping.

Returns
The color.

Definition at line 47 of file grouping.cpp.

Referenced by hal::GroupingTableEntry::color(), hal::GroupingTableModel::groupingColorChangedEvent(), and hal::event_log::handle_grouping_event().

◆ get_gate_ids()

std::vector< u32 > hal::Grouping::get_gate_ids ( const std::function< bool(Gate *)> &  filter = nullptr) const

Get the IDs of all gates contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each gate.
Returns
A vector of gate IDs.

Definition at line 113 of file grouping.cpp.

References get_gates().

Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().

◆ get_gates() [1/2]

const std::vector< Gate * > & hal::Grouping::get_gates ( ) const

Get all gates contained within the grouping.

Returns
A vector of gates.

Definition at line 85 of file grouping.cpp.

Referenced by get_gate_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().

◆ get_gates() [2/2]

std::vector< Gate * > hal::Grouping::get_gates ( const std::function< bool(Gate *)> &  filter) const

Get all gates contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each gate.
Returns
A vector of gates.

Definition at line 90 of file grouping.cpp.

◆ get_id()

◆ get_module_ids()

std::vector< u32 > hal::Grouping::get_module_ids ( const std::function< bool(Module *)> &  filter = nullptr) const

Get the IDs of all modules contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each module.
Returns
A vector of module IDs.

Definition at line 287 of file grouping.cpp.

References hal::Module::get_id(), get_modules(), and hal::ShortestPath::module().

Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().

◆ get_modules() [1/2]

const std::vector< Module * > & hal::Grouping::get_modules ( ) const

Get all modules contained within the grouping.

Returns
A vector of modules.

Definition at line 259 of file grouping.cpp.

Referenced by get_module_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().

◆ get_modules() [2/2]

std::vector< Module * > hal::Grouping::get_modules ( const std::function< bool(Module *)> &  filter) const

Get all modules contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each module.
Returns
A vector of modules.

Definition at line 264 of file grouping.cpp.

References hal::ShortestPath::module().

◆ get_name()

std::string hal::Grouping::get_name ( ) const

Get the name of the grouping.

Returns
The name.

Definition at line 42 of file grouping.cpp.

Referenced by hal::grouping_init(), hal::GroupingTableModel::groupingNameChangedEvent(), hal::event_log::handle_grouping_event(), and hal::GroupingTableEntry::name().

◆ get_net_ids()

std::vector< u32 > hal::Grouping::get_net_ids ( const std::function< bool(Net *)> &  filter = nullptr) const

Get the IDs of all nets contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each net.
Returns
A vector of net IDs.

Definition at line 200 of file grouping.cpp.

References get_nets(), and net.

Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().

◆ get_netlist()

Netlist * hal::Grouping::get_netlist ( ) const

Get the netlist this grouping is associated with.

Returns
The netlist.

Definition at line 64 of file grouping.cpp.

Referenced by hal::grouping_init(), and hal::event_log::handle_grouping_event().

◆ get_nets() [1/2]

const std::vector< Net * > & hal::Grouping::get_nets ( ) const

Get all nets contained within the grouping.

Returns
A vector of nets.

Definition at line 172 of file grouping.cpp.

Referenced by get_net_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().

◆ get_nets() [2/2]

std::vector< Net * > hal::Grouping::get_nets ( const std::function< bool(Net *)> &  filter) const

Get all nets contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each net.
Returns
A vector of nets.

Definition at line 177 of file grouping.cpp.

References net.

◆ next_color()

utils::Color hal::Grouping::next_color ( )

Generates a new color distinct from previous colors. Called for each new grouping.

Returns
The next color.

Definition at line 58 of file grouping.cpp.

References get_id().

◆ remove_gate()

bool hal::Grouping::remove_gate ( Gate gate)

Remove a gate from the grouping.
Fails if the gate is not contained within the grouping.

Parameters
[in]gate- The gate to remove.
Returns
True on success, false otherwise.

Definition at line 125 of file grouping.cpp.

Referenced by hal::grouping_init(), remove_gate_by_id(), and hal::GroupingTableModel::removeRows().

◆ remove_gate_by_id()

bool hal::Grouping::remove_gate_by_id ( const u32  gate_id)

Remove a gate from the grouping by ID.
Fails if the gate is not contained within the grouping.

Parameters
[in]gate_id- The ID of the gate to remove.
Returns
True on success, false otherwise.

Definition at line 130 of file grouping.cpp.

References hal::Netlist::get_gate_by_id(), and remove_gate().

Referenced by hal::ActionRemoveItemsFromObject::exec(), and hal::grouping_init().

◆ remove_module()

bool hal::Grouping::remove_module ( Module module)

Remove a module from the grouping.
Fails if the module is not contained within the grouping.

Parameters
[in]module- The module to remove.
Returns
True on success, false otherwise.

Definition at line 299 of file grouping.cpp.

References hal::ShortestPath::module().

Referenced by hal::grouping_init(), remove_module_by_id(), and hal::GroupingTableModel::removeRows().

◆ remove_module_by_id()

bool hal::Grouping::remove_module_by_id ( const u32  module_id)

Remove a module from the grouping by ID.
Fails if the module is not contained within the grouping.

Parameters
[in]module_id- The ID of the module to remove.
Returns
True on success, false otherwise.

Definition at line 304 of file grouping.cpp.

References hal::Netlist::get_module_by_id(), hal::ShortestPath::module(), and remove_module().

Referenced by hal::ActionRemoveItemsFromObject::exec().

◆ remove_net()

bool hal::Grouping::remove_net ( Net net)

Remove a net from the grouping.
Fails if the net is not contained within the grouping.

Parameters
[in]net- The net to remove.
Returns
True on success, false otherwise.

Definition at line 212 of file grouping.cpp.

References net.

Referenced by hal::grouping_init(), remove_net_by_id(), and hal::GroupingTableModel::removeRows().

◆ remove_net_by_id()

bool hal::Grouping::remove_net_by_id ( const u32  net_id)

Remove a net from the grouping by ID.
Fails if the net is not contained within the grouping.

Parameters
[in]net_id- The ID of the net to remove.
Returns
True on success, false otherwise.

Definition at line 217 of file grouping.cpp.

References hal::Netlist::get_net_by_id(), net, and remove_net().

Referenced by hal::ActionRemoveItemsFromObject::exec(), and hal::grouping_init().

◆ set_color()

void hal::Grouping::set_color ( utils::Color  c)

Set the color of the grouping.

Parameters
[in]c- The new color.

Definition at line 52 of file grouping.cpp.

References hal::GroupingEvent::color_changed, and hal::EventHandler::notify().

Referenced by hal::GroupingTableEntry::setColor().

◆ set_name()

void hal::Grouping::set_name ( std::string  name)

Set the name of the grouping.

Parameters
[in]name- The new name.

Definition at line 27 of file grouping.cpp.

References log_error, name, hal::GroupingEvent::name_changed, hal::EventHandler::notify(), and hal::utils::trim().

Referenced by hal::grouping_init(), and hal::GroupingTableEntry::setName().

Friends And Related Function Documentation

◆ NetlistInternalManager

friend class NetlistInternalManager
friend

Definition at line 364 of file grouping.h.


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