HAL
hal::GuiApiClasses::View Class Reference

#include <gui_api.h>

Collaboration diagram for hal::GuiApiClasses::View:
Collaboration graph

Classes

struct  ModuleGateIdPair
 

Static Public Member Functions

static int isolateInNew (const std::vector< Module * > modules, const std::vector< Gate * > gates)
 
static bool deleteView (int id)
 
static bool addTo (int id, const std::vector< Module * > modules, const std::vector< Gate * > gates)
 
static bool removeFrom (int id, const std::vector< Module * > modules, const std::vector< Gate * > gates)
 
static bool setName (int id, const std::string &name)
 
static int getId (const std::string &name)
 
static std::string getName (int id)
 
static std::vector< Module * > getModules (int id)
 
static std::vector< Gate * > getGates (int id)
 
static std::vector< u32getIds (const std::vector< Module * > modules, const std::vector< Gate * > gates)
 
static bool foldModule (int view_id, Module *module)
 
static bool unfoldModule (int view_id, Module *module)
 
static ModuleGateIdPair getValidObjects (int viewId, const std::vector< Module * >, const std::vector< Gate * >)
 
static GridPlacementgetGridPlacement (int viewId)
 
static bool setGridPlacement (int viewId, GridPlacement *gp)
 
static u32 getCurrentDirectory ()
 
static void setCurrentDirectory (u32 id)
 
static u32 createNewDirectory (const std::string &name)
 
static void deleteDirectory (u32 id)
 
static void moveView (u32 viewId, std::optional< u32 > destinationDirectoryId, std::optional< int > row)
 
static void moveDirectory (u32 directoryId, std::optional< u32 > destinationDirectoryId, std::optional< int > row)
 
static std::optional< std::vector< u32 > > getChildDirectories (u32 directoryId)
 
static std::optional< std::vector< u32 > > getChildViews (u32 directoryId)
 

Detailed Description

Definition at line 44 of file gui_api.h.

Member Function Documentation

◆ addTo()

bool hal::GuiApiClasses::View::addTo ( int  id,
const std::vector< Module * >  modules,
const std::vector< Gate * >  gates 
)
static

◆ createNewDirectory()

u32 hal::GuiApiClasses::View::createNewDirectory ( const std::string &  name)
static

Creates a new directory with a given name.

Parameters
name- The name of the new directory.
Returns
The id of the newly created directory.

Definition at line 954 of file gui_api.cpp.

References hal::UserActionObjectType::ContextDir, hal::UserActionManager::executeActionBlockThread(), QString::fromStdString(), hal::UserActionObject::id(), id, hal::UserActionManager::instance(), name, and hal::UserAction::object().

Referenced by hal::PYBIND11_PLUGIN().

◆ deleteDirectory()

void hal::GuiApiClasses::View::deleteDirectory ( u32  id)
static

Deleted a directory.

Parameters
id- The id of the directory.

Definition at line 962 of file gui_api.cpp.

References hal::UserActionObjectType::ContextDir, hal::UserActionManager::executeActionBlockThread(), hal::UserActionManager::instance(), and hal::UserAction::setObject().

Referenced by hal::PYBIND11_PLUGIN().

◆ deleteView()

bool hal::GuiApiClasses::View::deleteView ( int  id)
static

◆ foldModule()

bool hal::GuiApiClasses::View::foldModule ( int  view_id,
Module module 
)
static

Fold a specific module. Hides the submodules and gates, shows the specific module.

Parameters
view_id- The id of the view.
module- The Module to fold.
Returns
True on success, otherwise False.

Definition at line 764 of file gui_api.cpp.

References QSet::contains(), hal::UserActionManager::executeActionBlockThread(), hal::GraphContext::gates(), hal::Module::get_gates(), hal::Module::get_id(), hal::Module::get_submodules(), hal::GraphContextManager::getContextById(), hal::gGraphContextManager, hal::UserActionManager::instance(), log_warning, hal::ShortestPath::module(), and hal::GraphContext::modules().

Referenced by hal::PYBIND11_PLUGIN().

◆ getChildDirectories()

std::optional< std::vector< u32 > > hal::GuiApiClasses::View::getChildDirectories ( u32  directoryId)
static

Returns a list of child directories for a given directory.

