OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
pfc::ui::FieldModifierRegistry Class Reference

A registry for field modifiers used in the application. More...

#include <field_modifier_registry.hpp>

Public Types

using CreatorFunction = std::function< FieldModifier_p(const json &)>
 

Public Member Functions

void register_modifier (const std::string &type, CreatorFunction creator)
 Register a field modifier with its creator function.
 
FieldModifier_p create_modifier (const std::string &type, const json &data)
 Create an instance of a field modifier based on its registered type.
 

Static Public Member Functions

static FieldModifierRegistryget_instance ()
 Get the singleton instance of the FieldModifierRegistry.
 

Detailed Description

A registry for field modifiers used in the application.

The FieldModifierRegistry class provides a centralized registry for field modifiers. It allows registration of field modifiers along with their corresponding creator functions, and provides a way to create instances of field modifiers based on their registered types.

Member Function Documentation

◆ create_modifier()

FieldModifier_p pfc::ui::FieldModifierRegistry::create_modifier ( const std::string &  type,
const json &  data 
)
inline

Create an instance of a field modifier based on its registered type.

Parameters
typeThe type string of the field modifier to create.
dataA json object defining the field modifier parameters.
Returns
Pointer to the created field modifier instance.
Exceptions
std::invalid_argumentif the specified type is not registered.
Here is the call graph for this function:

◆ get_instance()

static FieldModifierRegistry & pfc::ui::FieldModifierRegistry::get_instance ( )
inlinestatic

Get the singleton instance of the FieldModifierRegistry.

Returns
Reference to the singleton instance of FieldModifierRegistry.
Here is the caller graph for this function:

◆ register_modifier()

void pfc::ui::FieldModifierRegistry::register_modifier ( const std::string &  type,
CreatorFunction  creator 
)
inline

Register a field modifier with its creator function.

Parameters
typeThe type string associated with the field modifier.
creatorThe creator function that creates an instance of the field modifier.

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