79 if (!newWS->getName().empty() && ads.
doesExist(newWS->getName()))
80 throw std::invalid_argument(
"Workspace is already in the ADS under the name " + newWS->getName());
108 static const std::string alphabet =
"0123456789abcdefghijklmnopqrstuvwxyz";
113 while (result.size() != len) {
114 size_t randPos = ((rand() % (alphabet.size() - 1)));
115 result.push_back(alphabet[randPos]);
The Analysis data service stores instances of the Workspace objects and anything that derives from te...
void add(const std::string &name, const std::shared_ptr< API::Workspace > &workspace) override
Overridden add member to attach the name to the workspace when a workspace object is added to the ser...
void deepRemoveGroup(const std::string &name)
Remove a workspace group and all its members from the ADS.
virtual void remove(const std::string &name)
Overridden remove member to delete its name held by the workspace itself.
std::shared_ptr< WSTYPE > retrieveWS(const std::string &name) const
Retrieve a workspace and cast it to the given WSTYPE.
void set(const Workspace_sptr &newWS)
Make ADS entry to point to the given workspace.
static std::string generateUniqueName()
Generates a tricky name which is unique within ADS.
static std::string randomString(size_t len)
Generates a random alpha-numeric string.
virtual ~ScopedWorkspace()
Destructor.
Workspace_sptr retrieve() const
Retrieve workspace from the ADS.
ScopedWorkspace()
Empty constructor.
void remove()
Removes the workspace entry from the ADS.
const std::string m_name
ADS name of the workspace.
static const size_t NAME_LENGTH
Length of workspace names generated.
Class to hold a set of workspaces.
Base Workspace Abstract Class.
bool doesExist(const std::string &name) const
Check to see if a data object exists in the store.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace