~vibhavp/ubuntu/saucy/urg/merge-from-debian

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef QRK_TCPIP_SOCKET_H
#define QRK_TCPIP_SOCKET_H

/*!
  \file
  \brief TCP/IP ’ʐM

  \author Satofumi KAMIMURA

  $Id: TcpipSocket.h 1817 2010-05-09 09:04:32Z satofumi $
*/

#include "Connection.h"
#include <string>
#include <memory>


namespace qrk
{
    class SocketSet;


    //! TCP/IP ’ʐM
    class TcpipSocket : public Connection
    {
    public:
        TcpipSocket(void);


        /*!
          \brief ƒRƒ“ƒXƒgƒ‰ƒNƒ^

          \param[in] socket ’ʐMƒ\ƒPƒbƒg
        */
        TcpipSocket(void* socket);


        /*!
          \brief ƒRƒ“ƒXƒgƒ‰ƒNƒ^

          \param[in] socket_set ’ʐMƒ\ƒPƒbƒgŠÇ—
          \param[in] socket ’ʐMƒ\ƒPƒbƒg
        */
        TcpipSocket(SocketSet* socket_set, void* socket = NULL);

        ~TcpipSocket(void);

        const char* what(void) const;

        bool connect(const char* host, long port);
        void disconnect(void);
        bool setBaudrate(long baudrate);
        long baudrate(void) const;
        bool isConnected(void) const;
        int send(const char* data, size_t count);
        int receive(char* data, size_t count, int timeout);
        size_t size(void) const;
        void flush(void);
        void clear(void);
        void ungetc(const char ch);

    private:
        TcpipSocket(const TcpipSocket& rhs);
        TcpipSocket& operator = (const TcpipSocket& rhs);

        struct pImpl;
        const std::auto_ptr<pImpl> pimpl;
    };
}

#endif /* !QRK_TCPIP_SOCKET_H */