Lodestar
An integrated real-time control package in C++
Block.hpp
1 //
2 // Created by Hamza El-Kebir on 12/22/21.
3 //
4 
5 #ifndef LODESTAR_BLOCK_HPP
6 #define LODESTAR_BLOCK_HPP
7 
8 #include <tuple>
9 #include <type_traits>
10 #include <functional>
11 #include "BlockBase.hpp"
12 #include "Signal.hpp"
13 #include "BlockTraits.hpp"
14 #include "Lodestar/aux/TemplateTools.hpp"
15 #include "Lodestar/aux/AlwaysFalse.hpp"
16 
17 #ifdef LS_USE_GINAC
18 
19 #include <ginac/ginac.h>
20 
21 #endif
22 
23 namespace ls {
28  namespace blocks {
44  template<typename TInputsList, typename TOutputsList, typename TParametersList = BlockProto::empty>
45  class Block
46  : public BlockBase<Block<TInputsList, TOutputsList, TParametersList>> {
47  };
48 
69  template<typename... TInputs, typename... TOutputs, typename... TParameters>
71  class Block<
72  ::std::tuple<TInputs...>,
73  ::std::tuple<TOutputs...>,
74  ::std::tuple<TParameters...>
75  >
76  : public BlockBase<Block<
77  ::std::tuple<TInputs...>,
78  ::std::tuple<TOutputs...>,
79  ::std::tuple<TParameters...>>
80  > {
81  public:
83  using type =
84  Block<
85  ::std::tuple<TInputs...>,
86  ::std::tuple<TOutputs...>,
87  ::std::tuple<TParameters...>
88  >;
90  using InputsRaw = ::std::tuple<TInputs...>;
92  using Inputs = ::std::tuple<typename ls::aux::TemplateTools::wrap<TInputs, Signal>::type...>;
94  using OutputsRaw = ::std::tuple<TOutputs...>;
96  using Outputs = ::std::tuple<typename ls::aux::TemplateTools::wrap<TOutputs, Signal>::type...>;
98  using Params = ::std::tuple<TParameters...>;
99 
101  using Equation = ::std::function<void(type &)>;
102 
103  enum {
104  kIns = sizeof...(TInputs),
105  kOuts = sizeof...(TOutputs),
106  kPars = sizeof...(TParameters)
107  };
108 
110 // const unsigned int id;
111  using BlockProto::id;
112 
119  Block() : inputs(Inputs{}), outputs(Outputs{}), params(Params{}),
120  equation{}
121  {
122  BlockProto::ins = kIns;
123  BlockProto::outs = kOuts;
124  BlockProto::pars = kPars;
125 
126  int inputSlotCounter = 0;
127  auto primeInputSignal = [&](SignalBase *sb) {
128  sb->blockId = id;
129  sb->slotId = inputSlotCounter++;
130  sb->isInput = true;
131 
132  BlockProto::inputPointers.push_back(sb);
133  };
134 
135  int outputSlotCounter = 0;
136  auto primeOutputSignal = [&](SignalBase *sb) {
137  sb->blockId = id;
138  sb->slotId = outputSlotCounter++;
139  sb->isInput = false;
140 
141  BlockProto::outputPointers.push_back(sb);
142  };
143 
144  ls::aux::TemplateTools::Executors::forEachPointer(inputs,
145  primeInputSignal);
146  ls::aux::TemplateTools::Executors::forEachPointer(outputs,
147  primeOutputSignal);
148 
149 //#ifdef LS_USE_GINAC
150 // serial = GiNaC::function::register_new(
151 // GiNaC::function_options("blkf" + ::std::to_string(id) + "__", blkFunc_NPARAMS)
152 // );
153 //#endif
154  }
155 
156  // void connect();
157 
158  // INPUTS
159 
165  template<size_t TIdx,
166  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
167  typename ::std::tuple_element<TIdx, Inputs>::type &getInput()
168  {
169  return ::std::get<TIdx>(inputs);
170  }
171 
177  template<size_t TIdx,
178  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
179  typename ::std::tuple_element<TIdx, Inputs>::type &getInput()
180  {
181  static_assert(((TIdx >= 0) && (TIdx < kIns)),
182  "Input index out of bounds.");
183  }
184 
190  template<size_t TIdx,
191  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
192  const typename ::std::tuple_element<TIdx, Inputs>::type &
193  getInput() const
194  {
195  return ::std::get<TIdx>(inputs);
196  }
197 
203  template<size_t TIdx,
204  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
205  const typename ::std::tuple_element<TIdx, Inputs>::type &
206  getInput() const
207  {
208  static_assert(((TIdx >= 0) && (TIdx < kIns)),
209  "Input index out of bounds.");
210  }
211 
219  template<size_t TIdx,
220  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
221  typename ::std::tuple_element<TIdx, Inputs>::type &i()
222  {
223  return getInput<TIdx>();
224  }
225 
231  template<size_t TIdx,
232  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
233  typename ::std::tuple_element<TIdx, Inputs>::type &i()
234  {
235  static_assert(((TIdx >= 0) && (TIdx < kIns)),
236  "Input index out of bounds.");
237  }
238 
246  template<size_t TIdx,
247  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
248  const typename ::std::tuple_element<TIdx, Inputs>::type &i() const
249  {
250  return getInput<TIdx>();
251  }
252 
258  template<size_t TIdx,
259  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kIns))>::type * = nullptr>
260  const typename ::std::tuple_element<TIdx, Inputs>::type &i() const
261  {
262  static_assert(((TIdx >= 0) && (TIdx < kIns)),
263  "Input index out of bounds.");
264  }
265 
266  // OUTPUTS
267 
273  template<size_t TIdx,
274  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
275  typename ::std::tuple_element<TIdx, Outputs>::type &getOutput()
276  {
277  return ::std::get<TIdx>(outputs);
278  }
279 
285  template<size_t TIdx,
286  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
287  typename ::std::tuple_element<TIdx, Outputs>::type &getOutput()
288  {
289  static_assert(((TIdx >= 0) && (TIdx < kOuts)),
290  "Output index out of bounds.");
291  }
292 
298  template<size_t TIdx,
299  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
300  const typename ::std::tuple_element<TIdx, Outputs>::type &
301  getOutput() const
302  {
303  return ::std::get<TIdx>(outputs);
304  }
305 
311  template<size_t TIdx,
312  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
313  const typename ::std::tuple_element<TIdx, Outputs>::type &
314  getOutput() const
315  {
316  static_assert(((TIdx >= 0) && (TIdx < kOuts)),
317  "Output index out of bounds.");
318  }
319 
327  template<size_t TIdx,
328  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
329  typename ::std::tuple_element<TIdx, Outputs>::type &o()
330  {
331  return getOutput<TIdx>();
332  }
333 
339  template<size_t TIdx,
340  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
341  typename ::std::tuple_element<TIdx, Outputs>::type &o()
342  {
343  static_assert(((TIdx >= 0) && (TIdx < kOuts)),
344  "Output index out of bounds.");
345  }
346 
354  template<size_t TIdx,
355  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
356  const typename ::std::tuple_element<TIdx, Outputs>::type &o() const
357  {
358  return getOutput<TIdx>();
359  }
360 
366  template<size_t TIdx,
367  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kOuts))>::type * = nullptr>
368  const typename ::std::tuple_element<TIdx, Outputs>::type &o() const
369  {
370  static_assert(((TIdx >= 0) && (TIdx < kOuts)),
371  "Output index out of bounds.");
372  }
373 
374  // PARAMETERS
375 
381  template<size_t TIdx,
382  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
383  typename ::std::tuple_element<TIdx, Params>::type &getParam()
384  {
385  return ::std::get<TIdx>(params);
386  }
387 
393  template<size_t TIdx,
394  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
395  typename ::std::tuple_element<TIdx, Params>::type &getParam()
396  {
397  static_assert(((TIdx >= 0) && (TIdx < kPars)),
398  "Parameter index out of bounds.");
399  }
400 
406  template<size_t TIdx,
407  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
408  const typename ::std::tuple_element<TIdx, Params>::type &
409  getParam() const
410  {
411  return ::std::get<TIdx>(params);
412  }
413 
419  template<size_t TIdx,
420  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
421  const typename ::std::tuple_element<TIdx, Params>::type &
422  getParam() const
423  {
424  static_assert(((TIdx >= 0) && (TIdx < kPars)),
425  "Parameter index out of bounds.");
426  }
427 
435  template<size_t TIdx,
436  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
437  typename ::std::tuple_element<TIdx, Params>::type &p()
438  {
439  return getParam<TIdx>();
440  }
441 
447  template<size_t TIdx,
448  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
449  typename ::std::tuple_element<TIdx, Params>::type &p()
450  {
451  static_assert(((TIdx >= 0) && (TIdx < kPars)),
452  "Parameter index out of bounds.");
453  }
454 
462  template<size_t TIdx,
463  typename ::std::enable_if<((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
464  const typename ::std::tuple_element<TIdx, Params>::type &p() const
465  {
466  return getParam<TIdx>();
467  }
468 
474  template<size_t TIdx,
475  typename ::std::enable_if<!((TIdx >= 0) && (TIdx < kPars))>::type * = nullptr>
476  const typename ::std::tuple_element<TIdx, Params>::type &p() const
477  {
478  static_assert(((TIdx >= 0) && (TIdx < kPars)),
479  "Parameter index out of bounds.");
480  }
481 
485  void trigger()
486  {
487  if (equation)
488  return equation(*this);
489  }
490 
491 #ifdef LS_USE_GINAC
492 
493  const ::std::array<GiNaC::ex, kIns> &inputSymbols()
494  {
495  if (!isInitInput_) {
496  for (int i = 0; i < kIns; i++)
497  inputSymbols_[i] = GiNaC::symbol{"blk" + ::std::to_string(id) + "_i_" + ::std::to_string(i),
498  "\\text{BLK}^{i, " + ::std::to_string(i) + "}_{" + ::std::to_string(id) +
499  "}"};
500 
501  isInitInput_ = true;
502  }
503 
504  return inputSymbols_;
505  }
506 
507  const ::std::array<GiNaC::ex, kOuts> &outputSymbols()
508  {
509  if (!isInitOutput_) {
510  for (int i = 0; i < kOuts; i++)
511  outputSymbols_[i] = GiNaC::symbol{"blk" + ::std::to_string(id) + "_o_" + ::std::to_string(i),
512  "\\text{BLK}^{o, " + ::std::to_string(i) + "}_{" + ::std::to_string(id) +
513  "}"};
514 
515  isInitOutput_ = true;
516  }
517 
518  return outputSymbols_;
519  }
520 
521  const ::std::array<GiNaC::ex, kPars> &parameterSymbols()
522  {
523  if (!isInitParameter_) {
524  for (int i = 0; i < kPars; i++)
525  parameterSymbols_[i] = GiNaC::symbol{"blk" + ::std::to_string(id) + "_p_" + ::std::to_string(i),
526  "\\text{BLK}^{o, " + ::std::to_string(i) + "}_{" + ::std::to_string(id) +
527  "}"};
528 
529  isInitParameter_ = true;
530  }
531 
532  return parameterSymbols_;
533  }
534 
535 // GiNaC::function_options & getFunctionOptions()
536 // {
537 // static ::std::vector<GiNaC::function_options> fops{};
538 // fops = GiNaC::function::get_registered_functions();
539 //
540 // return fops[serial];
541 // }
542 
543  static const unsigned blkFunc_NPARAMS = 1;
544 
545  template<typename ...T, typename ::std::enable_if<sizeof...(T) == kIns>::type * = nullptr>
546  const GiNaC::function blkf(const T &...p)
547  {
548  return GiNaC::function(BlockProto::serial, ::std::vector<GiNaC::ex>{GiNaC::ex(p)..., GiNaC::numeric{id}});
549  }
550 
551  template<typename ...T, typename ::std::enable_if<sizeof...(T) != kIns>::type * = nullptr>
552  const GiNaC::function blkf(const T &...p)
553  {
554  static_assert(sizeof...(T) == blkFunc_NPARAMS,
555  "Incorrect number of arguments provided to symbolic function.");
556 
557  return GiNaC::function(BlockProto::serial, ::std::vector<GiNaC::ex>{GiNaC::ex(p)...});
558  }
559 #else
560 
561  ::std::array<int, kIns> &inputSymbols()
562  {
563  static_assert(always_false<::std::array<int, kIns>>::value, "GiNaC use is not enabled. Please compile with LS_USE_GINAC flag.");
564 
565  static ::std::array<int, kIns> arr;
566  return arr;
567  }
568 
569  ::std::array<int, kIns> &outputSymbols()
570  {
571  static_assert(always_false<::std::array<int, kIns>>::value, "GiNaC use is not enabled. Please compile with LS_USE_GINAC flag.");
572 
573  static ::std::array<int, kIns> arr;
574  return arr;
575  }
576 
577  ::std::array<int, kIns> &parameterSymbols()
578  {
579  static_assert(always_false<::std::array<int, kIns>>::value, "GiNaC use is not enabled. Please compile with LS_USE_GINAC flag.");
580 
581  static ::std::array<int, kIns> arr;
582  return arr;
583  }
584 
585 #endif
586 
595 
596 #ifdef LS_USE_GINAC
597  protected:
598  bool isInitInput_ = false;
599  bool isInitOutput_ = false;
600  bool isInitParameter_ = false;
601 
602  ::std::array<GiNaC::ex, kIns> inputSymbols_;
603  ::std::array<GiNaC::ex, kOuts> outputSymbols_;
604  ::std::array<GiNaC::ex, kPars> parameterSymbols_;
605 #endif
606  };
607 
608  template<typename... TInputs,
609  typename... TOutputs,
610  typename... TParameters>
611  class BlockTraits<
612  Block<
613  ::std::tuple<TInputs...>,
614  ::std::tuple<TOutputs...>,
615  ::std::tuple<TParameters...>
616  >> {
617  public:
618  static constexpr const BlockType blockType = BlockType::GenericBlock;
619  static constexpr const bool directFeedthrough = false;
620 
621  using type =
622  Block<
623  ::std::tuple<TInputs...>,
624  ::std::tuple<TOutputs...>,
625  ::std::tuple<TParameters...>
626  >;
627  using Base = typename type::Base;
628 
629  static const constexpr int kIns = type::Base::kIns;
630  static const constexpr int kOuts = type::Base::kOuts;
631  static const constexpr int kPars = type::Base::kPars;
632  };
633 
634 #ifdef LS_USE_GINAC
635  static ::std::unordered_map<unsigned int, ::std::function<GiNaC::ex(::std::vector<GiNaC::ex>)>>
636  symbolicEvalFunctionMap{}, symbolicEvalfFunctionMap{}, symbolicConjugateFunctionMap{}, symbolicRealFunctionMap{},
637  symbolicImagFunctionMap{}, symbolicExpandFunctionMap{}, symbolicDerivFunctionMap{}, symbolicExplDerivFunctionMap{},
638  symbolicPowerFunctionMap{}, symbolicSeriesFunctionMap{}, symbolicPrintFunctionMap{}, symbolicInfoFunctionMap{};
639 
640  static GiNaC::ex symbolicEval(const ::std::vector<GiNaC::ex> &args)
641  {
642  return symbolicEvalFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
643  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
644  }
645 
646  static GiNaC::ex symbolicEvalf(const ::std::vector<GiNaC::ex> &args)
647  {
648  return symbolicEvalfFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
649  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
650  }
651 
652  static GiNaC::ex symbolicConjugate(const ::std::vector<GiNaC::ex> &args)
653  {
654  return symbolicConjugateFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
655  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
656  }
657 
658  static GiNaC::ex symbolicReal(const ::std::vector<GiNaC::ex> &args)
659  {
660  return symbolicRealFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
661  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
662  }
663 
664  static GiNaC::ex symbolicImag(const ::std::vector<GiNaC::ex> &args)
665  {
666  return symbolicImagFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
667  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
668  }
669 
670  static GiNaC::ex symbolicExpand(const ::std::vector<GiNaC::ex> &args)
671  {
672  return symbolicExpandFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
673  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
674  }
675 
676  static GiNaC::ex symbolicDeriv(const ::std::vector<GiNaC::ex> &args)
677  {
678  return symbolicDerivFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
679  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
680  }
681 
682  static GiNaC::ex symbolicExplDeriv(const ::std::vector<GiNaC::ex> &args)
683  {
684  return symbolicExplDerivFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
685  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
686  }
687 
688  static GiNaC::ex symbolicPower(const ::std::vector<GiNaC::ex> &args)
689  {
690  return symbolicPowerFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
691  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
692  }
693 
694  static GiNaC::ex symbolicSeries(const ::std::vector<GiNaC::ex> &args)
695  {
696  return symbolicSeriesFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
697  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
698  }
699 
700  static GiNaC::ex symbolicPrint(const ::std::vector<GiNaC::ex> &args)
701  {
702  return symbolicPrintFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
703  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
704  }
705 
706  static GiNaC::ex symbolicInfo(const ::std::vector<GiNaC::ex> &args)
707  {
708  return symbolicInfoFunctionMap[GiNaC::ex_to<GiNaC::numeric>(args.back()).to_int()](
709  ::std::vector<GiNaC::ex>{args.begin(), args.end() - 1});
710  }
711 #endif
712  }
713 }
714 
715 
716 #endif //LODESTAR_BLOCK_HPP
ls::blocks::BlockType::GenericBlock
@ GenericBlock
Generic block (for debug purposes).
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::inputs
Inputs inputs
Input signals.
Definition: Block.hpp:588
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::p
typename ::std::tuple_element< TIdx, Params >::type & p()
Definition: Block.hpp:437
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getInput
const typename ::std::tuple_element< TIdx, Inputs >::type & getInput() const
Definition: Block.hpp:193
ls::blocks::BlockProto::inputPointers
std::vector< SignalBase * > inputPointers
Utility using declaration for empty slot bank.
Definition: BlockProto.hpp:25
ls::blocks::BlockTraits::directFeedthrough
static constexpr const bool directFeedthrough
Whether or not the block has direct feedthrough.
Definition: BlockTraits.hpp:44
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getOutput
typename ::std::tuple_element< TIdx, Outputs >::type & getOutput()
Definition: Block.hpp:275
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::params
Params params
Parameters.
Definition: Block.hpp:592
ls::blocks::BlockProto::outs
unsigned int outs
Number of input slots.
Definition: BlockProto.hpp:31
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::Params
::std::tuple< TParameters... > Params
Using-declaration of the parameter types.
Definition: Block.hpp:98
ls::blocks::BlockTraits
A traits object that exposes information about TBlock.
Definition: BlockTraits.hpp:37
ls::blocks::BlockType
BlockType
Block type information.
Definition: BlockType.hpp:25
always_false
Definition: AlwaysFalse.hpp:11
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::Equation
::std::function< void(type &)> Equation
Using-declaration of the trigger equation function type.
Definition: Block.hpp:101
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::trigger
void trigger()
Definition: Block.hpp:485
ls
Main Lodestar code.
Definition: BilinearTransformation.hpp:12
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::Block
Block()
Default constructor.
Definition: Block.hpp:119
ls::blocks::BlockProto::outputPointers
std::vector< SignalBase * > outputPointers
Vector of input signal pointers.
Definition: BlockProto.hpp:26
ls::blocks::BlockProto::id
const unsigned int id
Vector of output signal pointers.
Definition: BlockProto.hpp:28
ls::blocks::BlockBase
Definition: BlockBase.hpp:13
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::InputsRaw
::std::tuple< TInputs... > InputsRaw
Using-declaration of the raw (unwrapped) input types.
Definition: Block.hpp:90
ls::blocks::BlockProto::ins
unsigned int ins
Unique Block ID.
Definition: BlockProto.hpp:30
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::o
const typename ::std::tuple_element< TIdx, Outputs >::type & o() const
Definition: Block.hpp:356
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::OutputsRaw
::std::tuple< TOutputs... > OutputsRaw
Using-declaration of the raw (unwrapped) output types.
Definition: Block.hpp:94
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::outputs
Outputs outputs
Output signals.
Definition: Block.hpp:590
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::i
typename ::std::tuple_element< TIdx, Inputs >::type & i()
Definition: Block.hpp:221
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::Inputs
::std::tuple< typename ls::aux::TemplateTools::wrap< TInputs, Signal >::type... > Inputs
Using-declaration of the Signal-wrapped input types.
Definition: Block.hpp:92
ls::blocks::BlockTraits::blockType
static constexpr const BlockType blockType
Block type.
Definition: BlockTraits.hpp:42
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::i
const typename ::std::tuple_element< TIdx, Inputs >::type & i() const
Definition: Block.hpp:248
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::p
const typename ::std::tuple_element< TIdx, Params >::type & p() const
Definition: Block.hpp:464
ls::blocks::Block
Generic base template class for all tuple-based Block instances.
Definition: Block.hpp:45
ls::blocks::BlockTraits::kIns
static const constexpr int kIns
Number of input slots.
Definition: BlockTraits.hpp:52
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getParam
typename ::std::tuple_element< TIdx, Params >::type & getParam()
Definition: Block.hpp:383
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getParam
const typename ::std::tuple_element< TIdx, Params >::type & getParam() const
Definition: Block.hpp:409
ls::blocks::BlockTraits::kPars
static const constexpr int kPars
Number of parameters.
Definition: BlockTraits.hpp:56
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >
Definition: Block.hpp:71
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getOutput
const typename ::std::tuple_element< TIdx, Outputs >::type & getOutput() const
Definition: Block.hpp:301
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::o
typename ::std::tuple_element< TIdx, Outputs >::type & o()
Definition: Block.hpp:329
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::equation
Equation equation
Trigger function.
Definition: Block.hpp:594
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::getInput
typename ::std::tuple_element< TIdx, Inputs >::type & getInput()
Definition: Block.hpp:167
ls::blocks::BlockTraits::kOuts
static const constexpr int kOuts
Number of output slots.
Definition: BlockTraits.hpp:54
ls::blocks::Block< ::std::tuple< TInputs... >, ::std::tuple< TOutputs... >, ::std::tuple< TParameters... > >::Outputs
::std::tuple< typename ls::aux::TemplateTools::wrap< TOutputs, Signal >::type... > Outputs
Using-declaration of the Signal-wrapped output types.
Definition: Block.hpp:96
ls::blocks::BlockProto::pars
unsigned int pars
Number of output slots.
Definition: BlockProto.hpp:32