Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::ProjectSaveModel Class Reference

#include <ProjectSaveModel.h>

Public Member Functions

std::vector< std::string > getAllPythonInterfaces () const
 Return the list of python interfaces that can be saved. More...
 
virtual size_t getProjectSize (const std::vector< std::string > &wsNames)
 Find the size of a project from a list of workspace names. More...
 
std::vector< MantidQt::API::IProjectSerialisable * > getUniqueWindows (const std::vector< std::string > &wsNames) const
 Get all window handles for a collection of workspace names. More...
 
std::vector< WindowInfogetWindowInformation (const std::vector< std::string > &wsNames, bool includeUnattached=false) const
 Get all window information for a collection of workspaces. More...
 
std::vector< std::string > getWindowNames (const std::vector< std::string > &wsNames) const
 Get all window names for a collection of workspace names. More...
 
std::vector< MantidQt::API::IProjectSerialisable * > getWindows (const std::string &wsName) const
 Get all window handles for this workspace. More...
 
std::vector< WorkspaceInfogetWorkspaceInformation () const
 Get all workspace information. More...
 
std::vector< std::string > getWorkspaceNames () const
 Get all workspace names. More...
 
std::vector< Mantid::API::Workspace_sptrgetWorkspaces () const
 Get all workspaces from the ADS. More...
 
bool hasWindows (const std::string &ws) const
 Check if a workspace has any windows attached to it. More...
 
bool needsSizeWarning (const std::vector< std::string > &wsNames)
 Check if the size of the project is > than the warning size. More...
 
 ProjectSaveModel (const std::vector< MantidQt::API::IProjectSerialisable * > &windows, std::vector< std::string > activePythonInterfaces=std::vector< std::string >())
 Construct a new model instance with vector of window handles. More...
 

Private Member Functions

WindowInfo makeWindowInfoObject (MantidQt::API::IProjectSerialisable *window) const
 
WorkspaceInfo makeWorkspaceInfoObject (const Mantid::API::Workspace_const_sptr &ws) const
 Create a workspace info object for this workspace. More...
 

Private Attributes

std::vector< std::string > m_activePythonInterfaces
 
std::vector< MantidQt::API::IProjectSerialisable * > m_unattachedWindows
 
std::unordered_map< std::string, std::vector< MantidQt::API::IProjectSerialisable * > > m_workspaceWindows
 Map to hold which windows are associated with a workspace. More...
 

Detailed Description

Definition at line 45 of file ProjectSaveModel.h.

Constructor & Destructor Documentation

◆ ProjectSaveModel()

ProjectSaveModel::ProjectSaveModel ( const std::vector< MantidQt::API::IProjectSerialisable * > &  windows,
std::vector< std::string >  activePythonInterfaces = std::vector<std::string>() 
)

Construct a new model instance with vector of window handles.

Construct a new model with a list of window handles.

Parameters
windows:: vector of handles to windows open in Mantid
activePythonInterfacesThe list of active Python interfaces

Definition at line 26 of file ProjectSaveModel.cpp.

References getWorkspaces(), m_unattachedWindows, and m_workspaceWindows.

Member Function Documentation

◆ getAllPythonInterfaces()

std::vector< std::string > ProjectSaveModel::getAllPythonInterfaces ( ) const

Return the list of python interfaces that can be saved.

Get all workspace names in the model.

Returns
vector of all python interfaces names in the model

Definition at line 125 of file ProjectSaveModel.cpp.

References m_activePythonInterfaces.

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::ProjectSavePresenter().

◆ getProjectSize()

size_t ProjectSaveModel::getProjectSize ( const std::vector< std::string > &  wsNames)
virtual

Find the size of a project from a list of workspace names.

Get the project size from a list of workspace names.

Parameters
wsNamesList of workspace names to look up.
Returns
size_t The size of the project in bytes.

Definition at line 244 of file ProjectSaveModel.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by needsSizeWarning().

◆ getUniqueWindows()

std::vector< IProjectSerialisable * > ProjectSaveModel::getUniqueWindows ( const std::vector< std::string > &  wsNames) const

Get all window handles for a collection of workspace names.

Get unique windows for a list of workspace names.

Parameters
wsNames:: vector of workspace names to get associated windows for
Returns
an ordered vector of unique window handles sorted by window name

Definition at line 72 of file ProjectSaveModel.cpp.

References getWindows(), and rhs.

Referenced by getWindowInformation(), and getWindowNames().

◆ getWindowInformation()

std::vector< WindowInfo > ProjectSaveModel::getWindowInformation ( const std::vector< std::string > &  wsNames,
bool  includeUnattached = false 
) const

Get all window information for a collection of workspaces.

Get window information for a selection of workspaces.

Parameters
wsNames:: vector of workspace names to find associated windows for
includeUnattached:: whether to append windows not attached to any workspace
Returns
vector of window info objects associated with the workpaces

