template<typename TestType , typename PluginType , typename = typename std::enable_if_t<std::is_base_of<PluginType,TestType>::value>>
bool aspect::Plugins::plugin_type_matches |
( |
const PluginType & |
object | ) |
|
|
inline |
This function returns if a given plugin (e.g. a material model returned from SimulatorAccess::get_material_model() ) matches a certain plugin type (e.g. MaterialModel::Simple). This check is needed, because often it is only possible to get a reference to an Interface, not the actual plugin type, but the actual plugin type might be important. For example a radial gravity model might only be implemented for spherical geometry models, and would want to check if the current geometry is in fact a spherical shell.
This function can only be called with types that correspond to the same plugin system. In other words, the type of the plugin has to either be derived from the type of the object being tested, or they have to both be derived from a common base class. This function is not appropriate to check whether a class TestType
derived from an interface base class is also derived from a second base class PluginType
. For these cases, use a dynamic_cast
.
Definition at line 73 of file plugins.h.