40 lines
723 B
C++
40 lines
723 B
C++
/*
|
||
* ApplySetting.hpp
|
||
*
|
||
* Created on: 7 июл. 2020 г.
|
||
* 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_ */
|