Debian Codegraph @

src/atlas/grid/SpecRegistry.h

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 #pragma once
12
13 #include "atlas/util/Config.h"
14 #include "atlas/util/Registry.h"
15
16 namespace atlas {
17 namespace grid {
18
19 using Spec = util::Config;
20
21 class SpecRegistry {
22 public:
23 static void add(const std::string& id, Spec&& spec) { registry().add(id, std::move(spec)); }
24
25 static bool has(const std::string& id) { return registry().has(id); }
26
27 static Spec get(const std::string& id) { return registry().get(id); }
28
29 static void list(std::ostream& out) { return registry().list(out); }
30
31 static std::vector<std::string> keys() { return registry().keys(); }
32
33 private:
34 static util::Registry<Spec>& registry();
35 };
36
37 //---------------------------------------------------------------------------------------------------------------------
38
39 } // namespace grid
40 } // namespace atlas