QFileDescriptor.hh

Go to the documentation of this file.
00001 
00002 #ifndef _BASE_DESCRIPTOR_HH_
00003 #define _BASE_DESCRIPTOR_HH_
00004 
00005 #include <unistd.h>
00006 
00007 #include "QCuore.hh"
00008 
00013 #define MAX_COMMAND_LEN 102400 // 100*2^10
00014 
00015 class QDescriptorList;
00016 
00037 class QFileDescriptor
00038 {
00039 public:  
00041    QFileDescriptor() : fFds( -1 ), fNext(NULL), fBuffer(NULL) {}
00042    
00044    QFileDescriptor(int fds);
00045    
00047    virtual ~QFileDescriptor();
00048    
00050    int FileDescriptor() const {return fFds;}
00051    
00058    virtual int HandleCommand(QDescriptorList& descrList);
00059    
00061    void SetNext(QFileDescriptor* Next) { fNext=Next; }
00062    
00064    QFileDescriptor* Next() const { return fNext; }
00065    
00075    virtual int Write(const char* message) const;
00076 
00077    
00085    virtual int Write(const char* message, size_t msgSize) const;
00086 
00093    virtual int Read(char* buff, int max_ch) const;
00094    
00095 protected:
00097    void SetFileDescriptor(int fds) {fFds = fds;}
00098    
00100    char* Buffer() { return fBuffer; }
00101 
00102 private:
00103    int fFds;                  
00104    QFileDescriptor* fNext;    
00105    char* fBuffer;             
00106    int   fNextChar;           
00111    int   fNlOffset;
00112    
00119    bool FindCompleteCommand();
00120 
00130    int FillBuffer();
00131    
00139    void DoParse(const char* Cmd);
00140 };
00141 
00142 #endif // _BASE_DESCRIPTOR_HH_

Generated on Tue Nov 16 10:49:56 2010 for CUORE Software by  doxygen 1.5.6