00001
00008 #ifndef _Q_BASE_CLIENT_HH_
00009 #define _Q_BASE_CLIENT_HH_
00010
00011 #include "QCuore.hh"
00012 #include "QApolloSocketClient.hh"
00013 #include "QError.hh"
00014
00015 #include <string>
00016
00017 class QBaseClient: protected QApolloSocketClient
00018 {
00019 public:
00020
00022 virtual ~QBaseClient();
00023
00030 void SetConnectionMode(bool alwaysOpen) { fConnMode = alwaysOpen;}
00031
00037 bool GetConnectionMode() const { return fConnMode; }
00038
00040 const QError& GetError() const { return fError; }
00041
00042 protected:
00051 QBaseClient(const std::string& serverType);
00052
00058 QBaseClient(const std::string& address, const std::string& port);
00059
00066 bool fConnMode;
00067
00068 QError fError;
00069
00077 bool ExecCmdNoResponse(const std::string& command, std::string& answer);
00078
00086 bool ExecSetCommand(const std::string& command, std::string& answer);
00087
00095 bool ExecStartCommand(const std::string& command, std::string& answer);
00096
00097
00105 bool ExecGetCommand(const std::string& command, std::string& answer);
00106
00114 bool ReturnInt(const std::string& command, int& answer);
00115
00123 bool ReturnDouble(const std::string& command, double& answer);
00124
00132 bool ReturnBool(const std::string& command, bool& answer);
00133
00141 bool ReturnString(const std::string& command, std::string& answer);
00142
00149 bool CompleteCommand(std::string& command);
00150
00151
00156 void BuildError(std::string answer);
00157
00158 };
00159
00160 #endif