26#ifndef DUMUX_PROPERTY_SYSTEM_HH
27#define DUMUX_PROPERTY_SYSTEM_HH
45->
decltype(std::integral_constant<bool, !std::is_same_v<typename P::type, UndefinedProperty>>{})
55->
decltype(std::declval<typename T::InheritsFrom>(), std::true_type{})
64template<
class ...Tuples>
65using ConCatTuples =
decltype(std::tuple_cat(std::declval<Tuples>()...));
68template<
class TypeTag,
template<
class,
class>
class Property,
class TTagList>
72template<
class TypeTag,
template<
class,
class>
class Property,
class TTagList,
class Enable>
75template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
76struct GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>, std::enable_if_t<hasParentTypeTag<LastTypeTag>(int{}), void>>
79template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
80struct GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>, std::enable_if_t<!hasParentTypeTag<LastTypeTag>(int{}), void>>
83template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
84struct GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<hasParentTypeTag<FirstTypeTag>(int{}), void>>
87template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
88struct GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<!hasParentTypeTag<FirstTypeTag>(int{}), void>>
89{
using type =
typename GetDefined<TypeTag, Property, std::tuple<Args...>>::type; };
91template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
92struct GetDefined<TypeTag, Property, std::tuple<LastTypeTag>>
100#pragma clang diagnostic push
101#pragma clang diagnostic ignored "-Wdeprecated-declarations"
105#pragma clang diagnostic pop
107 using type = std::conditional_t<isDefinedProperty<LastType>(
int{}), LastType,
108 typename GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>,
void>::type>;
111template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
112struct GetDefined<TypeTag, Property, std::tuple<FirstTypeTag, Args...>>
116#pragma clang diagnostic push
117#pragma clang diagnostic ignored "-Wdeprecated-declarations"
121#pragma clang diagnostic pop
123 using type = std::conditional_t<isDefinedProperty<FirstType>(
int{}), FirstType,
124 typename GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>,
void>::type>;
128template<
class TypeTag,
template<
class,
class>
class Property>
132 static_assert(!std::is_same<type, UndefinedProperty>::value,
"Property is undefined!");
140template<
class TypeTag,
template<
class,
class>
class Property>
145#pragma clang diagnostic push
146#pragma clang diagnostic ignored "-Wdeprecated-declarations"
149template<
class TypeTag,
template<
class,
class>
class Property>
153template<
class TypeTag,
template<
class,
class>
class Property>
156#pragma clang diagnostic pop
constexpr auto getPropValue()
get the value data member of a property
Definition: propertysystem.hh:154
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property
Definition: propertysystem.hh:141
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Definition: common/properties.hh:37
implementation details for template meta programming
Definition: propertysystem.hh:40
decltype(std::tuple_cat(std::declval< Tuples >()...)) ConCatTuples
helper alias to concatenate multiple tuples
Definition: propertysystem.hh:65
constexpr auto isDefinedProperty(int) -> decltype(std::integral_constant< bool, !std::is_same_v< typename P::type, UndefinedProperty > >{})
check if a property P is defined
Definition: propertysystem.hh:44
constexpr auto hasParentTypeTag(int) -> decltype(std::declval< typename T::InheritsFrom >(), std::true_type{})
check if a TypeTag inherits from other TypeTags
Definition: propertysystem.hh:54
a tag to mark properties as undefined
Definition: propertysystem.hh:35
helper struct to get the first property that is defined in the TypeTag hierarchy
Definition: propertysystem.hh:69
helper struct to iteratre over the TypeTag hierarchy
Definition: propertysystem.hh:73
typename GetDefined< TypeTag, Property, typename LastTypeTag::InheritsFrom >::type type
Definition: propertysystem.hh:77
typename GetDefined< TypeTag, Property, ConCatTuples< typename FirstTypeTag::InheritsFrom, std::tuple< Args... > > >::type type
Definition: propertysystem.hh:85
typename GetDefined< TypeTag, Property, std::tuple< Args... > >::type type
Definition: propertysystem.hh:89
std::conditional_t< isDefinedProperty< LastType >(int{}), LastType, typename GetNextTypeTag< TypeTag, Property, std::tuple< LastTypeTag >, void >::type > type
Definition: propertysystem.hh:108
Property< TypeTag, LastTypeTag > LastType
Definition: propertysystem.hh:103
std::conditional_t< isDefinedProperty< FirstType >(int{}), FirstType, typename GetNextTypeTag< TypeTag, Property, std::tuple< FirstTypeTag, Args... >, void >::type > type
Definition: propertysystem.hh:124
Property< TypeTag, FirstTypeTag > FirstType
Definition: propertysystem.hh:119
helper struct to extract get the Property specilization given a TypeTag, asserts that the property is...
Definition: propertysystem.hh:130
typename Detail::GetDefined< TypeTag, Property, std::tuple< TypeTag > >::type type
Definition: propertysystem.hh:131