00001 #ifndef CliOutputReceiveThread_h
00002 #define CliOutputReceiveThread_h
00003
00004 #include <string>
00005 #include <cc++/thread.h>
00006 #include <mpi.h>
00007 #include <sstream>
00008
00009 #ifdef CCXX_NAMESPACES
00010 using namespace std;
00011 using namespace ost;
00012 #endif
00013
00014 namespace BIE {
00015
00017 class CliOutputReceiveThread: public Thread {
00018 public:
00020 CliOutputReceiveThread(string hostname, int port, Semaphore *consumer);
00022 CliOutputReceiveThread(int socketid, Semaphore *consumer);
00024 ~CliOutputReceiveThread();
00025
00027 void run();
00029 istream *getReply();
00031 Semaphore *getSemaphore();
00033 Semaphore *setConsumerSemaphore(Semaphore *consumer) {return (_consumer = consumer);};
00035 bool isReady(){return _isReady;};
00037 void setStop() {_stop=true;}
00038
00039 private:
00040 int readReply();
00041 void initialize(Semaphore *consumer);
00042
00043 char *_hname;
00044 int _port;
00045 int _socketid;
00046 char *_receiveBuffer;
00047 int _receiveBufferSize;
00048 Semaphore *_qsem;
00049 Semaphore *_consumer;
00050 bool _stop, _isReady;
00051 int _size;
00052 };
00053 }
00054 #endif