Debian Codegraph @

src/atlas/domain/detail/DomainFactory.cc

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
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 #include <string>
12
13 #include "atlas/domain/detail/Domain.h"
14 #include "atlas/domain/detail/DomainFactory.h"
15 #include "atlas/domain/detail/EmptyDomain.h"
16 #include "atlas/domain/detail/GlobalDomain.h"
17 #include "atlas/domain/detail/RectangularDomain.h"
18 #include "atlas/domain/detail/ZonalBandDomain.h"
19
20 namespace atlas {
21 namespace domain {
22
23 //----------------------------------------------------------------------------------------------------------------------
24
25 namespace {
26 void force_link() {
27 static struct Link {
28 Link() {
29 DomainBuilder<GlobalDomain>();
30 DomainBuilder<EmptyDomain>();
31 DomainBuilder<RectangularDomain>();
32 DomainBuilder<ZonalBandDomain>();
33 }
34 } link;
35 }
36 } // namespace
37
38 //----------------------------------------------------------------------------------------------------------------------
39
40 const Domain* DomainFactory::build(const std::string& builder) {
41 return build(builder, util::NoConfig());
42 }
43
44 const Domain* DomainFactory::build(const std::string& builder, const eckit::Parametrisation& param) {
45 force_link();
46 auto factory = get(builder);
47 return factory->make(param);
48 }
49
50 //----------------------------------------------------------------------------------------------------------------------
51
52 } // namespace domain
53 } // namespace atlas