Definition at line 134 of file ProjectSaveModel.cpp.

References getUniqueWindows(), m_unattachedWindows, and makeWindowInfoObject().

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::excludeWindowsForUncheckedWorkspace(), MantidQt::MantidWidgets::ProjectSavePresenter::includeWindowsForCheckedWorkspace(), and MantidQt::MantidWidgets::ProjectSavePresenter::ProjectSavePresenter().

◆ getWindowNames()

std::vector< std::string > ProjectSaveModel::getWindowNames ( const std::vector< std::string > &  wsNames) const

Get all window names for a collection of workspace names.

Get all unique window names for a list of workspaces.

Parameters
wsNames:: vector of workspace names to get associated window names for
Returns
an ordered vector of unique window names sorted alphabetically

Definition at line 96 of file ProjectSaveModel.cpp.

References getUniqueWindows().

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::excludeWindowsForUncheckedWorkspace(), and MantidQt::MantidWidgets::ProjectSavePresenter::includeWindowsForCheckedWorkspace().

◆ getWindows()

std::vector< IProjectSerialisable * > ProjectSaveModel::getWindows ( const std::string &  wsName) const

Get all window handles for this workspace.

Get windows which are associated with a given workspace name.

Parameters
wsName:: the name of the workspace to get window for
Returns
vector of window handles for the workspace

Definition at line 59 of file ProjectSaveModel.cpp.

References hasWindows(), and m_workspaceWindows.

Referenced by getUniqueWindows(), and makeWorkspaceInfoObject().

◆ getWorkspaceInformation()

std::vector< WorkspaceInfo > ProjectSaveModel::getWorkspaceInformation ( ) const

Get all workspace information.

Get workspace information for all workspaces.

Returns
vector of workspace info objects for all workspaces

Definition at line 166 of file ProjectSaveModel.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), and makeWorkspaceInfoObject().

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::ProjectSavePresenter().

◆ getWorkspaceNames()

std::vector< std::string > ProjectSaveModel::getWorkspaceNames ( ) const

Get all workspace names.

Get all workspace names in the model.

Returns
vector of all workspace names in the model

Definition at line 110 of file ProjectSaveModel.cpp.

References m_workspaceWindows.

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::ProjectSavePresenter().

◆ getWorkspaces()

std::vector< Workspace_sptr > ProjectSaveModel::getWorkspaces ( ) const

Get all workspaces from the ADS.

Returns
vector of workspace handles from the ADS

Definition at line 192 of file ProjectSaveModel.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by ProjectSaveModel().

◆ hasWindows()

bool ProjectSaveModel::hasWindows ( const std::string &  wsName) const

Check if a workspace has any windows attached to it.

Check is a workspace has any windows associated with it.

Parameters
wsName:: the name of workspace
Returns
whether the workspace has > 0 windows associated with it

Definition at line 213 of file ProjectSaveModel.cpp.

References m_workspaceWindows.

Referenced by getWindows().

◆ makeWindowInfoObject()

WindowInfo ProjectSaveModel::makeWindowInfoObject ( MantidQt::API::IProjectSerialisable window) const
private

◆ makeWorkspaceInfoObject()

WorkspaceInfo ProjectSaveModel::makeWorkspaceInfoObject ( const Mantid::API::Workspace_const_sptr ws) const
private

◆ needsSizeWarning()

bool ProjectSaveModel::needsSizeWarning ( const std::vector< std::string > &  wsNames)

Check if the size of the project is > than the warning size.

Check if the project size will be larger than the warning size defined in mantid.properties.

Parameters
wsNamesA vector of workspace names as strings.
Returns
true If larger warning.
false If equal or less than warning.

Definition at line 230 of file ProjectSaveModel.cpp.

References getProjectSize(), and Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by MantidQt::MantidWidgets::ProjectSavePresenter::needsSizeWarning().

Member Data Documentation

◆ m_activePythonInterfaces

std::vector<std::string> MantidQt::MantidWidgets::ProjectSaveModel::m_activePythonInterfaces
private

Definition at line 87 of file ProjectSaveModel.h.

Referenced by getAllPythonInterfaces().

◆ m_unattachedWindows

std::vector<MantidQt::API::IProjectSerialisable *> MantidQt::MantidWidgets::ProjectSaveModel::m_unattachedWindows
private

Definition at line 86 of file ProjectSaveModel.h.

Referenced by getWindowInformation(), and ProjectSaveModel().

◆ m_workspaceWindows

std::unordered_map<std::string, std::vector<MantidQt::API::IProjectSerialisable *> > MantidQt::MantidWidgets::ProjectSaveModel::m_workspaceWindows
private

Map to hold which windows are associated with a workspace.

Definition at line 84 of file ProjectSaveModel.h.

Referenced by getWindows(), getWorkspaceNames(), hasWindows(), and ProjectSaveModel().


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