GCC Code Coverage Report


Directory: ./
File: src/tools/event.cpp
Date: 2024-11-13 12:35:17
Exec Total Coverage
Lines: 0 19 0.0%
Branches: 0 24 0.0%

Line Branch Exec Source
1 // Copyright (c) 2017, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3
4 #include <dynamic-graph/factory.h>
5
6 #include <sot/core/event.hh>
7
8 namespace dynamicgraph {
9 namespace sot {
10
11 bool &Event::check(bool &ret, const int &time) {
12 const bool &val = conditionSIN(time);
13 ret = (val != lastVal_);
14 bool up = (!lastVal_ && val);
15 if (up) {
16 timeSinceUp_ = 0;
17 } else if (val) {
18 ++timeSinceUp_;
19 }
20 // If repetition is activated, trigger again after given number of iterations
21 bool trigger = up || (repeatAfterNIterations_ > 0 &&
22 timeSinceUp_ >= repeatAfterNIterations_);
23 if (ret) {
24 lastVal_ = val;
25 }
26 if (trigger) {
27 for (Triggers_t::const_iterator _s = triggers.begin(); _s != triggers.end();
28 ++_s)
29 (*_s)->recompute(time);
30 timeSinceUp_ = 0;
31 }
32 return ret;
33 }
34
35 DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Event, "Event");
36 } // namespace sot
37 } // namespace dynamicgraph
38