25 #ifndef OLA_OLACLIENTWRAPPER_H_
26 #define OLA_OLACLIENTWRAPPER_H_
28 #include <ola/AutoStart.h>
30 #include <ola/client/OlaClient.h>
31 #include <ola/io/SelectServer.h>
33 #include <ola/network/TCPSocket.h>
55 std::auto_ptr<ola::network::TCPSocket> m_socket;
60 virtual void CreateClient() = 0;
61 virtual bool StartupClient() = 0;
62 virtual void InitSocket() = 0;
69 template <
typename ClientClass>
74 m_auto_start(auto_start) {
78 ClientClass *GetClient()
const {
return m_client.get(); }
81 std::auto_ptr<ClientClass> m_client;
85 if (!m_client.get()) {
86 m_client.reset(
new ClientClass(m_socket.get()));
90 bool StartupClient() {
91 bool ok = m_client->Setup();
92 m_client->SetCloseHandler(
94 &BaseClientWrapper::SocketClosed));
102 m_socket.reset(ola::network::TCPSocket::Connect(
107 m_socket->SetNoDelay();
119 #endif // OLA_OLACLIENTWRAPPER_H_