5 #ifndef LODESTAR_FUNCTIONBLOCK_HPP
6 #define LODESTAR_FUNCTIONBLOCK_HPP
9 #include "Lodestar/blocks/Block.hpp"
10 #include "Lodestar/aux/TemplateTools.hpp"
15 template<
typename TOutput = int,
typename... TInputs>
18 ::std::tuple<TInputs...>,
19 ::std::tuple<TOutput>,
20 ::std::tuple<::std::function<TOutput(TInputs...)>>
25 ::std::tuple<TInputs...>,
26 ::std::tuple<TOutput>,
27 ::std::tuple<::std::function<TOutput(TInputs...)>>
30 using Function = ::std::function<TOutput(TInputs...)>;
39 this->
template p<0>() = fun;
43 template<
typename TTOutput,
typename... TTInputs>
45 make(const ::std::function<TTOutput(TTInputs...)> &fun)
53 this->equation = ::std::bind(
56 ::std::placeholders::_1
60 void triggerFunction(
Base &b)
62 b.template o<0>() = ls::aux::TemplateTools::Executors::applyWrapped(
69 template<
typename TOutput,
typename... TInputs>
86 static const ::std::array<::std::string, kIns>
inTypes;
87 static const ::std::array<::std::string, kOuts>
outTypes;
88 static const ::std::array<::std::string, kPars>
parTypes;
90 static const ::std::array<::std::string, kIns + kOuts>
templateTypes;
93 template<
typename TOutput,
typename... TInputs>
95 {demangle(
typeid(TInputs).name())...};
97 template<
typename TOutput,
typename... TInputs>
98 const ::std::array<::std::string, BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::kOuts> BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::outTypes =
99 {demangle(
typeid(TOutput).name())};
101 template<
typename TOutput,
typename... TInputs>
102 const ::std::array<::std::string, BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::kPars> BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::parTypes =
103 {demangle(
typeid(::std::function<TOutput(TInputs...)>).name())};
105 template<
typename TOutput,
typename... TInputs>
106 const ::std::array<::std::string, BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::kIns + BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::kOuts> BlockTraits<std::FunctionBlock<TOutput, TInputs...>>::templateTypes =
107 {demangle(
typeid(TOutput).name()), demangle(
typeid(TInputs).name())...};
112 #endif //LODESTAR_FUNCTIONBLOCK_HPP