Debian Codegraph @

src/atlas/redistribution/detail/RedistributionImplFactory.h

raw
1 /*
2 * (C) Crown Copyright 2021 Met Office
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 */
7
8 #pragma once
9
10 #pragma once
11
12 #include <string>
13
14 #include "atlas/util/Config.h"
15 #include "atlas/util/Factory.h"
16
17 namespace atlas {
18 namespace redistribution {
19 namespace detail {
20
21 class RedistributionImpl;
22
23 //----------------------------------------------------------------------------------------------------------------------
24
25 class RedistributionImplFactory : public util::Factory<RedistributionImplFactory> {
26 public:
27 static std::string className() { return "RedistributionFactory"; }
28 static RedistributionImpl* build(const std::string&);
29 using Factory::Factory;
30
31 private:
32 virtual RedistributionImpl* make() = 0;
33 };
34
35 //----------------------------------------------------------------------------------------------------------------------
36
37 template <class T>
38 class RedistributionImplBuilder : public RedistributionImplFactory {
39 private:
40 virtual RedistributionImpl* make() { return new T(); }
41
42 public:
43 using RedistributionImplFactory::RedistributionImplFactory;
44 };
45
46 //----------------------------------------------------------------------------------------------------------------------
47
48 } // namespace detail
49 } // namespace redistribution
50 } // namespace atlas