26#ifndef OPM_PROPERTY_SYSTEM_HH
27#define OPM_PROPERTY_SYSTEM_HH
29#include <dune/common/classname.hh>
40template <
class TypeTag,
class MyTypeTag>
43 using type = std::tuple<>;
52->
decltype(std::integral_constant<bool, !std::is_same<typename P::type, UndefinedProperty>::value>{})
62->
decltype(std::declval<typename T::InheritsFrom>(), std::true_type{})
70template<
class ...Tuples>
71using ConCatTuples =
decltype(std::tuple_cat(std::declval<Tuples>()...));
82struct GetNextTypeTag<TypeTag,
Property, std::tuple<LastTypeTag>, std::enable_if_t<hasParentTypeTag<LastTypeTag>(int{}), void>>
86struct GetNextTypeTag<TypeTag,
Property, std::tuple<LastTypeTag>, std::enable_if_t<!hasParentTypeTag<LastTypeTag>(int{}), void>>
90struct GetNextTypeTag<TypeTag,
Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<hasParentTypeTag<FirstTypeTag>(int{}), void>>
94struct GetNextTypeTag<TypeTag,
Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<!hasParentTypeTag<FirstTypeTag>(int{}), void>>
106#pragma clang diagnostic push
107#pragma clang diagnostic ignored "-Wdeprecated-declarations"
111#pragma clang diagnostic pop
113 using type = std::conditional_t<isDefinedProperty<LastType>(
int{}), LastType,
122#pragma clang diagnostic push
123#pragma clang diagnostic ignored "-Wdeprecated-declarations"
127#pragma clang diagnostic pop
129 using type = std::conditional_t<isDefinedProperty<FirstType>(
int{}), FirstType,
135template<
class TypeTag,
class TTagList>
139template<
class TypeTag,
class TTagList,
class Enable>
142template<
class TypeTag,
class LastTypeTag>
143struct GetNextSpliceTypeTag<TypeTag, std::tuple<LastTypeTag>, std::enable_if_t<hasParentTypeTag<LastTypeTag>(int{}), void>>
146template<
class TypeTag,
class LastTypeTag>
147struct GetNextSpliceTypeTag<TypeTag, std::tuple<LastTypeTag>, std::enable_if_t<!hasParentTypeTag<LastTypeTag>(int{}), void>>
148{
using type = std::tuple<>; };
150template<
class TypeTag,
class FirstTypeTag,
class ...Args>
151struct GetNextSpliceTypeTag<TypeTag, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<hasParentTypeTag<FirstTypeTag>(int{}), void>>
154template<
class TypeTag,
class FirstTypeTag,
class ...Args>
155struct GetNextSpliceTypeTag<TypeTag, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<!hasParentTypeTag<FirstTypeTag>(int{}), void>>
161->
decltype(std::integral_constant<bool, !std::is_same<typename S::type, std::tuple<>>::value>{})
168template<
class TypeTag,
class LastTypeTag>
174 std::tuple<LastTypeTag>,
175 typename LastSplice::type
179 using type = std::conditional_t<isDefinedSplice<LastSplice>(
int{}),
184template<
class TypeTag,
class FirstTypeTag,
class ...Args>
191 typename FirstSplice::type
195 using type = std::conditional_t<isDefinedSplice<FirstSplice>(
int{}),
201template<
class TypeTag,
template<
class,
class>
class Property>
209 static_assert(!std::is_same<type, UndefinedProperty>::value,
"Property is undefined!");
212template<
class TypeTag,
class SpliceTypeTag,
template<
class,
class>
class Property>
216 static_assert(!std::is_same<type, std::tuple<>>::value,
"Splice is undefined!");
223template<
class TypeTag,
template<
class,
class>
class Property>
224using GetProp =
typename Properties::Detail::GetPropImpl<TypeTag, Property>::type;
228#pragma clang diagnostic push
229#pragma clang diagnostic ignored "-Wdeprecated-declarations"
232template<
class TypeTag,
template<
class,
class>
class Property>
235template<
class TypeTag,
class SpliceTypeTag,
template<
class,
class>
class Property>
239template<
class TypeTag,
template<
class,
class>
class Property>
243#pragma clang diagnostic pop
constexpr auto hasParentTypeTag(int) -> decltype(std::declval< typename T::InheritsFrom >(), std::true_type{})
check if a TypeTag inherits from other TypeTags
Definition propertysystem.hh:61
constexpr auto isDefinedProperty(int) -> decltype(std::integral_constant< bool, !std::is_same< typename P::type, UndefinedProperty >::value >{})
check if a property P is defined
Definition propertysystem.hh:51
decltype(std::tuple_cat(std::declval< Tuples >()...)) ConCatTuples
helper alias to concatenate multiple tuples
Definition propertysystem.hh:71
constexpr auto isDefinedSplice(int) -> decltype(std::integral_constant< bool, !std::is_same< typename S::type, std::tuple<> >::value >{})
check if a splice S is defined
Definition propertysystem.hh:160
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition propertysystem.hh:224
helper struct to get the first property that is defined in the TypeTag hierarchy
Definition propertysystem.hh:136
helper struct to get the first property that is defined in the TypeTag hierarchy
Definition propertysystem.hh:75
helper struct to iterate over the TypeTag hierarchy
Definition propertysystem.hh:140
helper struct to iterate over the TypeTag hierarchy
Definition propertysystem.hh:79
helper struct to extract get the Property specilization given a TypeTag, asserts that the property is...
Definition propertysystem.hh:203
Definition propertysystem.hh:214
Definition propertysystem.hh:42
a tag to mark properties as undefined
Definition propertysystem.hh:38