SocketHandle.cci
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief SocketHandle inline non-template implementation
16  */
17 
18 #include "SocketHandle.ih"
19 
20 // Custom includes
21 #include "SocketProtocol.hh"
22 
23 #define prefix_ inline
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 prefix_ senf::SocketBody::SocketBody(bool isServer)
27  : isServer_(isServer)
28 {}
29 
30 prefix_ senf::SocketBody::SocketBody(bool isServer, int fd)
31  : FileBody(fd), isServer_(isServer)
32 {}
33 
34 prefix_ senf::SocketProtocol & senf::SocketBody::protocol()
35  const
36 {
37  return const_cast<SocketProtocol &>(v_protocol());
38 }
39 
40 prefix_ bool senf::SocketBody::isServer()
41 {
42  return isServer_;
43 }
44 
45 prefix_ std::unique_ptr<senf::SocketBody> senf::SocketBody::clone(bool isServer)
46  const
47 {
48  return protocol().clone(isServer);
49 }
50 
51 prefix_ std::unique_ptr<senf::SocketBody> senf::SocketBody::clone(int fd, bool isServer)
52  const
53 {
54  return protocol().clone(fd, isServer);
55 }
56 
57 //-/////////////////////////////////////////////////////////////////////////////////////////////////
58 // senf::detail::StreamableString
59 
60 prefix_ senf::detail::StreamableString & senf::detail::StreamableString::operator<<(bool v)
61 {
62  return (*this) << std::string(v ? "true" : "false");
63 }
64 
65 //-/////////////////////////////////////////////////////////////////////////////////////////////////
66 #undef prefix_
67 
68 
69 // Local Variables:
70 // mode: c++
71 // fill-column: 100
72 // c-file-style: "senf"
73 // indent-tabs-mode: nil
74 // ispell-local-dictionary: "american"
75 // compile-command: "scons -u test"
76 // comment-column: 40
77 // End: