ASPECT
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
aspect::internal::Plugins::PluginList< InterfaceClass > Struct Template Reference

Public Types

typedef std::tuple< std::string, std::string, void(*)(ParameterHandler &), InterfaceClass *(*)()> PluginInfo
 

Public Member Functions

 ~PluginList ()
 
 DeclException1 (ExcUnknownPlugin, std::string,<< "Can't create a plugin of name <"<< arg1<< "> because such a plugin hasn't been declared.")
 

Static Public Member Functions

static void register_plugin (const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), InterfaceClass *(*factory_function)())
 
static std::string get_pattern_of_names ()
 
static std::string get_description_string ()
 
static void declare_parameters (ParameterHandler &prm)
 
static InterfaceClass * create_plugin (const std::string &name, const std::string &documentation)
 
static InterfaceClass * create_plugin (const std::string &name, const std::string &documentation, ParameterHandler &prm)
 
static void write_plugin_graph (const std::string &plugin_system_name, std::ostream &output_stream, const std::string &attachment_point="Simulator")
 

Static Public Attributes

static std::list< PluginInfo > * plugins
 

Detailed Description

template<typename InterfaceClass>
struct aspect::internal::Plugins::PluginList< InterfaceClass >

A class that stores a list of registered plugins for the given interface type.

Definition at line 155 of file plugins.h.

Member Typedef Documentation

§ PluginInfo

template<typename InterfaceClass >
typedef std::tuple<std::string, std::string, void ( *) (ParameterHandler &), InterfaceClass *( *) ()> aspect::internal::Plugins::PluginList< InterfaceClass >::PluginInfo

A type describing everything we need to know about a plugin.

The entries in the tuple are: - The name by which it can be selected. - A description of this plugin that will show up in the documentation in the parameter file. - A function that can declare the run-time parameters this plugin takes from the parameter file.

  • A function that can produce objects of this plugin type.

Definition at line 171 of file plugins.h.

Constructor & Destructor Documentation

§ ~PluginList()

template<typename InterfaceClass >
aspect::internal::Plugins::PluginList< InterfaceClass >::~PluginList ( )

Destructor.

Definition at line 300 of file plugins.h.

Member Function Documentation

§ register_plugin()

template<typename InterfaceClass >
void aspect::internal::Plugins::PluginList< InterfaceClass >::register_plugin ( const std::string &  name,
const std::string &  description,
void(*)(ParameterHandler &)  declare_parameters_function,
InterfaceClass *(*)()  factory_function 
)
static

Register a plugin by name, description, parameter declaration function, and factory function. See the discussion for the PluginInfo type above for more information on their meaning.

Definition at line 314 of file plugins.h.

References Assert, and ExcMessage().

§ get_pattern_of_names()

template<typename InterfaceClass >
std::string aspect::internal::Plugins::PluginList< InterfaceClass >::get_pattern_of_names ( )
static

Generate a list of names of the registered plugins separated by '|' so that they can be taken as the input for Patterns::Selection.

To make it easier to visually scan through the list of plugins, names are sorted alphabetically.

Definition at line 346 of file plugins.h.

References Assert, and ExcMessage().

§ get_description_string()

template<typename InterfaceClass >
std::string aspect::internal::Plugins::PluginList< InterfaceClass >::get_description_string ( )
static

Return a string that describes all registered plugins using the descriptions that have been provided at the time of registration.

To make it easier to visually scan through the list of plugins, names are sorted alphabetically.

Definition at line 378 of file plugins.h.

References aspect::AdiabaticConditions::declare_parameters().

§ declare_parameters()

template<typename InterfaceClass >
void aspect::internal::Plugins::PluginList< InterfaceClass >::declare_parameters ( ParameterHandler prm)
static

Let all registered plugins define their parameters.

Definition at line 423 of file plugins.h.

References Assert, and ExcMessage().

§ create_plugin() [1/2]

template<typename InterfaceClass >
InterfaceClass * aspect::internal::Plugins::PluginList< InterfaceClass >::create_plugin ( const std::string &  name,
const std::string &  documentation 
)
static

Given the name of one plugin, create a corresponding object and return a pointer to it. The second argument provides a hint where this function was called from, to be printed in case there is an error.

Ownership of the object is handed over to the caller of this function.

Definition at line 439 of file plugins.h.

References Assert, AssertThrow, and ExcMessage().

§ create_plugin() [2/2]

template<typename InterfaceClass >
InterfaceClass * aspect::internal::Plugins::PluginList< InterfaceClass >::create_plugin ( const std::string &  name,
const std::string &  documentation,
ParameterHandler prm 
)
static

Given the name of one plugin, create a corresponding object and return a pointer to it. The second argument provides a hint where this function was called from, to be printed in case there is an error. Before returning, let the newly created object read its run- time parameters from the parameter object.

Ownership of the object is handed over to the caller of this function.

Definition at line 479 of file plugins.h.

References aspect::AdiabaticConditions::write_plugin_graph().

§ write_plugin_graph()

template<typename InterfaceClass >
void aspect::internal::Plugins::PluginList< InterfaceClass >::write_plugin_graph ( const std::string &  plugin_system_name,
std::ostream &  output_stream,
const std::string &  attachment_point = "Simulator" 
)
static

For the current plugin subsystem, write a connection graph of all of the plugins we know about, in the format that the programs dot and neato understand. This allows for a visualization of how all of the plugins that ASPECT knows about are interconnected, and connect to other parts of the ASPECT code.

Parameters
plugin_system_nameThe name to be used for the current plugin system. This name will be used for the "Interface" class to which all plugins connect.
output_streamThe stream to write the output to.
attachment_pointThe point to which a plugin subsystem feeds information. By default, this is the Simulator class, but some plugin systems (most notably the visualization postprocessors, which feeds to one of the postprocessor classes) hook into other places. If other than the "Simulator" default, the attachment point should be of the form typeid(ClassName).name() as this is the form used by this function to identify nodes in the plugin graph.

Definition at line 493 of file plugins.h.

References Assert, Utilities::break_text_into_lines(), and ExcInternalError().

§ DeclException1()

template<typename InterfaceClass >
aspect::internal::Plugins::PluginList< InterfaceClass >::DeclException1 ( ExcUnknownPlugin  ,
std::string   
)

Exception.

Member Data Documentation

§ plugins

template<typename InterfaceClass >
std::list<PluginInfo>* aspect::internal::Plugins::PluginList< InterfaceClass >::plugins
static

A pointer to a list of all registered plugins.

The object is a pointer rather than an object for the following reason: objects with static initializers (such as =0) are initialized before any objects for which one needs to run constructors. consequently, we can be sure that this pointer is set to zero before we ever try to register a postprocessor, and consequently whenever we run Manager::register_postprocessor, we need not worry whether we try to add something to this list before the lists's constructor has successfully run

Definition at line 185 of file plugins.h.


The documentation for this struct was generated from the following file: