KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
|
Template magic to check named parameters passed to wrappers at compile time. More...
#include <tuple>
#include <type_traits>
#include "kamping/named_parameter_selection.hpp"
#include "kamping/named_parameter_types.hpp"
#include "kamping/serialization.hpp"
Go to the source code of this file.
Classes | |
struct | kamping::internal::has_no_unused_parameters< RequiredParametersTuple, OptionalParametersTuple, Args > |
Struct wrapping a check that verifies that no unused parameters are part of the arguments. More... | |
struct | kamping::internal::all_unique< Tuple > |
Base wrapper (std::integral_constant ) to test if all types of a tuple are unique. More... | |
struct | kamping::internal::all_unique< std::tuple< T, Ts... > > |
Recursive wrapper (std::integral_constant ) to test if all types of a tuple are unique. This is done by checking for each type whether the type occurs in the types of the tuple to the right. If this is true for any type/position, the types in the tuple are not unique. More... | |
struct | kamping::internal::parameter_type_to_integral_constant< T > |
Wrapper to get an std::integral_constant for a kamping::internal::ParameterType. More... | |
struct | kamping::internal::parameter_types_to_integral_constants< ParameterTypes > |
Wrapper to get a tuple of std::integral_constant for each kamping::internal::ParameterType passed as template parameter that are extracted as tuple of std::integral_constant . More... | |
struct | kamping::internal::parameters_to_integral_constant< Parameters > |
Wrapper to get a tuple of std::integral_constant for each kamping::internal::ParameterType of the parameters. More... | |
Namespaces | |
namespace | kamping::internal |
Internal namespace marking the code that is not user-facing. | |
Macros | |
#define | KAMPING_REQUIRED_PARAMETERS(...) , ##__VA_ARGS__ |
Wrapper to pass (possibly empty) list of parameter type names as required parameters to KAMPING_CHECK_PARAMETERS . Note that this macro only takes the name of parameter types, i.e., instead of using kamping::internal::ParameterType::send_buf , only pass send_buf to this macro. | |
#define | KAMPING_OPTIONAL_PARAMETERS(...) , ##__VA_ARGS__ |
Wrapper to pass (possibly empty) list of parameter type names as optional parameters to KAMPING_CHECK_PARAMETERS . Note that this macro only takes the name of parameter types, i.e., instead of using kamping::internal::ParameterType::send_buf , only pass send_buf to this macro. | |
#define | KAMPING_CHECK_PARAMETERS(args, required, optional) |
Assertion macro that checks if passed parameters are correct, i.e., all parameter types are unique, all required parameters are provided, and no unused parameter is passed. Also checks that all parameter types are r-value references. | |
Variables | |
template<typename Tuple > | |
static constexpr bool | kamping::internal::all_unique_v = all_unique<Tuple>::value |
true if and only if all types of the tuple are unique. | |
template<ParameterType parameter_type, typename... Args> | |
static constexpr bool | kamping::internal::is_parameter_given_as_in_buffer |
Checks if a data buffer with requested parameter type exists and it is an input parameter (i.e. its content does not have to be computed/deduced by KaMPIng). | |
template<typename BufferType > | |
static constexpr bool | kamping::internal::has_to_be_computed |
Checks if the buffer has to be computed by kamping, i.e. if it is an output parameter or the buffer has been allocated by KaMPIng. | |
template<typename... BufferTypes> | |
static constexpr bool | kamping::internal::all_have_to_be_computed = (has_to_be_computed<BufferTypes> && ...) |
Checks if all buffers have to be computed by kamping, i.e., if all buffers are output parameters of the buffers have been allocated by kamping. | |
template<typename... BufferTypes> | |
static constexpr bool | kamping::internal::any_has_to_be_computed = (has_to_be_computed<BufferTypes> || ...) |
Checks if any of the buffers have to be computed by kamping, i.e., if at least one buffer is an output parameter or has been allocated by kamping. | |
template<typename DataBufferType > | |
static constexpr bool | kamping::internal::buffer_uses_serialization |
Checks if DataBufferType is a serialization buffer. | |
Template magic to check named parameters passed to wrappers at compile time.
#define KAMPING_CHECK_PARAMETERS | ( | args, | |
required, | |||
optional ) |
Assertion macro that checks if passed parameters are correct, i.e., all parameter types are unique, all required parameters are provided, and no unused parameter is passed. Also checks that all parameter types are r-value references.
The macro only expects the parameter type, i.e., a member name of the kamping::internal::ParameterType
enum without the name of the enum. For instance,
checks that the parameter pack Args
contains members of type kamping::internal::ParameterType::send_buf
and type kamping::internal::ParameterType::recv_buf
.
Note that expanding the macro into a do { ... } while(false)
pseudo-loop is a common trick to make a macro "act like a statement". Otherwise, it would have surprising effects if the macro is used inside a if
branch without braces.
args | A parameter pack with all parameter types passed to the function. Note that this is only the name of the parameter pack without trailing ... . |
required | A list of required parameter type names wrapped in a KAMPING_REQUIRED_PARAMETERS macro. |
optional | A list of optional parameter type names wrapped in a KAMPING_OPTIONAL_PARAMETERS macro. |