Mantid
Loading...
Searching...
No Matches
MDTransfFactory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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/* Used to register unit classes into the factory. creates a global object in an
10 * anonymous namespace. The object itself does nothing, but the comma operator
11 * is used in the call to its constructor to effect a call to the factory's
12 * subscribe method.
13 *
14
15 * The second operation that this macro performs is to provide the definition
16 * of the unitID method for the concrete unit.
17
18 * Second macro does the same thing as the first one, but allow to register the
19 transformation
20 * with a name, different form the class name and specified by the
21 transformation ID.
22 */
23#define DECLARE_MD_TRANSF(classname) \
24 namespace { \
25 Mantid::Kernel::RegistrationHelper register_alg_##classname( \
26 ((Mantid::MDAlgorithms::MDTransfFactory::Instance().subscribe<classname>(#classname)), 0)); \
27 } \
28 const std::string Mantid::MDAlgorithms::classname::transfID() const { return #classname; }
29
30#define DECLARE_MD_TRANSFID(classname, regID) \
31 namespace { \
32 Mantid::Kernel::RegistrationHelper \
33 register_alg_##classname(((Mantid::MDAlgorithms::MDTransfFactory::Instance().subscribe<classname>(#regID)), 0)); \
34 } \
35 const std::string Mantid::MDAlgorithms::classname::transfID() const { return #regID; }
36
37//----------------------------------------------------------------------
38// Includes
39//----------------------------------------------------------------------
40#include "MantidMDAlgorithms/DllConfig.h"
41
44
46
47namespace Mantid {
48namespace MDAlgorithms {
49
69class MANTID_MDALGORITHMS_DLL MDTransfFactoryImpl : public Kernel::DynamicFactory<MDTransfInterface> {
70public:
71 std::shared_ptr<MDTransfInterface> create(const std::string &className) const override;
74
75private:
81 mutable std::map<std::string, std::shared_ptr<MDTransfInterface>> m_createdTransf;
82};
83
87
88} // namespace MDAlgorithms
89} // namespace Mantid
90
91namespace Mantid {
92namespace Kernel {
93EXTERN_MANTID_MDALGORITHMS template class MANTID_MDALGORITHMS_DLL
95}
96} // namespace Mantid
The dynamic factory is a base dynamic factory for serving up objects in response to requests from oth...
Manage the lifetime of a class intended to be a singleton.
Creates instances of concrete transformations into multidimensional (MD) coordinates.
MDTransfFactoryImpl & operator=(const MDTransfFactoryImpl &)=delete
MDTransfFactoryImpl(const MDTransfFactoryImpl &)=delete
std::map< std::string, std::shared_ptr< MDTransfInterface > > m_createdTransf
Stores pointers to already created unit instances, with their name as the key.
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...