| 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 |
// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end |
| 12 |
|
| 13 |
#include "atlas/field/MultiFieldCreator.h" |
| 14 |
|
| 15 |
#include <map> |
| 16 |
#include <sstream> |
| 17 |
|
| 18 |
#include "eckit/thread/AutoLock.h" |
| 19 |
#include "eckit/thread/Mutex.h" |
| 20 |
|
| 21 |
#include "atlas/field/MultiFieldCreatorIFS.h" |
| 22 |
#include "atlas/field/MultiFieldCreatorArray.h" |
| 23 |
#include "atlas/grid/Grid.h" |
| 24 |
#include "atlas/runtime/Exception.h" |
| 25 |
#include "atlas/runtime/Log.h" |
| 26 |
|
| 27 |
|
| 28 |
namespace atlas { |
| 29 |
namespace field { |
| 30 |
|
| 31 |
|
| 32 |
namespace { |
| 33 |
|
| 34 |
void force_link() { |
| 35 |
static struct Link { |
| 36 |
Link() { |
| 37 |
MultiFieldCreatorBuilder<MultiFieldCreatorIFS>(); |
| 38 |
MultiFieldCreatorBuilder<MultiFieldCreatorArray>(); |
| 39 |
} |
| 40 |
} link; |
| 41 |
} |
| 42 |
|
| 43 |
} // namespace |
| 44 |
|
| 45 |
// ------------------------------------------------------------------ |
| 46 |
|
| 47 |
MultiFieldCreator::MultiFieldCreator() = default; |
| 48 |
|
| 49 |
MultiFieldCreator::~MultiFieldCreator() = default; |
| 50 |
|
| 51 |
MultiFieldCreator* MultiFieldCreatorFactory::build(const std::string& builder, const eckit::Configuration& config) { |
| 52 |
force_link(); |
| 53 |
auto factory = get(builder); |
| 54 |
return factory->make(config); |
| 55 |
} |
| 56 |
|
| 57 |
} // namespace field |
| 58 |
} // namespace atlas |