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::span< const boost::string_ref > | 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 |
boost::string_ref | 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. | |
auto | get_valid_parameters () const |
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) | |
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 93 of file AutoParameters.hpp.
|
protecteddefault |
|
inlineexplicitprotected |
Definition at line 111 of file AutoParameters.hpp.
References ScriptInterface::AutoParameters< Derived, Base >::add_parameters(), and params.
|
inlineprotected |
Definition at line 115 of file AutoParameters.hpp.
References params.
Referenced by ScriptInterface::AutoParameters< Derived, Base >::AutoParameters(), ScriptInterface::Thermostat::Brownian::Brownian(), ScriptInterface::Coulomb::CoulombMMM1D::CoulombMMM1D(), ScriptInterface::Coulomb::CoulombP3M< Architecture >::CoulombP3M(), ScriptInterface::Coulomb::CoulombScafacos::CoulombScafacos(), ScriptInterface::Coulomb::DebyeHueckel::DebyeHueckel(), ScriptInterface::Dipoles::DipolarDirectSum::DipolarDirectSum(), ScriptInterface::Dipoles::DipolarLayerCorrection::DipolarLayerCorrection(), ScriptInterface::Dipoles::DipolarP3M< Architecture >::DipolarP3M(), ScriptInterface::Dipoles::DipolarScafacos::DipolarScafacos(), ScriptInterface::walberla::EKSpecies::EKSpecies(), ScriptInterface::Coulomb::ElectrostaticLayerCorrection::ElectrostaticLayerCorrection(), ScriptInterface::Interactions::InteractionBMHTF::InteractionBMHTF(), ScriptInterface::Interactions::InteractionBuckingham::InteractionBuckingham(), ScriptInterface::Interactions::InteractionDPD::InteractionDPD(), ScriptInterface::Interactions::InteractionGaussian::InteractionGaussian(), ScriptInterface::Interactions::InteractionGayBerne::InteractionGayBerne(), ScriptInterface::Interactions::InteractionHat::InteractionHat(), ScriptInterface::Interactions::InteractionHertzian::InteractionHertzian(), ScriptInterface::Interactions::InteractionLJ::InteractionLJ(), ScriptInterface::Interactions::InteractionLJcos::InteractionLJcos(), ScriptInterface::Interactions::InteractionLJcos2::InteractionLJcos2(), ScriptInterface::Interactions::InteractionLJGen::InteractionLJGen(), ScriptInterface::Interactions::InteractionMorse::InteractionMorse(), ScriptInterface::Interactions::InteractionSmoothStep::InteractionSmoothStep(), ScriptInterface::Interactions::InteractionSoftSphere::InteractionSoftSphere(), ScriptInterface::Interactions::InteractionTabulated::InteractionTabulated(), ScriptInterface::Interactions::InteractionThole::InteractionThole(), ScriptInterface::Interactions::InteractionWCA::InteractionWCA(), ScriptInterface::Thermostat::IsotropicNpt::IsotropicNpt(), ScriptInterface::Thermostat::Langevin::Langevin(), ScriptInterface::walberla::LBFluid::LBFluid(), ScriptInterface::Thermostat::LBThermostat::LBThermostat(), and ScriptInterface::Coulomb::ReactionField::ReactionField().
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 152 of file AutoParameters.hpp.
References ScriptInterface::ObjectHandle::name().
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 144 of file AutoParameters.hpp.
References ScriptInterface::ObjectHandle::name().
|
inlineprotected |
Definition at line 129 of file AutoParameters.hpp.
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 163 of file AutoParameters.hpp.
References ScriptInterface::ObjectHandle::get_parameters(), and params.
|
inlinefinalvirtual |
Reimplemented from ScriptInterface::ObjectHandle.
Definition at line 133 of file AutoParameters.hpp.