Parameters
directoryId- The id of the parent directory.
Returns
List of ids of child directories. If the parent directory does not exist std::nullopt is returned instead.

Definition at line 1027 of file gui_api.cpp.

References hal::ContextTreeModel::getChildDirectoriesOf(), hal::GraphContextManager::getContextTreeModel(), hal::ContextTreeModel::getDirectory(), and hal::gGraphContextManager.

Referenced by hal::PYBIND11_PLUGIN().

◆ getChildViews()

std::optional< std::vector< u32 > > hal::GuiApiClasses::View::getChildViews ( u32  directoryId)
static

Returns a list of child views for a given directory.

Parameters
directoryId- The id of the parent directory.
Returns
List of ids of child views. If the parent directory does not exist std::nullopt is returned instead.

Definition at line 1036 of file gui_api.cpp.

References hal::ContextTreeModel::getChildContextsOf(), hal::GraphContextManager::getContextTreeModel(), hal::ContextTreeModel::getDirectory(), and hal::gGraphContextManager.

Referenced by hal::PYBIND11_PLUGIN().

◆ getCurrentDirectory()

u32 hal::GuiApiClasses::View::getCurrentDirectory ( )
static

Returns the id of the current directory.

Used for selection and similar.

Returns
The id of the current directory.

Definition at line 935 of file gui_api.cpp.

References hal::ContextTreeItem::directory(), hal::GraphContextManager::getContextTreeModel(), hal::ContextTreeModel::getCurrentDirectory(), hal::gGraphContextManager, and hal::ContextDirectory::id().

Referenced by hal::PYBIND11_PLUGIN().

◆ getGates()

std::vector< Gate * > hal::GuiApiClasses::View::getGates ( int  id)
static

Returns the gates contained in a view.

Parameters
id- The id of the view.
Returns
A list of gates. Returns an empty list, if the view was not found.

Definition at line 666 of file gui_api.cpp.

References hal::GraphContext::gates(), hal::Netlist::get_gate_by_id(), hal::GraphContextManager::getContextById(), hal::gGraphContextManager, and hal::gNetlist.

Referenced by getValidObjects(), and hal::PYBIND11_PLUGIN().

◆ getGridPlacement()

GridPlacement * hal::GuiApiClasses::View::getGridPlacement ( int  viewId)
static

◆ getId()

int hal::GuiApiClasses::View::getId ( const std::string &  name)
static

Returns the id of a view.

Parameters
name- The name of the view to search for.
Returns
The id of the view. Returns 0, if the view was not found.

Definition at line 629 of file gui_api.cpp.

References hal::GraphContextManager::contextWithNameExists(), QString::fromStdString(), hal::GraphContextManager::getContexts(), hal::gGraphContextManager, and name.

Referenced by hal::PYBIND11_PLUGIN().

◆ getIds()

std::vector< u32 > hal::GuiApiClasses::View::getIds ( const std::vector< Module * >  modules,
const std::vector< Gate * >  gates 
)
static

Returns the ids of views containing at least the given modules and gates.

Parameters
modules- List of required modules.
gates- List of required gates.
Returns
A list of ids of views, which contain all given modules and gates.

Definition at line 679 of file gui_api.cpp.

References hal::Module::get_id(), hal::GraphContextManager::getContexts(), hal::gGraphContextManager, QSet::insert(), log_warning, and hal::ShortestPath::module().

Referenced by hal::PYBIND11_PLUGIN().

◆ getModules()

std::vector< Module * > hal::GuiApiClasses::View::getModules ( int  id)
static

Returns the modules contained in a view.

Parameters
id- The id of the view.
Returns
A list of modules. Returns an empty list, if the view was not found.

Definition at line 653 of file gui_api.cpp.

References hal::Netlist::get_module_by_id(), hal::GraphContextManager::getContextById(), hal::gGraphContextManager, hal::gNetlist, and hal::GraphContext::modules().

Referenced by getValidObjects(), and hal::PYBIND11_PLUGIN().

◆ getName()

std::string hal::GuiApiClasses::View::getName ( int  id)
static

Returns the name of a view.

Parameters
id- The id of the view.
Returns
The name of the view. Returns an empty string, if the view was not found.

Definition at line 644 of file gui_api.cpp.

References hal::GraphContextManager::getContextById(), hal::gGraphContextManager, hal::GraphContext::name(), and QString::toStdString().

