Mantid
Loading...
Searching...
No Matches
Workspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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
9#include "MantidAPI/DllConfig.h"
13
14namespace Mantid {
15
16namespace Kernel {
17class Logger;
18}
19
20namespace API {
21class AnalysisDataServiceImpl;
22class WorkspaceHistory;
23
29class MANTID_API_DLL Workspace : public Kernel::DataItem {
30public:
31 Workspace();
33
53 Workspace_uptr clone() const { return Workspace_uptr(doClone()); }
54
56 Workspace_uptr cloneEmpty() const { return Workspace_uptr(doCloneEmpty()); }
57
58 Workspace &operator=(const Workspace &other) = delete;
59 // DataItem interface
66 bool threadSafe() const override { return true; }
67
68 void virtual setTitle(const std::string &);
69 void setComment(const std::string &);
70 void setPythonVariableName(const std::string &);
71 virtual const std::string getTitle() const;
72 const std::string &getComment() const;
73 const std::string &getName() const override;
74 const std::string &getPythonVariableName() const;
75 bool isDirty(const int n = 1) const;
76 virtual bool isGroup() const { return false; }
78 virtual size_t getMemorySize() const = 0;
80 std::string getMemorySizeAsStr() const;
81
83 WorkspaceHistory &history() { return *m_history; }
85 const WorkspaceHistory &getHistory() const { return *m_history; }
86
87protected:
89 Workspace(const Workspace &);
90
91private:
92 void setName(const std::string &);
94 std::string m_title;
96 std::string m_comment;
99 std::string m_name;
103 std::unique_ptr<WorkspaceHistory> m_history;
104
106 virtual Workspace *doClone() const = 0;
109 virtual Workspace *doCloneEmpty() const = 0;
110
112};
113
114} // namespace API
115} // namespace Mantid
std::string getName(const IMDDimension &self)
The Analysis data service stores instances of the Workspace objects and anything that derives from te...
This class stores information about the Workspace History used by algorithms on a workspace and the e...
Base Workspace Abstract Class.
Definition Workspace.h:29
bool threadSafe() const override
Marks the workspace as safe for multiple threads to edit data simutaneously.
Definition Workspace.h:66
std::string m_pythonVariableName
The name of the variable holding the workspace, if not stored in the ADS.
Definition Workspace.h:101
const WorkspaceHistory & getHistory() const
Returns a reference to the WorkspaceHistory const.
Definition Workspace.h:85
WorkspaceHistory & history()
Returns a reference to the WorkspaceHistory.
Definition Workspace.h:83
std::string m_comment
A user-provided comment that is attached to the workspace.
Definition Workspace.h:96
Workspace & operator=(const Workspace &other)=delete
Workspace_uptr cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition Workspace.h:56
std::string m_title
The title of the workspace.
Definition Workspace.h:94
std::unique_ptr< WorkspaceHistory > m_history
The history of the workspace, algorithm and environment.
Definition Workspace.h:103
virtual Workspace * doCloneEmpty() const =0
Virtual cloneEmpty method.
std::string m_name
The name associated with the object within the ADS (This is required for workspace algebra.
Definition Workspace.h:99
virtual size_t getMemorySize() const =0
Get the footprint in memory in bytes.
virtual bool isGroup() const
Definition Workspace.h:76
virtual Workspace * doClone() const =0
Virtual clone method. Not implemented to force implementation in children.
Workspace_uptr clone() const
Returns a clone (copy) of the workspace with covariant return type in all derived classes.
Definition Workspace.h:53
This class forms the base class of any item that wishes to be stored in the analysis data service.
Definition DataItem.h:39
std::unique_ptr< Workspace > Workspace_uptr
unique pointer to Mantid::API::Workspace
Helper class which provides the Collimation Length for SANS instruments.