The property system. More...
Collaboration diagram for Properties:
Detailed DescriptionThe property system. The purpose of the eWoms property system is to specify compile-time parameters. It can thus be used to specify types and things which cause the compiler to alter its decisions. Semantically, the property system can be thought of being very similar to the standard C++ "traits" pattern. The advantages of the property system are that it includes build-in introspection capabilities and (more importantly) an easy to use inheritance mechanism. Macro Definition Documentation
Retrieve a property for a type tag. If you use Referenced by parseCommandLineOptions(), printUnused(), printUsage(), and printValues().
Access the This is just for convenience and equivalent to Referenced by Ewoms::Properties::SET_PROP(), and start().
Access the This is just for convenience and equivalent to Referenced by Ewoms::FvBaseAdLocalLinearizer< TypeTag >::baseEpsilon(), Ewoms::FvBaseFdLocalLinearizer< TypeTag >::baseEpsilon(), Ewoms::FvBaseLocalResidual< TypeTag >::evalConstraints_(), Ewoms::VcfvGradientCalculator< TypeTag >::prepare(), Ewoms::PvsModel< TypeTag >::primaryVarWeight(), Ewoms::NcpModel< TypeTag >::primaryVarWeight(), printUsage(), and Ewoms::Properties::SET_PROP().
Syntactic sugar for NEW_TYPE_TAG. See the documentation for NEW_TYPE_TAG.
Value:
namespace PTag { \
struct PTagName; } extern int semicolonHack_
Define a property tag. A property tag is the unique identifier for a property. It may only be declared once in your program. There is also no hierarchy of property tags as for type tags. Examples:
Value:
namespace TTag { \
struct EWOMS_GET_HEAD_(__VA_ARGS__, blubb) \
: public TypeTag<__VA_ARGS__> \
{ }; \
TTAG_INFO_(__VA_ARGS__, void) \
} \
extern int semicolonHack_
Define a new type tag. A type tag can inherit the properties defined on up to five parent type tags. Examples:
Makes a type out of a property tag name. Again property type names can be passed as template argument. This is rarely needed, though.
Value:
SET_PROP_(EffTypeTagName, \
/*kind=*/"bool ", \
PropTagName, \
/*value=*/__VA_ARGS__) \
{ \
typedef bool type; \
static const bool value = __VA_ARGS__; \
}
Set a property to a simple constant boolean value. The constant can be accessed by the
Value:
SET_PROP_(EffTypeTagName, \
/*kind=*/"int ", \
PropTagName, \
/*value=*/__VA_ARGS__) \
{ \
typedef int type; \
static const int value = __VA_ARGS__; \
}
Set a property to a simple constant integer value. The constant can be accessed by the
Value:
template <class TypeTag> \
struct Property<TypeTag, \
PTAG(PropTagName)>; \
PROP_INFO_(EffTypeTagName, \
/*kind=*/"opaque", \
PropTagName, \
/*value=*/"<opaque>") \
template <class TypeTag> \
struct Property<TypeTag, \
PTAG(PropTagName) >
#define PTAG(PropTagName) Makes a type out of a property tag name. Definition: propertysystem.hh:146 Set a property for a specific type tag. After this macro, you must to specify a complete body of a class template, including the trailing semicolon. If you need to retrieve another property within the class body, you can use Example: };
Value:
SET_PROP_(EffTypeTagName, \
/*kind=*/"scalar", \
PropTagName, \
/*value=*/__VA_ARGS__) \
{ \
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
public: \
typedef Scalar type; \
static const Scalar value; \
}; \
template <class TypeTag> \
#define GET_PROP_TYPE(TypeTag, PropTagName) Access the type attribute of a property for a type tag. Definition: propertysystem.hh:485 #define PTAG(PropTagName) Makes a type out of a property tag name. Definition: propertysystem.hh:146 Set a property to a simple constant scalar value. The constant can be accessed by the
Value:
namespace PTag { \
template<> \
struct Splices<TTAG(TypeTagName)> \
{ \
typedef RevertedTuple<__VA_ARGS__>::type tuple; \
}; \
SPLICE_INFO_(TTAG(TypeTagName), __VA_ARGS__) \
} \
extern int semicolonHack_
Define splices for a given type tag. Splices can be seen as children which can be overridden lower in the hierarchy. It can thus be seen as a "deferred inheritance" mechanism. Example:
Value:
SET_PROP_(EffTypeTagName, \
/*kind=*/"string", \
PropTagName, \
/*value=*/__VA_ARGS__) \
{ \
public: \
typedef std::string type; \
static const std::string value; \
}; \
template <class TypeTag> \
const typename Property<TypeTag, TTAG(EffTypeTagName), PTAG(PropTagName)>::type \
Property<TypeTag, TTAG(EffTypeTagName), PTAG(PropTagName)>::value(__VA_ARGS__)
Set a property to a simple constant string value. The constant can be accessed by the
Value:
SET_PROP_(EffTypeTagName, \
/*kind=*/"type ", \
PropTagName, \
/*value=*/__VA_ARGS__) \
{ \
typedef __VA_ARGS__ type; \
}
Set a property which defines a type. The type can be accessed by the
Convert a type tag name to a type. The main advantage of the type of a
Value:
template <> \
PTAG(PropTagName) >; \
PROP_INFO_(EffTypeTagName, \
/*kind=*/"withdraw", \
PropTagName, \
/*value=*/<none>) \
template <> \
PTAG(PropTagName) > \
: public PropertyExplicitlyUnset \
{}
#define PTAG(PropTagName) Makes a type out of a property tag name. Definition: propertysystem.hh:146 Explicitly unset a property for a type tag. This means that the property will not be inherited from the type tag's parents. Example: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||