25 #ifndef OLA_OLACLIENTWRAPPER_H_
26 #define OLA_OLACLIENTWRAPPER_H_
28 #include <ola/AutoStart.h>
29 #include <ola/OlaClient.h>
30 #include <ola/OlaCallbackClient.h>
31 #include <ola/io/SelectServer.h>
32 #include <ola/network/SocketAddress.h>
33 #include <ola/network/TCPSocket.h>
57 auto_ptr<TCPSocket> m_socket;
62 virtual void CreateClient() = 0;
63 virtual bool StartupClient() = 0;
64 virtual void InitSocket() = 0;
71 template <
typename ClientClass>
76 m_auto_start(auto_start) {
80 ClientClass *GetClient()
const {
return m_client.get(); }
83 auto_ptr<ClientClass> m_client;
87 if (!m_client.get()) {
88 m_client.reset(
new ClientClass(m_socket.get()));
92 bool StartupClient() {
93 bool ok = m_client->Setup();
94 m_client->SetCloseHandler(
96 &BaseClientWrapper::SocketClosed));
104 m_socket.reset(TCPSocket::Connect(
106 ola::network::IPV4Address::Loopback(),
109 m_socket->SetNoDelay();
120 #endif // OLA_OLACLIENTWRAPPER_H_