Mantid
Loading...
Searching...
No Matches
ScopedWorkspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 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 <string>
10
11#include "MantidAPI/DllConfig.h"
13#include "MantidKernel/System.h"
14
15namespace Mantid {
16namespace API {
34class MANTID_API_DLL ScopedWorkspace {
35public:
38
41
43 virtual ~ScopedWorkspace();
44
47
50
52 std::string name() const { return m_name; }
53
55 Workspace_sptr retrieve() const;
56
58 void remove();
59
61 operator bool() const;
62
64 void set(const Workspace_sptr &newWS);
65
66private:
68 const std::string m_name;
69
71 static std::string generateUniqueName();
72
74 static std::string randomString(size_t len);
75
77 static const size_t NAME_LENGTH;
78};
79
80} // namespace API
81} // namespace Mantid
ScopedWorkspace : scoped workspace ADS entry.
ScopedWorkspace(const ScopedWorkspace &)=delete
Disable copy operator.
const std::string m_name
ADS name of the workspace.
static const size_t NAME_LENGTH
Length of workspace names generated.
ScopedWorkspace & operator=(const ScopedWorkspace &)=delete
Disable assignment operator.
std::string name() const
Returns ADS name of the workspace.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
Helper class which provides the Collimation Length for SANS instruments.