21 #ifndef _PORTSFREQUENCY_H_
22 #define _PORTSFREQUENCY_H_
24 #include <yarp/robottestingframework/TestCase.h>
25 #include <yarp/os/BufferedPort.h>
26 #include <yarp/os/Bottle.h>
32 unsigned int frequency;
33 unsigned int tolerance;
37 class DataPort :
public yarp::os::BufferedPort<yarp::os::Bottle> {
40 max = smax = sum = ssum = dmax = dsum = 0.0;
41 min = smin = dmin = -1.0;
48 double getMax() {
return max; }
49 double getMin() {
return min; }
50 double getAvg() {
return sum/count; }
51 double getSMax() {
return smax; }
52 double getSMin() {
return smin; }
53 double getSAvg() {
return ssum/count; }
54 double getDMax() {
return dmax; }
55 double getDMin() {
return dmin; }
56 double getDAvg() {
return dsum/count; }
57 unsigned long getPacketLostCount() {
return packetLostCount; }
58 unsigned long getCount() {
return count; }
60 virtual void onRead(yarp::os::Bottle& bot);
63 unsigned long count, packetLostCount;
64 unsigned long prevPacketCount;
67 double smax, smin, ssum;
68 double dmax, dmin, dsum;
71 class PortsFrequency :
public yarp::robottestingframework::TestCase {
74 virtual ~PortsFrequency();
76 virtual bool setup(yarp::os::Property& property);
78 virtual void tearDown();
84 std::vector<MyPortInfo> ports;