| 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 |
*/ |
| 7 |
|
| 8 |
#include <string> |
| 9 |
|
| 10 |
#include "atlas/redistribution/detail/RedistributeGeneric.h" |
| 11 |
#include "atlas/redistribution/detail/RedistributeStructuredColumns.h" |
| 12 |
#include "atlas/redistribution/detail/RedistributionImpl.h" |
| 13 |
#include "atlas/redistribution/detail/RedistributionImplFactory.h" |
| 14 |
|
| 15 |
namespace atlas { |
| 16 |
namespace redistribution { |
| 17 |
namespace detail { |
| 18 |
|
| 19 |
//---------------------------------------------------------------------------------------------------------------------- |
| 20 |
|
| 21 |
void force_link() { |
| 22 |
static struct Link { |
| 23 |
Link() { |
| 24 |
RedistributionImplBuilder<redistribution::detail::RedistributeGeneric>(); |
| 25 |
RedistributionImplBuilder<redistribution::detail::RedistributeStructuredColumns>(); |
| 26 |
} |
| 27 |
} link; |
| 28 |
} |
| 29 |
|
| 30 |
//---------------------------------------------------------------------------------------------------------------------- |
| 31 |
|
| 32 |
redistribution::detail::RedistributionImpl* RedistributionImplFactory::build(const std::string& builder) { |
| 33 |
force_link(); |
| 34 |
auto factory = get(builder); |
| 35 |
return factory->make(); |
| 36 |
} |
| 37 |
|
| 38 |
//---------------------------------------------------------------------------------------------------------------------- |
| 39 |
|
| 40 |
} // namespace detail |
| 41 |
} // namespace redistribution |
| 42 |
} // namespace atlas |