diff --git a/libs/openFrameworks/types/ofParameter.h b/libs/openFrameworks/types/ofParameter.h index 9e36af034f2..1d19927d649 100644 --- a/libs/openFrameworks/types/ofParameter.h +++ b/libs/openFrameworks/types/ofParameter.h @@ -483,7 +483,9 @@ class ofParameter: public ofAbstractParameter{ ofParameter(const ofParameter & v); ofParameter(const ParameterType & v); ofParameter(const std::string& name, const ParameterType & v); + ofParameter(const std::string& name, const ParameterType & v, bool serializable); ofParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max); + ofParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max, bool serializable); const ParameterType & get() const; const ParameterType * operator->() const; @@ -557,6 +559,7 @@ class ofParameter: public ofAbstractParameter{ ofParameter & set(const ParameterType & v); ofParameter & set(const std::string& name, const ParameterType & v); ofParameter & set(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max); + ofParameter & set(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max, bool serializable); ofParameter & setWithoutEventNotifications(const ParameterType & v); @@ -608,6 +611,14 @@ class ofParameter: public ofAbstractParameter{ ,bInNotify(false) ,serializable(true){} + Value(std::string name, ParameterType v, bool serializable) + :name(name) + ,value(v) + ,min(of::priv::TypeInfo::min()) + ,max(of::priv::TypeInfo::max()) + ,bInNotify(false) + ,serializable(serializable){} + Value(std::string name, ParameterType v, ParameterType min, ParameterType max) :name(name) ,value(v) @@ -616,6 +627,14 @@ class ofParameter: public ofAbstractParameter{ ,bInNotify(false) ,serializable(true){} + Value(std::string name, ParameterType v, ParameterType min, ParameterType max, bool serializable) + :name(name) + ,value(v) + ,min(min) + ,max(max) + ,bInNotify(false) + ,serializable(serializable){} + std::string name; ParameterType value; ParameterType min, max; @@ -656,11 +675,20 @@ ofParameter::ofParameter(const std::string& name, const Parameter :obj(std::make_shared(name, v)) ,setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)){} +template +ofParameter::ofParameter(const std::string& name, const ParameterType & v, bool serializable) +:obj(std::make_shared(name, v, serializable)) +,setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)){} + template ofParameter::ofParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max) :obj(std::make_shared(name, v, min, max)) ,setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)){} +template +ofParameter::ofParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max, bool serializable) +:obj(std::make_shared(name, v, min, max, serializable)) +,setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)){} template inline ofParameter & ofParameter::operator=(const ofParameter & v){ @@ -689,6 +717,16 @@ ofParameter & ofParameter::set(const std::string& return *this; } +template +ofParameter & ofParameter::set(const std::string& name, const ParameterType & value, const ParameterType & min, const ParameterType & max, bool serializable){ + setName(name); + set(value); + setMin(min); + setMax(max); + setSerializable(serializable); + return *this; +} + template ofParameter & ofParameter::set(const std::string& name, const ParameterType & value){ setName(name); @@ -1077,7 +1115,9 @@ class ofReadOnlyParameter: public ofAbstractParameter{ // ofReadOnlyParameter(ofReadOnlyParameter & p); ofReadOnlyParameter(const ParameterType & v); ofReadOnlyParameter(const std::string& name, const ParameterType & v); + ofReadOnlyParameter(const std::string& name, const ParameterType & v, bool serializable); ofReadOnlyParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max); + ofReadOnlyParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max, bool serializable); const ParameterType & get() const; const ParameterType * operator->() const; @@ -1152,6 +1192,7 @@ class ofReadOnlyParameter: public ofAbstractParameter{ ofReadOnlyParameter& set(const std::string& name, const ParameterType & value); ofReadOnlyParameter& set(const std::string& name, const ParameterType & value, const ParameterType & min, const ParameterType & max); + ofReadOnlyParameter& set(const std::string& name, const ParameterType & value, const ParameterType & min, const ParameterType & max, bool serializable); void setMin(const ParameterType & min); void setMax(const ParameterType & max); @@ -1198,10 +1239,17 @@ template inline ofReadOnlyParameter::ofReadOnlyParameter(const std::string& name, const ParameterType & v) :parameter(name,v){} +template +inline ofReadOnlyParameter::ofReadOnlyParameter(const std::string& name, const ParameterType & v, bool serializable) +:parameter(name,v, serializable){} + template inline ofReadOnlyParameter::ofReadOnlyParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max) :parameter(name,v,min,max){} +template +inline ofReadOnlyParameter::ofReadOnlyParameter(const std::string& name, const ParameterType & v, const ParameterType & min, const ParameterType & max, bool serializable) +:parameter(name,v,min,max,serializable){} template inline const ParameterType & ofReadOnlyParameter::get() const{ @@ -1440,6 +1488,11 @@ inline ofReadOnlyParameter & ofReadOnlyParameter +inline ofReadOnlyParameter & ofReadOnlyParameter::set(const std::string& name, const ParameterType & value, const ParameterType & min, const ParameterType & max, bool serializable){ + parameter.set(name,value,min,max,serializable); + return *this; +} template inline void ofReadOnlyParameter::setMin(const ParameterType & min){