class mp2p_icp::ParameterSource

Overview

Users of derived classes must declare an instance of this type, then attach instances of derived classes to it, then optionally update variables via updateVariable(), then call realize() for the changes to take effect.

#include <Parameterizable.h>

class ParameterSource
{
public:
    // methods

    void attach(Parameterizable& obj);
    void updateVariable(const std::string& variable, double value);
    void updateVariables(const std::vector<std::pair<std::string, double>>& nameValuePairs);
    void realize();
    std::string printVariableValues() const;
    auto getVariableValues() const;
    bool hasVariable(const std::string& variable) const;
    auto getVariableValue(const std::string& variable) const;
};

Methods

void updateVariable(const std::string& variable, double value)

Updates a variable value. Remember to call realize() after updating all variables for the changes to take effect

void updateVariables(const std::vector<std::pair<std::string, double>>& nameValuePairs)

Like updateVariable(), accepting several pairs of names-values

void realize()

Must be called after updating all variables so changes take effect.

auto getVariableValues() const

Returns all current variable values

bool hasVariable(const std::string& variable) const

Returns true if the variable has been defined via updateVariable()

auto getVariableValue(const std::string& variable) const

Returns the variable value, or std::nullopt if it is not defined