40 lines
719 B
C++
40 lines
719 B
C++
|
|
/*
|
|||
|
|
* ApplySetting.hpp
|
|||
|
|
*
|
|||
|
|
* Created on: 7 <EFBFBD><EFBFBD><EFBFBD>. 2020 <EFBFBD>.
|
|||
|
|
* Author: LeonidTitov
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef UMLIBRARY_SYSTEMIC_APPLYSETTING_HPP_
|
|||
|
|
#define UMLIBRARY_SYSTEMIC_APPLYSETTING_HPP_
|
|||
|
|
|
|||
|
|
#include "IFunctor.hh"
|
|||
|
|
|
|||
|
|
namespace systemic {
|
|||
|
|
|
|||
|
|
template<typename Object>
|
|||
|
|
class ApplySetting : public IFunctor<void> {
|
|||
|
|
|
|||
|
|
Object & object;
|
|||
|
|
typename Object::Setting & config;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
void operator()();
|
|||
|
|
|
|||
|
|
ApplySetting( Object & object, typename Object::Setting & config ) :
|
|||
|
|
object(object), config(config) {}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
template<typename Object>
|
|||
|
|
inline void systemic::ApplySetting<Object>::operator ()() {
|
|||
|
|
|
|||
|
|
if( config.isValid() )
|
|||
|
|
object.configure( config );
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif /* UMLIBRARY_SYSTEMIC_APPLYSETTING_HPP_ */
|