30 #ifndef INCLUDE_OLA_CLIENT_CLIENTWRAPPER_H_
31 #define INCLUDE_OLA_CLIENT_CLIENTWRAPPER_H_
33 #include <ola/AutoStart.h>
35 #include <ola/client/OlaClient.h>
36 #include <ola/io/SelectServer.h>
38 #include <ola/network/TCPSocket.h>
92 std::auto_ptr<ola::network::TCPSocket> m_socket;
96 std::auto_ptr<CloseCallback> m_close_callback;
98 virtual void CreateClient() = 0;
99 virtual bool StartupClient() = 0;
100 virtual void InitSocket() = 0;
107 template <
typename ClientClass>
112 m_auto_start(auto_start) {
119 ClientClass *
GetClient()
const {
return m_client.get(); }
122 std::auto_ptr<ClientClass> m_client;
125 void CreateClient() {
126 if (!m_client.get()) {
127 m_client.reset(
new ClientClass(m_socket.get()));
131 bool StartupClient() {
132 bool ok = m_client->Setup();
133 m_client->SetCloseHandler(
143 m_socket.reset(ola::network::TCPSocket::Connect(
148 m_socket->SetNoDelay();
159 #endif // INCLUDE_OLA_CLIENT_CLIENTWRAPPER_H_