MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/systemic/ApplyParameter.hpp

45 lines
806 B
C++
Raw Permalink Normal View History

/*
* ApplyParameter.hpp
*
* Created on: 7 <EFBFBD><EFBFBD><EFBFBD>. 2021 <EFBFBD>.
* Author: titov
*/
#ifndef UMLIBRARY_SYSTEMIC_APPLYPARAMETER_HPP_
#define UMLIBRARY_SYSTEMIC_APPLYPARAMETER_HPP_
#include "IFunctor.hh"
#include "CustomParameters.hpp"
namespace systemic {
template<typename Object>
class ApplyParameter : public IFunctor<void> {
Object & object;
Parameter<Object> parameter;
public:
void operator()();
ApplyParameter( Object & object, Parameter<Object> parameter ) :
object(object), parameter(parameter) {}
};
}
template<typename Object>
inline void systemic::ApplyParameter<Object>::operator ()() {
LocalSetting<Object> ls( parameter );
if( ls.setting.isValid() )
object.configure( ls.setting );
}
#endif /* UMLIBRARY_SYSTEMIC_APPLYPARAMETER_HPP_ */