MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/schematic/StatusTemplate.hpp
2024-06-07 11:12:56 +03:00

42 lines
809 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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_ */