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"
14
15namespace Mantid {
16
17namespace Kernel {
18class Logger;
19}
20
21namespace API {
22class AnalysisDataServiceImpl;
23class WorkspaceHistory;
24
30class MANTID_API_DLL Workspace : public Kernel::DataItem {
31public:
32 Workspace();
33 ~Workspace() override;
34
54 Workspace_uptr clone() const { return Workspace_uptr(doClone()); }
55
57 Workspace_uptr cloneEmpty() const { return Workspace_uptr(doCloneEmpty()); }
58
59 Workspace &operator=(const Workspace &other) = delete;
60 // DataItem interface
67 bool threadSafe() const override { return true; }
68
69 void virtual setTitle(const std::string &);
70 void setComment(const std::string &);
71 void setPythonVariableName(const std::string &);
72 virtual const std::string getTitle() const;
73 const std::string &getComment() const;
74 const std::string &getName() const override;
75 const std::string &getPythonVariableName() const;
76 bool isDirty(const int n = 1) const;
77 virtual bool isGroup() const { return false; }
79 virtual size_t getMemorySize() const = 0;
81 std::string getMemorySizeAsStr() const;
82
84 WorkspaceHistory &history() { return *m_history; }
86 const WorkspaceHistory &getHistory() const { return *m_history; }
87
88protected:
90 Workspace(const Workspace &);
91
92private:
93 void setName(const std::string &);
95 std::string m_title;
97 std::string m_comment;
100 std::string m_name;
104 std::unique_ptr<WorkspaceHistory> m_history;
105
107 virtual Workspace *doClone() const = 0;
110 virtual Workspace *doCloneEmpty() const = 0;
111
113};
114
115} // namespace API
116} // namespace Mantid
117
118// Instantiated and exported by API/src/PropertyWithValue.cpp
119MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue<std::shared_ptr<Mantid::API::Workspace>>);
std::string getName(const IMDDimension &self)
MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue< std::shared_ptr< Mantid::API::Workspace > >)
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:30
bool threadSafe() const override
Marks the workspace as safe for multiple threads to edit data simutaneously.
Definition Workspace.h:67
std::string m_pythonVariableName
The name of the variable holding the workspace, if not stored in the ADS.
Definition Workspace.h:102
const WorkspaceHistory & getHistory() const
Returns a reference to the WorkspaceHistory const.
Definition Workspace.h:86
WorkspaceHistory & history()
Returns a reference to the WorkspaceHistory.
Definition Workspace.h:84
std::string m_comment
A user-provided comment that is attached to the workspace.
Definition Workspace.h:97
Workspace & operator=(const Workspace &other)=delete
Workspace_uptr cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition Workspace.h:57
std::string m_title
The title of the workspace.
Definition Workspace.h:95
std::unique_ptr< WorkspaceHistory > m_history
The history of the workspace, algorithm and environment.
Definition Workspace.h:104
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:100
virtual size_t getMemorySize() const =0
Get the footprint in memory in bytes.
virtual bool isGroup() const
Definition Workspace.h:77
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:54
This class forms the base class of any item that wishes to be stored in the analysis data service.
Definition DataItem.h:39
The concrete, templated class for properties.
std::unique_ptr< Workspace > Workspace_uptr
unique pointer to Mantid::API::Workspace
Helper class which provides the Collimation Length for SANS instruments.