QApolloSocketClient.hh

00001 /*
00002  * @class QApolloSocketClient
00003  * @file QApolloSocketClient.hh
00004  * @author Elena Guardincerri
00005  * @brief generic socket client
00006  */
00007 
00008 #ifndef _QAPOLLOSOCKETCLIENT_HH_
00009 #define _QAPOLLOSOCKETCLIENT_HH_
00010 
00011 // Apollo Includes
00012 #include "QCuore.hh"
00013 
00014 // C/C++ Includes
00015 #include <string>
00016 
00017 class QApolloSocketClient {
00018 
00019 public:
00020   
00022   QApolloSocketClient();
00024   QApolloSocketClient(const std::string& address, const std::string& port);
00025   
00026   // dtor
00027   virtual ~QApolloSocketClient();
00028   
00033   int Open();
00034 
00035   // Close Socket Connection
00036   bool Close();
00037 
00038   // Write Command
00039   bool Write(const char*, int len);
00040   bool Write(const std::string& Cmd);
00041 
00048    int ReadLine(char* data, int max_len) const;
00049    
00057    std::string Read() const;
00058 
00059    inline const std::string& GetServerPort()    const {return fServerPort;}
00060    inline const std::string& GetServerAddress() const {return fServerAddress;}
00061 
00062    inline void SetServerPort   (const std::string& s) {fServerPort = s;}
00063    inline void SetServerAddress(const std::string& s) {fServerAddress = s;}
00064   
00065 protected:
00066    int socketDescr;
00067 
00068 private:  
00069   std::string fServerAddress;
00070   std::string fServerPort;
00071 };
00072 
00073 #endif // _QAPOLLOSOCKETCLIENT_HH_

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1