Beispiel #1
0
 virtual void onRead(VelocityBuffer & data){
     VelocityBuffer * vb = new VelocityBuffer();
     vb->setData(data);
     bfrMutex.wait();
     velBfr.push(vb);
     bfrMutex.post();
 }
Beispiel #2
0
     VelocityBuffer *  getVelocities(){
         VelocityBuffer * res = NULL;
         bfrMutex.wait();
         if (velBfr.size() > 0){
            res = velBfr.front();
            velBfr.pop();
         }
         bfrMutex.post();
         return res;

     }
Beispiel #3
0
  virtual bool apply(yarp::os::Bottle& cmd, 
		     yarp::os::Bottle& reply, 
		     yarp::os::Bottle& event,
		     yarp::os::Contact& remote) {
    bool ok = false;
    mutex.wait();
    printf(" + %s\n", cmd.toString().c_str());
    reply.clear();
    ConstString tag = cmd.get(0).asString();
    if (tag=="register") {
      ok = cmdRegister(cmd,reply,remote);
    } else if (tag=="unregister") {
      ok = cmdUnregister(cmd,reply,remote);
    } else if (tag=="query") {
      ok = cmdQuery(cmd,reply,remote);
    } else if (tag=="list") {
      ok = cmdList(cmd,reply,remote);
    } else {
      reply.addString("old");
      reply.addString("I have no idea what you are talking about");
    }
    mutex.post();
    return ok;
  }