12#include "MantidIndexing/SpectrumIndexSet.h"
18template <
typename T1,
typename T2>
23template <
typename T1,
typename T2>
41template <
typename T,
const int AllowedIndexTypes,
typename... WSPropArgs,
typename>
43 WSPropArgs &&...wsPropArgs) {
45 std::forward<WSPropArgs>(wsPropArgs)...);
46 const auto &wsPropRef = *wsProp;
50 auto indexTypeProp = std::make_unique<IndexTypeProperty>(indexTypePropName, AllowedIndexTypes);
51 const auto &indexTypePropRef = *indexTypeProp;
53 declareProperty(std::move(indexTypeProp),
"The type of indices in the optional index set; For optimal "
54 "performance WorkspaceIndex should be preferred;");
57 declareProperty(std::make_unique<IndexProperty>(indexPropName, wsPropRef, indexTypePropRef),
58 "An optional set of spectra that will be processed by the "
59 "algorithm; If not set, all spectra will be processed; The "
60 "indices in this list can be workspace indices or possibly "
61 "spectrum numbers, depending on the selection made for the "
62 "index type; Indices are entered as a comma-separated list "
63 "of values, and/or ranges; For example, '4,6,10-20,1000';");
70template <
typename T1,
typename T2,
typename WsType>
73 throw std::runtime_error(
"Algorithm::setWorkspaceInputProperties can only be used "
74 "with properties declared using "
75 "declareWorkspaceInputProperties.");
82 setWorkspaceProperty<WsType, T1>(wsProp, wksp, std::is_convertible<T1, std::shared_ptr<WsType>>());
84 *indexTypeProp = type;
98template <
typename T1,
typename T2,
typename,
typename>
101 doSetInputProperties<std::shared_ptr<T1>, T2, T1>(
name, wksp, type, list);
113template <
typename T1,
typename T2,
typename,
typename>
116 doSetInputProperties<std::string, T2, T1>(
name, wsName, type, list);
125template <
typename T,
typename>
126std::tuple<std::shared_ptr<T>, Indexing::SpectrumIndexSet>
129 throw std::runtime_error(
"Algorithm::getWorkspacesAndIndices can only be used "
130 "with properties declared using "
131 "declareWorkspaceInputProperties.");
143 Indexing::SpectrumIndexSet indexSet = *indexProp;
145 return std::make_tuple(ws, indexSet);
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
void doSetInputProperties(const std::string &name, const T1 &wksp, IndexType type, const T2 &list)
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
std::vector< std::string > m_reservedList
Reserved property names.
void declareWorkspaceInputProperties(const std::string &propertyName, const std::string &doc, WSPropArgs &&...wsPropArgs)
Declare a property which defines the workspace and allowed index types, as well as a property for cap...
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void setWorkspaceInputProperties(const std::string &name, const std::shared_ptr< T1 > &wksp, IndexType type, const T2 &list)
Mechanism for setting the index property with a workspace shared pointer.
bool isCompoundProperty(const std::string &name) const
std::tuple< std::shared_ptr< T >, Indexing::SpectrumIndexSet > getWorkspaceAndIndices(const std::string &name) const
Mechanism for retriving the index property.
const std::string name() const override=0
function to return a name of the algorithm, must be overridden in all algorithms
IndexProperty : Implementation of a property type which returns a SpectrumIndexSet provided an input ...
static std::string generatePropertyName(const std::string &name="")
IndexTypeProperty : Implementation of a property which stores the type of input indices users require...
static std::string generatePropertyName(const std::string &name="")
A property class for workspaces.
std::string setValue(const std::string &value) override
Set the name of the workspace.
Helper class which provides the Collimation Length for SANS instruments.
@ Input
An input workspace.