Mantid
Loading...
Searching...
No Matches
Framework
Geometry
inc
MantidGeometry
Crystal
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"
10
#include "
MantidKernel/DynamicFactory.h
"
11
#include "
MantidKernel/SingletonHolder.h
"
12
13
#include "
MantidGeometry/Crystal/BraggScatterer.h
"
14
#include "
MantidGeometry/Crystal/CompositeBraggScatterer.h
"
15
16
namespace
Mantid
{
17
namespace
Geometry {
18
53
class
MANTID_GEOMETRY_DLL
BraggScattererFactoryImpl
:
public
Kernel::DynamicFactory
<BraggScatterer> {
54
public
:
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
65
private
:
66
friend
struct
Mantid::Kernel::CreateUsingNew
<
BraggScattererFactoryImpl
>;
67
68
BraggScattererFactoryImpl
();
69
};
70
71
using
BraggScattererFactory
=
Mantid::Kernel::SingletonHolder<BraggScattererFactoryImpl>
;
72
73
}
// namespace Geometry
74
}
// namespace Mantid
75
76
namespace
Mantid
{
77
namespace
Kernel {
78
EXTERN_MANTID_GEOMETRY
template
class
MANTID_GEOMETRY_DLL
79
Mantid::Kernel::SingletonHolder<Mantid::Geometry::BraggScattererFactoryImpl>
;
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
}
name
std::string name
Definition
Run.cpp:60
BraggScatterer.h
CompositeBraggScatterer.h
DynamicFactory.h
SingletonHolder.h
Mantid::Geometry::BraggScattererFactoryImpl
Definition
BraggScattererFactory.h:53
Mantid::Kernel::DynamicFactory
The dynamic factory is a base dynamic factory for serving up objects in response to requests from oth...
Definition
DynamicFactory.h:47
Mantid::Kernel::SingletonHolder
Manage the lifetime of a class intended to be a singleton.
Definition
SingletonHolder.h:41
Mantid::Geometry::BraggScatterer_sptr
std::shared_ptr< BraggScatterer > BraggScatterer_sptr
Definition
BraggScatterer.h:25
Mantid::Geometry::BraggScattererFactory
Mantid::Kernel::SingletonHolder< BraggScattererFactoryImpl > BraggScattererFactory
Definition
BraggScattererFactory.h:71
Mantid
Helper class which provides the Collimation Length for SANS instruments.
Definition
AbsorptionCorrection.h:18
Mantid::Kernel::CreateUsingNew
Policy class controlling creation of the singleton Implementation classes should mark their default c...
Definition
SingletonHolder.h:67
Generated by
1.9.8