iCub-main
icub-main
src
libraries
icubmod
embObjLib
mcEventDownsampler.h
Go to the documentation of this file.
1
2
#ifndef __EVENT_DOWNSAMPLER_H_
3
#define __EVENT_DOWNSAMPLER_H_
4
5
#include <string>
6
#include <mutex>
7
8
#include <stddef.h>
9
#include <stdint.h>
10
#include <yarp/os/Timer.h>
11
#include <yarp/os/Time.h>
12
#include <yarp/os/LogStream.h>
13
#include <yarp/os/LogComponent.h>
14
15
namespace
mced
{
16
17
class
mcEventDownsampler
18
{
19
public
:
20
25
struct
Config
26
{
27
double
period
{.01};
28
size_t
threshold
{10};
29
std::string
subcomponent
{
""
};
30
std::string
info
{
""
};
31
};
32
37
mcEventDownsampler
();
38
43
~mcEventDownsampler
();
44
49
bool
start
();
50
55
bool
stop
();
56
62
bool
canprint
();
63
Config
config
;
64
65
private
:
75
bool
step(
const
yarp::os::YarpTimerEvent &event);
76
81
void
printreport();
82
84
yarp::os::Timer* timer {
nullptr
};
85
87
double
expire_time;
88
92
bool
isdownsampling {
false
};
93
95
size_t
counter {0};
96
98
size_t
latch_1{0};
99
101
size_t
latch_2{0};
102
104
std::mutex *mutex {
nullptr
};
105
};
106
107
}
// mced
108
109
#endif
// __EVENT_DOWNSAMPLER_H_
mced::mcEventDownsampler
Definition:
mcEventDownsampler.h:18
mced::mcEventDownsampler::~mcEventDownsampler
~mcEventDownsampler()
Destroy the Event Downsampler object.
Definition:
mcEventDownsampler.cpp:16
mced::mcEventDownsampler::start
bool start()
Instantiates the yarp::os::Timer object and starts it.
Definition:
mcEventDownsampler.cpp:62
mced::mcEventDownsampler::mcEventDownsampler
mcEventDownsampler()
Construct a new Event Downsampler object and instantiates the mutex needed by the timer.
Definition:
mcEventDownsampler.cpp:11
mced::mcEventDownsampler::canprint
bool canprint()
Called by the object that implements the downsampler.
Definition:
mcEventDownsampler.cpp:30
mced::mcEventDownsampler::stop
bool stop()
Stops the timer.
Definition:
mcEventDownsampler.cpp:50
mced::mcEventDownsampler::config
Config config
Definition:
mcEventDownsampler.h:63
mced
Definition:
mcEventDownsampler.cpp:7
mced::mcEventDownsampler::Config
Definition:
mcEventDownsampler.h:26
mced::mcEventDownsampler::Config::subcomponent
std::string subcomponent
Definition:
mcEventDownsampler.h:29
mced::mcEventDownsampler::Config::period
double period
Definition:
mcEventDownsampler.h:27
mced::mcEventDownsampler::Config::threshold
size_t threshold
Definition:
mcEventDownsampler.h:28
mced::mcEventDownsampler::Config::info
std::string info
Definition:
mcEventDownsampler.h:30
Generated on Wed Nov 13 2024 21:11:40 for iCub-main by
1.9.1