SerUt  1.1.1 (development version)
tcpserializer.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of SerUt, a library containing some serialization
4  utilities.
5 
6  Copyright (C) 2008-2018 Jori Liesenborgs
7 
8  Contact: jori.liesenborgs@gmail.com
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23  USA
24 
25 */
26 
31 #ifndef SERUT_TCPSERIALIZER_H
32 
33 #define SERUT_TCPSERIALIZER_H
34 
35 #include "serutconfig.h"
36 #include "serializationinterface.h"
37 #include <time.h>
38 
39 namespace nut
40 {
41  class TCPSocket;
42 }
43 
44 namespace serut
45 {
46 
48 class SERUT_IMPORTEXPORT TCPSerializer : public SerializationInterface
49 {
50 public:
57  TCPSerializer(nut::TCPSocket *pSocket, bool deleteSocket);
58 
59  ~TCPSerializer();
60 
62  nut::TCPSocket *getSocket() { return m_pSocket; }
63 
64  bool readBytes(void *pBuffer, size_t amount);
65  bool writeBytes(const void *pBuffer, size_t amount);
66 private:
67  nut::TCPSocket *m_pSocket;
68  bool m_deleteSocket;
69 };
70 
71 } // end namespace
72 
73 #endif // SERUT_TCPSERIALIZER_H
Generic serialization interface.
Definition: serializationinterface.h:58
Serializer which can be used to read from and write to a TCP connection.
Definition: tcpserializer.h:49
nut::TCPSocket * getSocket()
Returns the socket which is being used for communication.
Definition: tcpserializer.h:62
TCPSerializer(nut::TCPSocket *pSocket, bool deleteSocket)
Construct an instance.