Mantid
Loading...
Searching...
No Matches
MDUnitFactory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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
10#include "MantidKernel/DllConfig.h"
11#include "MantidKernel/MDUnit.h"
12#include "MantidKernel/System.h"
13#include <memory>
14
15namespace Mantid {
16namespace Kernel {
17
21class MANTID_KERNEL_DLL MDUnitFactory : public ChainableFactory<MDUnitFactory, MDUnit, std::string> {
22
23private:
25 MDUnit *createRaw(const std::string &unitString) const override = 0;
26
28 bool canInterpret(const std::string &unitString) const override = 0;
29};
30
31//-----------------------------------------------------------------------
32// Derived MDUnitFactory declarations
33//-----------------------------------------------------------------------
34
35class MANTID_KERNEL_DLL LabelUnitFactory : public MDUnitFactory {
36 LabelUnit *createRaw(const std::string &unitString) const override;
37 bool canInterpret(const std::string &unitString) const override;
38};
39
40class MANTID_KERNEL_DLL InverseAngstromsUnitFactory : public MDUnitFactory {
41 InverseAngstromsUnit *createRaw(const std::string &unitString) const override;
42 bool canInterpret(const std::string &unitString) const override;
43};
44
45class MANTID_KERNEL_DLL ReciprocalLatticeUnitFactory : public MDUnitFactory {
46 ReciprocalLatticeUnit *createRaw(const std::string &unitString) const override;
47 bool canInterpret(const std::string &unitString) const override;
48};
49
50using MDUnitFactory_uptr = std::unique_ptr<MDUnitFactory>;
51
52using MDUnitFactory_const_uptr = std::unique_ptr<const MDUnitFactory>;
53
56
57} // namespace Kernel
58} // namespace Mantid
ChainableFactory : Chain of Responsiblity generic factory.
Inverse Angstroms unit.
Definition: MDUnit.h:51
MDUnitFactory : Abstract type.
Definition: MDUnitFactory.h:21
bool canInterpret(const std::string &unitString) const override=0
Indicate an ability to intepret the string.
MDUnit * createRaw(const std::string &unitString) const override=0
Create the product.
MDUnit : Unit type for multidimensional data types.
Definition: MDUnit.h:20
std::unique_ptr< const MDUnitFactory > MDUnitFactory_const_uptr
Definition: MDUnitFactory.h:52
std::unique_ptr< MDUnitFactory > MDUnitFactory_uptr
Definition: MDUnitFactory.h:50
MDUnitFactory_uptr MANTID_KERNEL_DLL makeMDUnitFactoryChain()
Convience method. Pre-constructed builder chain.
Helper class which provides the Collimation Length for SANS instruments.