Mantid
Loading...
Searching...
No Matches
IMaskWorkspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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"
12
13#include <memory>
14#include <set>
15#include <string>
16#include <vector>
17
18namespace Mantid {
19namespace API {
20
24// Reference Docs
25// Concepts: TODO
26// API: TODO
27
28class MANTID_API_DLL IMaskWorkspace {
29public:
30 IMaskWorkspace() = default;
32 virtual ~IMaskWorkspace() = default;
34 virtual const std::string id() const { return "IMaskWorkspace"; }
36 virtual std::size_t getNumberMasked() const = 0;
38 virtual bool containsDetID(const detid_t detectorID) const = 0;
39 virtual bool containsDetIDs(const std::set<detid_t> &detectorIDs) const = 0;
40 virtual bool containsDetIDs(const std::vector<detid_t> &detectorIDs) const = 0;
42 virtual bool isMasked(const detid_t detectorID) const = 0;
44 virtual bool isMasked(const std::set<detid_t> &detectorIDs) const = 0;
46 virtual void setMasked(const detid_t detectorID, const bool mask = true) = 0;
48 virtual void setMasked(const std::set<detid_t> &detectorIDs, const bool mask = true) = 0;
50 std::unique_ptr<IMaskWorkspace> clone() const { return std::unique_ptr<IMaskWorkspace>(doInterfaceClone()); }
51
52protected:
54 IMaskWorkspace(const IMaskWorkspace &other) { (void)other; }
55
57 virtual IMaskWorkspace *doInterfaceClone() const = 0;
58};
59
61using IMaskWorkspace_sptr = std::shared_ptr<IMaskWorkspace>;
63using IMaskWorkspace_const_sptr = std::shared_ptr<const IMaskWorkspace>;
64} // namespace API
65} // namespace Mantid
66
67// Instantiated and exported by API/src/PropertyWithValue.cpp
68MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue<std::shared_ptr<Mantid::API::IMaskWorkspace>>);
MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue< std::shared_ptr< Mantid::API::IMaskWorkspace > >)
This class provides an interface to a MaskWorkspace.
virtual const std::string id() const
Return the workspace typeID.
virtual IMaskWorkspace * doInterfaceClone() const =0
returns a clone of the workspace as the interface
virtual void setMasked(const detid_t detectorID, const bool mask=true)=0
Set / remove mask of a detector.
virtual bool isMasked(const detid_t detectorID) const =0
Check if a detector is masked.
virtual bool containsDetIDs(const std::set< detid_t > &detectorIDs) const =0
virtual std::size_t getNumberMasked() const =0
Total number of masked pixels.
IMaskWorkspace & operator=(const IMaskWorkspace &)=delete
virtual ~IMaskWorkspace()=default
virtual void setMasked(const std::set< detid_t > &detectorIDs, const bool mask=true)=0
Set / remove masks of all detectors in a set.
virtual bool containsDetID(const detid_t detectorID) const =0
Check if detector id exists in mask.
IMaskWorkspace(const IMaskWorkspace &other)
Protected copy constructor. May be used by childs for cloning.
virtual bool isMasked(const std::set< detid_t > &detectorIDs) const =0
Check if all detectors in a set are masked.
virtual bool containsDetIDs(const std::vector< detid_t > &detectorIDs) const =0
std::unique_ptr< IMaskWorkspace > clone() const
Returns a clone of the workspace.
The concrete, templated class for properties.
std::shared_ptr< const IMaskWorkspace > IMaskWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< IMaskWorkspace > IMaskWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.