acl/lib_acl_cpp/include/acl_cpp/connpool/connect_client.hpp

78 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "../stdlib/noncopyable.hpp"
2014-11-19 00:25:21 +08:00
namespace acl
{
class connect_pool;
class ACL_CPP_API connect_client : public noncopyable
2014-11-19 00:25:21 +08:00
{
public:
connect_client() : when_(0), pool_(NULL) {}
virtual ~connect_client() {}
/**
* 使
2014-11-19 00:25:21 +08:00
* @return {time_t}
*/
time_t get_when()
{
return when_;
}
/**
* 使
2014-11-19 00:25:21 +08:00
*/
void set_when(time_t when)
{
when_ = when;
}
/**
*
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
virtual bool open() = 0;
/**
* connect_pool
* set_pool
2014-11-19 00:25:21 +08:00
* @return {connect_pool*}
*/
connect_pool* get_pool() const
{
return pool_;
}
public:
/**
* IO
* 便
* @param conn_timeout {int} ()
* @param rw_timeout {int} IO ()
*/
virtual void set_timeout(int conn_timeout, int rw_timeout)
{
conn_timeout_ = conn_timeout;
rw_timeout_ = rw_timeout;
}
protected:
int conn_timeout_;
int rw_timeout_;
2014-11-19 00:25:21 +08:00
friend class connect_pool;
time_t when_;
connect_pool* pool_;
void set_pool(connect_pool* pool)
{
pool_ = pool;
}
};
} // namespace acl