Lodestar
An integrated real-time control package in C++
|
|
5 #ifndef LODESTAR_UNARYABSBLOCK_HPP
6 #define LODESTAR_UNARYABSBLOCK_HPP
9 #include <Lodestar/blocks/Block.hpp>
10 #include <Lodestar/aux/TemplateTools.hpp>
15 template<
typename TInput>
39 template<typename TTInput = TInput, typename ::std::enable_if<ls::aux::TemplateTraits::BinaryOperators::parseMatrixLike<TTInput>::value>::type * =
nullptr>
42 this->equation = [](
Base &b) ->
void {
43 b.template o<0>().object = b.template i<0>().object;
44 b.template o<0>().object = b.template o<0>().object.unaryExpr([] (
typename InputTrait::scalar s) ->
typename InputTrait::scalar {
47 b.template o<0>().propagate();
51 template<typename TTInput = TInput, typename ::std::enable_if<::std::is_same<TTInput, typename ls::aux::TemplateTraits::BinaryOperators::parseMatrixLike<TTInput>::scalar>::value>::type * =
nullptr>
54 this->equation = [](
Base &b) ->
void {
55 b.template o<0>() = (b.template i<0>().object < 0) ? (-b.template i<0>().object) : b.template i<0>().object;
61 template<
typename TInput>
78 static const ::std::array<::std::string, kIns>
inTypes;
79 static const ::std::array<::std::string, kOuts>
outTypes;
80 static const ::std::array<::std::string, kPars>
parTypes;
85 template<
typename TInput>
87 {demangle(
typeid(TInput).name())};
89 template<
typename TInput>
90 const ::std::array<::std::string, BlockTraits<std::UnaryAbsBlock<TInput>>::kOuts> BlockTraits<std::UnaryAbsBlock<TInput>>::outTypes =
91 {demangle(
typeid(TInput).name())};
93 template<
typename TInput>
94 const ::std::array<::std::string, BlockTraits<std::UnaryAbsBlock<TInput>>::kPars> BlockTraits<std::UnaryAbsBlock<TInput>>::parTypes =
97 template<
typename TInput>
98 const ::std::array<::std::string, 1> BlockTraits<std::UnaryAbsBlock<TInput>>::templateTypes =
99 {demangle(
typeid(TInput).name())};
104 #endif //LODESTAR_UNARYABSBLOCK_HPP
static constexpr const bool directFeedthrough
Whether or not the block has direct feedthrough.
Definition: BlockTraits.hpp:44
A traits object that exposes information about TBlock.
Definition: BlockTraits.hpp:37
static const ::std::array<::std::string, kIns > inTypes
Input types (as strings).
Definition: BlockTraits.hpp:59
BlockType
Block type information.
Definition: BlockType.hpp:25
Extracts data from matrix-like types.
Definition: TemplateTraits.hpp:114
Main Lodestar code.
Definition: BilinearTransformation.hpp:12
static const ::std::array<::std::string, kOuts > outTypes
Output types (as strings).
Definition: BlockTraits.hpp:61
static constexpr const BlockType blockType
Block type.
Definition: BlockTraits.hpp:42
Definition: UnaryAbsBlock.hpp:16
static const ::std::array<::std::string, 1 > templateTypes
Template parameter types (as strings).
Definition: BlockTraits.hpp:66
Generic base template class for all tuple-based Block instances.
Definition: Block.hpp:45
static const constexpr int kIns
Number of input slots.
Definition: BlockTraits.hpp:52
@ UnaryAbsBlock
Unary absolute value block.
static const ::std::array<::std::string, kPars > parTypes
Parameter types (as strings).
Definition: BlockTraits.hpp:63
static const constexpr int kPars
Number of parameters.
Definition: BlockTraits.hpp:56
static const constexpr int kOuts
Number of output slots.
Definition: BlockTraits.hpp:54