GCC Code Coverage Report


Directory: ./
File: include/sot/core/unary-op.hh
Date: 2024-12-13 12:22:33
Exec Total Coverage
Lines: 10 15 66.7%
Branches: 21 42 50.0%

Line Branch Exec Source
1 /*
2 * Copyright 2010,
3 * François Bleibel,
4 * Olivier Stasse,
5 *
6 * CNRS/AIST
7 *
8 */
9
10 #ifndef SOT_CORE_UNARYOP_HH
11 #define SOT_CORE_UNARYOP_HH
12
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16
17 /* SOT */
18 #include <dynamic-graph/all-signals.h>
19 #include <dynamic-graph/entity.h>
20
21 /* --------------------------------------------------------------------- */
22 /* --- CLASS ----------------------------------------------------------- */
23 /* --------------------------------------------------------------------- */
24
25 namespace dynamicgraph {
26 namespace sot {
27
28 template <typename Operator>
29 class UnaryOp : public Entity {
30 Operator op;
31 typedef typename Operator::Tin Tin;
32 typedef typename Operator::Tout Tout;
33 typedef UnaryOp<Operator> Self;
34
35 public: /* --- CONSTRUCTION --- */
36 12 static std::string getTypeInName(void) { return Operator::nameTypeIn(); }
37 6 static std::string getTypeOutName(void) { return Operator::nameTypeOut(); }
38 static const std::string CLASS_NAME;
39
40 6 virtual const std::string &getClassName() const { return CLASS_NAME; }
41
42 4 std::string getDocString() const { return op.getDocString(); }
43
44 6 UnaryOp(const std::string &name)
45 : Entity(name),
46
7/14
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
6 SIN(NULL, Self::CLASS_NAME + "(" + name + ")::input(" +
47 Self::getTypeInName() + ")::sin"),
48
10/20
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 3 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 3 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 3 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 3 times.
✗ Branch 29 not taken.
6 SOUT(boost::bind(&Self::computeOperation, this, _1, _2), SIN,
49 Self::CLASS_NAME + "(" + name + ")::output(" +
50
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
6 Self::getTypeOutName() + ")::sout") {
51
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
6 signalRegistration(SIN << SOUT);
52
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
6 op.addSpecificCommands(*this, commandMap);
53 }
54
55 virtual ~UnaryOp(void){};
56
57 public: /* --- SIGNAL --- */
58 SignalPtr<Tin, int> SIN;
59 SignalTimeDependent<Tout, int> SOUT;
60
61 protected:
62 Tout &computeOperation(Tout &res, int time) {
63 const Tin &x1 = SIN(time);
64 op(x1, res);
65 return res;
66 }
67
68 public: /* --- PARAMS --- */
69 };
70 } /* namespace sot */
71 } /* namespace dynamicgraph */
72
73 #endif // #ifndef SOT_CORE_UNARYOP_HH
74