Mantid
Loading...
Searching...
No Matches
ProjectSaveModel.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
12
13#include "DllOption.h"
14#include <unordered_map>
15#include <vector>
16
17namespace MantidQt {
18namespace MantidWidgets {
19
20// POD structs to pass information to the view
21//==============================================================================
22
24 std::string name;
25 std::string type;
26 std::string size;
27 std::string icon_id;
28 size_t numWindows;
29 std::vector<WorkspaceInfo> subWorkspaces;
30
31 bool operator==(const WorkspaceInfo &b) const { return name == b.name; }
32};
33
34struct WindowInfo {
35 std::string name;
36 std::string type;
37 std::string icon_id;
38
39 bool operator==(const WindowInfo &b) const { return name == b.name; }
40};
41
42// Model definition
43//==============================================================================
44
46public:
48 ProjectSaveModel(const std::vector<MantidQt::API::IProjectSerialisable *> &windows,
49 std::vector<std::string> activePythonInterfaces = std::vector<std::string>());
50
52 bool hasWindows(const std::string &ws) const;
54 std::vector<std::string> getWindowNames(const std::vector<std::string> &wsNames) const;
56 std::vector<std::string> getWorkspaceNames() const;
58 std::vector<std::string> getAllPythonInterfaces() const;
60 std::vector<WindowInfo> getWindowInformation(const std::vector<std::string> &wsNames,
61 bool includeUnattached = false) const;
63 std::vector<WorkspaceInfo> getWorkspaceInformation() const;
65 std::vector<MantidQt::API::IProjectSerialisable *> getWindows(const std::string &wsName) const;
67 std::vector<MantidQt::API::IProjectSerialisable *> getUniqueWindows(const std::vector<std::string> &wsNames) const;
69 std::vector<Mantid::API::Workspace_sptr> getWorkspaces() const;
71 bool needsSizeWarning(const std::vector<std::string> &wsNames);
73 virtual size_t getProjectSize(const std::vector<std::string> &wsNames);
74
75private:
77 WorkspaceInfo makeWorkspaceInfoObject(const Mantid::API::Workspace_const_sptr &ws) const;
78
79 WindowInfo makeWindowInfoObject(MantidQt::API::IProjectSerialisable *window) const;
80
81 // Instance variables
82
84 std::unordered_map<std::string, std::vector<MantidQt::API::IProjectSerialisable *>> m_workspaceWindows;
85
86 std::vector<MantidQt::API::IProjectSerialisable *> m_unattachedWindows;
87 std::vector<std::string> m_activePythonInterfaces;
88};
89
90} // namespace MantidWidgets
91} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
Defines an interface to a MantidPlot class that can be saved into or loaded from a project.
std::unordered_map< std::string, std::vector< MantidQt::API::IProjectSerialisable * > > m_workspaceWindows
Map to hold which windows are associated with a workspace.
std::vector< std::string > m_activePythonInterfaces
std::vector< MantidQt::API::IProjectSerialisable * > m_unattachedWindows
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< const Workspace > Workspace_const_sptr
shared pointer to Mantid::API::Workspace (const version)
Definition: Workspace_fwd.h:22
bool operator==(const WindowInfo &b) const
std::vector< WorkspaceInfo > subWorkspaces
bool operator==(const WorkspaceInfo &b) const