Debian Codegraph @

src/atlas/grid/detail/tiles/TilesFactory.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 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #pragma once
12
13 #include <string>
14
15 #include "atlas/util/Config.h"
16 #include "atlas/util/Factory.h"
17
18 namespace atlas {
19 namespace grid {
20 namespace detail {
21
22 class CubedSphereTiles;
23
24 //----------------------------------------------------------------------------------------------------------------------
25
26 class CubedSphereTilesFactory : public util::Factory<CubedSphereTilesFactory> {
27 public:
28 static std::string className() { return "CubedSphereTilesFactory"; }
29 static const CubedSphereTiles* build(const std::string&);
30 static const CubedSphereTiles* build(const std::string&, const eckit::Parametrisation&);
31 using Factory::Factory;
32
33 private:
34 virtual const CubedSphereTiles* make(const eckit::Parametrisation&) = 0;
35 };
36
37 //----------------------------------------------------------------------------------------------------------------------
38
39 template <class T>
40 class CubedSphereTilesBuilder : public CubedSphereTilesFactory {
41 private:
42 virtual const CubedSphereTiles* make(const eckit::Parametrisation& param) { return new T(param); }
43
44 public:
45 using CubedSphereTilesFactory::CubedSphereTilesFactory;
46 };
47
48 //----------------------------------------------------------------------------------------------------------------------
49
50 } // namespace detail
51 } // namespace grid
52 } // namespace atlas