-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure MultiField construction (with Willem)
- Loading branch information
Showing
15 changed files
with
760 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* (C) Copyright 2013 ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence Version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation | ||
* nor does it submit to any jurisdiction. | ||
*/ | ||
|
||
// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end | ||
|
||
#include "atlas/field/MultiFieldCreator.h" | ||
|
||
#include <map> | ||
#include <sstream> | ||
#include <string> | ||
|
||
#include "eckit/thread/AutoLock.h" | ||
#include "eckit/thread/Mutex.h" | ||
|
||
#include "atlas/field/MultiField.h" | ||
#include "atlas/field/FieldCreatorArraySpec.h" | ||
#include "atlas/field/MultiFieldCreatorIFS.h" | ||
#include "atlas/grid/Grid.h" | ||
#include "atlas/runtime/Exception.h" | ||
#include "atlas/runtime/Log.h" | ||
|
||
|
||
namespace atlas { | ||
namespace field { | ||
|
||
|
||
namespace { | ||
|
||
void force_link() { | ||
static struct Link { | ||
Link() { | ||
MultiFieldCreatorBuilder<MultiFieldCreatorIFS>(); | ||
} | ||
} link; | ||
} | ||
|
||
} // namespace | ||
|
||
// ------------------------------------------------------------------ | ||
|
||
MultiFieldCreator::MultiFieldCreator() = default; | ||
|
||
MultiFieldCreator::~MultiFieldCreator() = default; | ||
|
||
MultiFieldCreator* MultiFieldCreatorFactory::build(const std::string& builder, const eckit::Configuration& config) { | ||
force_link(); | ||
auto factory = get(builder); | ||
return factory->make(config); | ||
} | ||
|
||
MultiField::MultiField(const eckit::Configuration& config) { | ||
std::string type; | ||
if (!config.get("type", type)) { | ||
ATLAS_THROW_EXCEPTION("Could not find \"type\" in configuration"); | ||
} | ||
std::unique_ptr<MultiFieldCreator> creator(MultiFieldCreatorFactory::build(type, config)); | ||
reset(creator->create(config)); | ||
} | ||
|
||
} // namespace field | ||
} // namespace atlas |
Oops, something went wrong.