16#include <Poco/NObserver.h>
40 WorkspaceGroup(
const Parallel::StorageMode storageMode = Parallel::StorageMode::Cloned);
44 const std::string
id()
const override {
return "WorkspaceGroup"; }
46 const std::string toString()
const override;
49 size_t getMemorySize()
const override;
51 void sortMembersByName();
57 size_t size()
const {
return m_workspaces.size(); }
63 std::vector<Workspace_sptr> getAllItems()
const;
68 bool isGroup()
const override {
return true; }
71 bool areNamesSimilar()
const;
73 bool isMultiperiod()
const;
75 bool isInGroup(
const Workspace &workspaceToCheck,
size_t level = 0)
const;
79 void throwIndexOutOfRangeError(
int index)
const;
83 std::vector<Workspace_sptr>::iterator begin();
86 std::vector<Workspace_sptr>::iterator end();
89 std::vector<Workspace_sptr>::const_iterator begin()
const;
92 std::vector<Workspace_sptr>::const_iterator end()
const;
101 void add(
const std::string &wsName) { AnalysisDataService::Instance().addToGroup(this->
getName(), wsName); }
103 void remove(
const std::string &wsName) { AnalysisDataService::Instance().removeFromGroup(this->
getName(), wsName); }
105 bool containsInChildren(
const std::string &wsName)
const;
107 bool contains(
const std::string &wsName)
const;
111 void reportMembers(std::set<Workspace_sptr> &memberList)
const;
115 std::vector<std::string> getNames()
const;
123 throw std::runtime_error(
"Cloning of WorkspaceGroup is not implemented.");
126 throw std::runtime_error(
"Cloning of WorkspaceGroup is not implemented.");
130 void removeByADS(
const std::string &wsName);
132 void observeADSNotifications(
const bool observeADS);
134 bool isInChildGroup(
const Workspace &workspaceToCheck)
const;
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
PyObject * getItem(WorkspaceGroup &self, const int &index)
void removeItem(WorkspaceGroup &self, const std::string &name)
void addWorkspace(WorkspaceGroup &self, const boost::python::object &pyobj)
std::string getName(const IMDDimension &self)
Base class from which all concrete algorithm classes should be derived.
The Analysis data service stores instances of the Workspace objects and anything that derives from te...
Class to hold a set of workspaces.
void remove(const std::string &wsName)
Remove a name from the group.
WorkspaceGroup(const WorkspaceGroup &ref)=delete
Poco::NObserver< WorkspaceGroup, Mantid::API::WorkspaceBeforeReplaceNotification > m_beforeReplaceObserver
Observer for workspace before-replace notifications.
int getNumberOfEntries() const
Return the number of entries within the group.
const std::string id() const override
Return a string ID of the class.
Poco::NObserver< WorkspaceGroup, Mantid::API::WorkspacePostDeleteNotification > m_deleteObserver
Observer for workspace delete notifications.
WorkspaceGroup * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
bool isGroup() const override
bool m_observingADS
Flag as to whether the observers have been added to the ADS.
std::vector< Workspace_sptr > m_workspaces
The list of workspace pointers in the group.
WorkspaceGroup & operator=(const WorkspaceGroup &)=delete
void sortByName()
Invokes the ADS to sort group members by workspace name.
std::recursive_mutex m_mutex
Recursive mutex to avoid simultaneous access.
void add(const std::string &wsName)
Adds a workspace to the group.
WorkspaceGroup * doCloneEmpty() const override
Virtual cloneEmpty method.
size_t size() const
Return the size of the group, so it is more like a container.
Base Workspace Abstract Class.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::BeforeReplaceNotification > & WorkspaceBeforeReplaceNotification_ptr
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::PostDeleteNotification > & WorkspacePostDeleteNotification_ptr
Helper class which provides the Collimation Length for SANS instruments.