00001
00002
00003
00004
00005
00006
00007
00008 #ifndef RESPONSEREADER_H
00009 #define RESPONSEREADER_H
00010
00011
00012
00013 namespace annotatorcomm
00014 {
00015 class AnnotatorComm;
00016 class ResponseReader;
00017 }
00018
00019
00020
00021 #include <pthread.h>
00022
00023 #include "AnnotatorCommApi.h"
00024 #include "AnnotatorComm.h"
00025 #include "InputStream.h"
00026
00027 using namespace std;
00028
00029
00030
00031 namespace annotatorcomm
00032 {
00033
00039 class ANNCOMM_API ResponseReader
00040 {
00041 public:
00048 ResponseReader(AnnotatorComm* annotator, InputStream* in);
00049
00053 virtual ~ResponseReader();
00054
00058 void close();
00059
00063 void run();
00064
00065 private:
00069 AnnotatorComm* annotator;
00070
00074 InputStream* in;
00075
00079 volatile bool isOpen;
00080
00084 pthread_t thread;
00085
00092 ResponseMessage readResponseMessage() throw(IOException);
00093
00099 void readStx() throw(IOException);
00100
00107 int read() throw(IOException);
00108
00118 int read(vector<uint8_t> & buffer, int offset, int length) throw(IOException);
00119 };
00120
00121 }
00122
00123
00124
00125 #endif