Referenced by hal::PYBIND11_PLUGIN().

◆ getValidObjects()

◆ isolateInNew()

int hal::GuiApiClasses::View::isolateInNew ( const std::vector< Module * >  modules,
const std::vector< Gate * >  gates 
)
static

◆ moveDirectory()

void hal::GuiApiClasses::View::moveDirectory ( u32  directoryId,
std::optional< u32 destinationDirectoryId,
std::optional< int >  row 
)
static

Moves a directory under another directory.

Parameters
directoryId- The id of the directory to move.
destinationDirectoryId- The id of the destination directory. If not given, the current directory is used instead.
row- Optional. The row there the view is inserted.

Definition at line 993 of file gui_api.cpp.

References hal::UserActionObjectType::ContextDir, hal::ActionMoveItem::exec(), hal::GraphContextManager::getContextTreeModel(), hal::ContextTreeModel::getDirectory(), hal::BaseTreeItem::getParent(), hal::BaseTreeModel::getRootItem(), hal::gGraphContextManager, log_warning, and hal::UserAction::setObject().

Referenced by hal::PYBIND11_PLUGIN().

◆ moveView()

void hal::GuiApiClasses::View::moveView ( u32  viewId,
std::optional< u32 destinationDirectoryId,
std::optional< int >  row 
)
static

Moves a view to a directory.

Parameters
viewId- The id of the view.
destinationDirectoryId- The id of the destination directory. If not given, the current directory is used instead.
row- Optional. The row there the view is inserted.

Definition at line 972 of file gui_api.cpp.

References hal::UserActionObjectType::ContextView, hal::ActionMoveItem::exec(), hal::ContextTreeModel::getContext(), hal::GraphContextManager::getContextTreeModel(), hal::BaseTreeItem::getParent(), hal::BaseTreeModel::getRootItem(), hal::gGraphContextManager, and hal::UserAction::setObject().

Referenced by hal::PYBIND11_PLUGIN().

◆ removeFrom()

bool hal::GuiApiClasses::View::removeFrom ( int  id,
const std::vector< Module * >  modules,
const std::vector< Gate * >  gates 
)
static

Removes modules and gates from a view.

Parameters
id- The id of the view to remove the modules and gates from.
modules- The modules to be removed from the view.
gates- The gates to be removed from the view.
Returns
True on success, otherwise false.

Definition at line 573 of file gui_api.cpp.

References hal::UserActionObjectType::ContextView, hal::UserActionManager::executeActionBlockThread(), hal::Module::get_id(), hal::GraphContextManager::getContextById(), hal::gGraphContextManager, QSet::insert(), hal::UserActionManager::instance(), log_warning, hal::ShortestPath::module(), and hal::UserAction::setObject().

Referenced by hal::PYBIND11_PLUGIN().

◆ setCurrentDirectory()

void hal::GuiApiClasses::View::setCurrentDirectory ( u32  id)
static

Sets the id of the current directory.

Used for selection and similar.

Parameters
id- The id of the new current directory.

Definition at line 948 of file gui_api.cpp.

References hal::GraphContextManager::getContextTreeModel(), hal::ContextTreeModel::getDirectory(), hal::gGraphContextManager, and hal::ContextTreeModel::setCurrentDirectory().

Referenced by hal::PYBIND11_PLUGIN().

◆ setGridPlacement()

bool hal::GuiApiClasses::View::setGridPlacement ( int  viewId,
GridPlacement gp 
)
static

◆ setName()

bool hal::GuiApiClasses::View::setName ( int  id,
const std::string &  name 
)
static

◆ unfoldModule()

bool hal::GuiApiClasses::View::unfoldModule ( int  view_id,
Module module 
)
static

Unfold a specific module. Hides the module, shows submodules and gates.

Parameters
view_id- The id of the view.
module- The Module to unfold.
Returns
True on success, otherwise False.

Definition at line 745 of file gui_api.cpp.

References QSet::contains(), hal::UserActionManager::executeActionBlockThread(), hal::Module::get_id(), hal::GraphContextManager::getContextById(), hal::gGraphContextManager, hal::UserActionManager::instance(), log_warning, hal::ShortestPath::module(), and hal::GraphContext::modules().

Referenced by hal::PYBIND11_PLUGIN().


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