1#ifndef VISTLE_PARAMETER_MANAGER_IMPL_H
2#define VISTLE_PARAMETER_MANAGER_IMPL_H
13 std::cerr <<
"ParameterManager: parameter " << name <<
" not found" << std::endl;
16 auto p = std::dynamic_pointer_cast<ParameterBase<T>>(param);
18 std::cerr <<
"ParameterManager: parameter " << name <<
" not of requested type" << std::endl;
29 if (inResponseTo && inResponseTo->
isDelayed())
31 param->setValue(value,
false, delayed);
32 if (!inResponseTo || !inResponseTo->
isDelayed())
33 parameterChangedWrapper(param);
35 m_delayedChanges.push_back(param);
54 auto p = std::dynamic_pointer_cast<ParameterBase<T>>(
findParameter(name));
66 if (minimum > maximum) {
67 std::cerr <<
"range for parameter " << param->
getName() <<
" swapped: min " << minimum <<
" > max " << maximum
69 param->setMinimum(maximum);
70 param->setMaximum(minimum);
72 param->setMinimum(minimum);
73 param->setMaximum(maximum);
76 if (value < param->minimum()) {
77 std::cerr <<
"value " << value <<
" for parameter " << param->
getName()
78 <<
" increased to minimum: " << param->
minimum() << std::endl;
79 param->setValue(param->
minimum());
83 std::cerr <<
"value " << value <<
" for parameter " << param->
getName()
84 <<
" decreased to maximum: " << param->
maximum() << std::endl;
85 param->setValue(param->
maximum());
97 value = p->getValue();
99 std::cerr <<
"ParameterManager::getParameter(" << name <<
"): type failure" << std::endl;
100 assert(
"dynamic_cast failed" == 0);
Definition: parameter.h:100
const T getValue() const
Definition: parameter.h:144
virtual T minimum() const
Definition: parameter.h:174
virtual T maximum() const
Definition: parameter.h:175
bool setParameterMinimum(ParameterBase< T > *param, const T &minimum)
Definition: parametermanager_impl.h:40
bool setParameter(const std::string &name, const T &value, const message::SetParameter *inResponseTo=nullptr)
Definition: parametermanager_impl.h:9
bool getParameter(const std::string &name, T &value) const
Definition: parametermanager_impl.h:94
bool setParameterMaximum(ParameterBase< T > *param, const T &maximum)
Definition: parametermanager_impl.h:46
bool updateParameter(const std::string &name, const Parameter *parameter, const message::SetParameter *inResponseTo, Parameter::RangeType rt=Parameter::Value)
Definition: parametermanager.cpp:157
std::shared_ptr< Parameter > findParameter(const std::string &name) const
Definition: parametermanager.cpp:233
bool setParameterRange(const std::string &name, const T &minimum, const T &maximum)
Definition: parametermanager_impl.h:52
const std::string & getName() const
Definition: parameter.cpp:49
request parameter value update or notify that a parameter value has been changed
Definition: messages.h:501
bool isDelayed() const
Definition: messages.cpp:1124
Definition: allobjects.cpp:30