20#ifndef __THREADTABLE2__
21#define __THREADTABLE2__
24#include <condition_variable>
25#include <ace/config.h>
26#include <ace/Thread.h>
27#include <yarp/dev/CanBusInterface.h>
37 yarp::dev::CanBuffer _replies;
38 yarp::dev::ICanBufferFactory *ic;
40 std::condition_variable cv_synch;
59 void init(yarp::dev::ICanBufferFactory *i);
68 std::unique_lock<std::mutex> lck(mtx_synch);
76 bool ret=(_pending != 0) ?
true:
false;
85 bool ret=(_timedOut!=0)?
true:
false;
97 inline bool push(
const yarp::dev::CanMessage &m);
104 inline yarp::dev::CanMessage *
getByJoint(
int j,
const unsigned char *destInv);
107 inline yarp::dev::CanMessage *
get(
int n);
112 if (n<0 || n>=_replied)
120 for(
int k=0;k<_replied;k++)
121 if (
getJoint(_replies[k], destInv)==j)
139 fprintf(stderr,
"Warning: buffer full in ThreadTable2, increase value of BUF_SIZE\n");
143 _replies[_replied]=m;
148 cv_synch.notify_one();
162 cv_synch.notify_one();
int getJoint(const yarp::dev::CanMessage &m, const unsigned char *invM)
Extract the joint number to which a RECEIVED message is referring to.
yarp::dev::CanMessage * getByJoint(int j, const unsigned char *destInv)
bool push(const yarp::dev::CanMessage &m)
void init(yarp::dev::ICanBufferFactory *i)
void setPending(int pend)
yarp::dev::CanMessage * get(int n)