![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Bind parameters in the script interface. More...
#include <AutoParameters.hpp>
Classes | |
| struct | UnknownParameter |
| Exception thrown when accessing an unknown parameter. More... | |
| struct | WriteError |
| Exception thrown when writing to a read-only parameter. More... | |
Public Member Functions | |
| std::vector< std::string_view > | valid_parameters () const final |
| Variant | get_parameter (const std::string &name) const final |
| void | do_set_parameter (const std::string &name, const Variant &value) final |
| std::vector< std::pair< std::string, Variant > > | serialize_parameters () const final |
| Public Member Functions inherited from ScriptInterface::ObjectHandle | |
| ObjectHandle ()=default | |
| ObjectHandle (ObjectHandle const &)=delete | |
| ObjectHandle & | operator= (ObjectHandle const &)=delete |
| virtual | ~ObjectHandle ()=default |
| std::string_view | name () const |
| Context * | context () const |
| Responsible context. | |
| void | construct (VariantMap const ¶ms) |
| Construct the handled object. | |
| virtual void | do_construct (VariantMap const ¶ms) |
| VariantMap | get_parameters () const |
| Get current parameters. | |
| void | set_parameter (const std::string &name, const Variant &value) |
| Set single parameter. | |
| Variant | call_method (const std::string &name, const VariantMap ¶ms) |
| Call a method on the object. | |
| virtual Variant | do_call_method (const std::string &, const VariantMap &) |
Local implementation of call_method. | |
| std::string | serialize () const |
Protected Member Functions | |
| AutoParameters ()=default | |
| AutoParameters (std::vector< AutoParameter > &¶ms) | |
| ~AutoParameters () override=default | |
| bool | has_parameter (std::string const &name) const override |
| void | add_parameters (std::vector< AutoParameter > &¶ms) |
| auto const & | get_parameter_insertion_order () const |
Additional Inherited Members | |
| Static Public Member Functions inherited from ScriptInterface::ObjectHandle | |
| static ObjectRef | deserialize (const std::string &state, Context &ctx) |
| Make object from serialized state. | |
Bind parameters in the script interface.
This class implements ScriptInterfaceBase, binding the parameters added by add_parameters or by the constructor. To use it, derive from this class and add parameters. For example, given a class A
that should have i exposed, this can be achieved by extending it like this:
If there is more complicated logic needed, specific setters and getters can be provided. E.g. given a class B like
we can use a lambdas to set and get the parameter like this:
(this has to be captured in the lambdas to have access to the member functions of the class).
Definition at line 94 of file AutoParameters.hpp.
|
protecteddefault |
|
inlineexplicitprotected |
Definition at line 114 of file AutoParameters.hpp.
|
overrideprotecteddefault |
|
inlineprotected |
Definition at line 123 of file AutoParameters.hpp.
Referenced by ScriptInterface::AutoParameters< InteractionPotentialInterface< CoreIA > >::AutoParameters(), ScriptInterface::Coulomb::CoulombP3M::CoulombP3M(), ScriptInterface::Dipoles::DipolarP3M< Architecture >::DipolarP3M(), ScriptInterface::walberla::EKSpecies::EKSpecies(), and ScriptInterface::walberla::LBFluid::LBFluid().
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Reimplemented in ScriptInterface::Thermostat::Interface< CoreClass >, ScriptInterface::Thermostat::Interface<::BrownianThermostat >, ScriptInterface::Thermostat::Interface<::DPDThermostat >, ScriptInterface::Thermostat::Interface<::IsotropicNptThermostat >, ScriptInterface::Thermostat::Interface<::LangevinThermostat >, ScriptInterface::Thermostat::Interface<::LBThermostat >, ScriptInterface::Thermostat::Interface<::StokesianThermostat >, and ScriptInterface::Thermostat::Interface<::ThermalizedBondThermostat >.
Definition at line 154 of file AutoParameters.hpp.
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Reimplemented in ScriptInterface::Thermostat::Interface< CoreClass >, ScriptInterface::Thermostat::Interface<::BrownianThermostat >, ScriptInterface::Thermostat::Interface<::DPDThermostat >, ScriptInterface::Thermostat::Interface<::IsotropicNptThermostat >, ScriptInterface::Thermostat::Interface<::LangevinThermostat >, ScriptInterface::Thermostat::Interface<::LBThermostat >, ScriptInterface::Thermostat::Interface<::StokesianThermostat >, and ScriptInterface::Thermostat::Interface<::ThermalizedBondThermostat >.
Definition at line 146 of file AutoParameters.hpp.
|
inlineprotected |
Definition at line 137 of file AutoParameters.hpp.
|
inlineoverrideprotectedvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 119 of file AutoParameters.hpp.
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 165 of file AutoParameters.hpp.
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Reimplemented in ScriptInterface::Interactions::InteractionPotentialInterface< CoreIA >, ScriptInterface::Interactions::InteractionPotentialInterface<::BMHTF_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::Buckingham_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::DPD_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::Gaussian_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::GayBerne_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::Hat_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::Hertzian_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::LJ_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::LJcos2_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::LJcos_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::LJGen_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::Morse_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::SmoothStep_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::SoftSphere_Parameters >, ScriptInterface::Interactions::InteractionPotentialInterface<::TabulatedPotential >, ScriptInterface::Interactions::InteractionPotentialInterface<::Thole_Parameters >, and ScriptInterface::Interactions::InteractionPotentialInterface<::WCA_Parameters >.
Definition at line 141 of file AutoParameters.hpp.