Mantid
Loading...
Searching...
No Matches
BraggScattererFactory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 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 "MantidGeometry/DllConfig.h"
12
15
16namespace Mantid {
17namespace Geometry {
18
53class MANTID_GEOMETRY_DLL BraggScattererFactoryImpl : public Kernel::DynamicFactory<BraggScatterer> {
54public:
55 BraggScatterer_sptr createScatterer(const std::string &name, const std::string &properties = "") const;
56
58 template <class C> void subscribeScatterer() {
59 auto instantiator = std::make_unique<Kernel::Instantiator<C, BraggScatterer>>();
60 BraggScatterer_sptr scatterer = instantiator->createInstance();
61
62 subscribe(scatterer->name(), std::move(instantiator));
63 }
64
65private:
67
69};
70
72
73} // namespace Geometry
74} // namespace Mantid
75
76namespace Mantid {
77namespace Kernel {
78EXTERN_MANTID_GEOMETRY template class MANTID_GEOMETRY_DLL
80}
81} // namespace Mantid
82
83#define DECLARE_BRAGGSCATTERER(classname) \
84 namespace { \
85 Mantid::Kernel::RegistrationHelper register_scatterer_##classname( \
86 ((Mantid::Geometry::BraggScattererFactory::Instance().subscribeScatterer<classname>()), 0)); \
87 }
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.
std::shared_ptr< BraggScatterer > BraggScatterer_sptr
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...