MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/schematic/StatusTemplate.hpp

42 lines
804 B
C++

/*
* StatusTemplate.hpp
*
* Created on: 29 ñåíò. 2019 ã.
* Author: user
*/
#ifndef SOURCE_SCHEMATIC_STATUSTEMPLATE_HPP_
#define SOURCE_SCHEMATIC_STATUSTEMPLATE_HPP_
#include "../systemic/IStatus.hh"
#if __cplusplus >= 201103L
#include <functional>
#endif
namespace systemic { namespace detail {
template<typename Function>
class TemplateStatus : public IStatus {
Function & function;
public:
TemplateStatus(Function & f) : function(f) {}
operator bool() const { return function(); }
};
#if __cplusplus >= 201103L
class FunctionalStatus : public systemic::IStatus {
std::function<bool()> f;
public:
FunctionalStatus( std::function<bool()> _f) : f(_f) {}
operator bool() const { return f(); }
};
#endif
}}
#endif /* SOURCE_SCHEMATIC_STATUSTEMPLATE_HPP_ */