iCub-main
fakeBoard.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 RobotCub Consortium
3  * Author: Lorenzo Natale
4  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
5  *
6  */
7 
8 #ifndef __FAKEBOARD__
9 #define __FAKEBOARD__
10 
11 #include <yarp/os/PeriodicThread.h>
12 #include "msgList.h"
13 
14 class FakeBoard: public yarp::os::PeriodicThread
15 {
16  int canId;
17  MsgList inMessages;
18  MsgList *outMessages;
19 
20 public:
21  FakeBoard(int id=0, int p=100);
22 
23  ~FakeBoard();
24 
25  bool threadInit();
26 
27  void threadRelease();
28 
29  void setId(int id)
30  {
31  canId=id;
32  }
33 
34  void setReplyFifo(MsgList *outBuffer)
35  {
36  outMessages=outBuffer;
37  }
38 
39  void pushMessage(const FCMSG &msg)
40  {
41  inMessages.lock();
42  inMessages.push_back(msg);
43  inMessages.unlock();
44  }
45 
46  void run();
47 };
48 
49 #endif
void pushMessage(const FCMSG &msg)
Definition: fakeBoard.h:39
bool threadInit()
Definition: fakeBoard.cpp:127
void setReplyFifo(MsgList *outBuffer)
Definition: fakeBoard.h:34
void setId(int id)
Definition: fakeBoard.h:29
void threadRelease()
Definition: fakeBoard.cpp:133
void run()
Definition: fakeBoard.cpp:27
FakeBoard(int id=0, int p=100)
Definition: fakeBoard.cpp:16
void lock()
Definition: msgList.h:24
void unlock()
Definition: msgList.h:25