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#include "MantidParallel/StorageMode.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(const Parallel::StorageMode storageMode = Parallel::StorageMode::Cloned);
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 virtual const std::string getTitle() const;
72 const std::string &getComment() const;
73 const std::string &getName() const override;
74 bool isDirty(const int n = 1) const;
75 virtual bool isGroup() const { return false; }
77 virtual size_t getMemorySize() const = 0;
79 std::string getMemorySizeAsStr() const;
80
82 WorkspaceHistory &history() { return *m_history; }
84 const WorkspaceHistory &getHistory() const { return *m_history; }
85
86 Parallel::StorageMode storageMode() const;
87
88protected:
90 Workspace(const Workspace &);
91 void setStorageMode(Parallel::StorageMode mode);
92
93private:
94 void setName(const std::string &);
96 std::string m_title;
98 std::string m_comment;
101 std::string m_name;
103 std::unique_ptr<WorkspaceHistory> m_history;
105 Parallel::StorageMode m_storageMode;
106
108 virtual Workspace *doClone() const = 0;
111 virtual Workspace *doCloneEmpty() const = 0;
112
114};
115
116} // namespace API
117} // 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:30
bool threadSafe() const override
Marks the workspace as safe for multiple threads to edit data simutaneously.
Definition: Workspace.h:67
const WorkspaceHistory & getHistory() const
Returns a reference to the WorkspaceHistory const.
Definition: Workspace.h:84
WorkspaceHistory & history()
Returns a reference to the WorkspaceHistory.
Definition: Workspace.h:82
std::string m_comment
A user-provided comment that is attached to the workspace.
Definition: Workspace.h:98
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:96
Parallel::StorageMode m_storageMode
Storage mode of the Workspace (used for MPI runs)
Definition: Workspace.h:105
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:101
virtual size_t getMemorySize() const =0
Get the footprint in memory in bytes.
virtual bool isGroup() const
Definition: Workspace.h:75
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
std::unique_ptr< Workspace > Workspace_uptr
unique pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:24
Helper class which provides the Collimation Length for SANS instruments.