25 #ifndef OLA_OLACLIENTWRAPPER_H_
26 #define OLA_OLACLIENTWRAPPER_H_
28 #include <ola/AutoStart.h>
31 #include <ola/client/OlaClient.h>
32 #include <ola/io/SelectServer.h>
34 #include <ola/network/TCPSocket.h>
88 std::auto_ptr<ola::network::TCPSocket> m_socket;
92 std::auto_ptr<CloseCallback> m_close_callback;
94 virtual void CreateClient() = 0;
95 virtual bool StartupClient() = 0;
96 virtual void InitSocket() = 0;
103 template <
typename ClientClass>
108 m_auto_start(auto_start) {
115 ClientClass *
GetClient()
const {
return m_client.get(); }
118 std::auto_ptr<ClientClass> m_client;
121 void CreateClient() {
122 if (!m_client.get()) {
123 m_client.reset(
new ClientClass(m_socket.get()));
127 bool StartupClient() {
128 bool ok = m_client->Setup();
129 m_client->SetCloseHandler(
139 m_socket.reset(ola::network::TCPSocket::Connect(
144 m_socket->SetNoDelay();
162 #endif // OLA_OLACLIENTWRAPPER_H_