#include "Input.h" namespace mdd{ Input::Input(const std::string& type, int appendix, const json& default_value, const std::function& verification) { _type = type; _value = default_value; _verification = std::move(verification); _prefix = ""; _appendix = appendix; } std::string Input::setType(std::string type){ _type = type; return getID(); } std::string Input::getType(){ return _type; } std::string Input::getID(){ return _prefix + "/" + _type + std::to_string(_appendix); } std::string Input::setPrefix(std::string prefix){ _prefix = prefix; return getID(); } std::string Input::setAppendix(int appendix){ _appendix = appendix; return getID(); } const json& Input::getValue() { return _value; } json& Input::setDefaultValue(){ return _value; } bool Input::verify(const json & data){ return _verification(data); } bool Input::connect(std::shared_ptr output){ if (verify(output->getValue())) { _output = output; return true; } } }