ClientSocketHandle.ih
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 ClientSocketHandle internal header */
16 
17 #ifndef IH_SENF_Socket_ClientSocketHandle_
18 #define IH_SENF_Socket_ClientSocketHandle_ 1
19 
20 // Custom includes
21 #include <senf/Utils/IteratorTraits.hh>
22 
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 namespace senf {
26 namespace detail {
27 
28  //-/////////////////////////////////////////////////////////////////////////////////////////////
29  // senf::detail::ReadRange
30 
31  /** \brief Internal: Choose optimal read implementation
32 
33  \internal
34 
35  If the range iterator is a contiguous_storage_iterator, the data is *directly* read into the
36  range, otherwise a temporary storage area is used.
37  */
38  template <class Handle, class ForwardWritableRange, bool IsContiguous>
39  struct ReadRange
40  {
41  static typename boost::range_iterator<ForwardWritableRange>::type
42  read(Handle & handle, ForwardWritableRange & range);
43 
44  static typename boost::range_iterator<ForwardWritableRange>::type
45  readfrom(Handle & handle, ForwardWritableRange & range, typename Handle::Address & addr);
46  };
47 
48 # ifndef DOXYGEN
49 
50  template <class Handle, class ForwardWritableRange>
51  struct ReadRange<Handle, ForwardWritableRange, true>
52  {
53  static typename boost::range_iterator<ForwardWritableRange>::type
54  read(Handle & handle, ForwardWritableRange & range);
55 
56  static typename boost::range_iterator<ForwardWritableRange>::type
57  readfrom(Handle & handle, ForwardWritableRange & range, typename Handle::Address & addr);
58  };
59 
60 # endif
61 
62  //-/////////////////////////////////////////////////////////////////////////////////////////////
63  // senf::detail::WriteRange
64 
65  /** \brief Internal: Choose optimal write implementation
66 
67  \internal
68 
69  If the range iterator is a contiguous_storage_iterator, the data is *directly* written from
70  the range, otherwise a temporary storage area is used.
71  */
72  template <class Handle, class ForwardReadableRange, bool IsContiguous>
73  struct WriteRange
74  {
75  static typename boost::range_const_iterator<ForwardReadableRange>::type
76  write(Handle & handle, ForwardReadableRange & range);
77 
78  static typename boost::range_const_iterator<ForwardReadableRange>::type
79  writeto(Handle & handle, ForwardReadableRange & range,
80  typename Handle::Address const & addr);
81  };
82 
83 # ifndef DOXYGEN
84 
85  template <class Handle, class ForwardReadableRange>
86  struct WriteRange<Handle, ForwardReadableRange, true>
87  {
88  static typename boost::range_const_iterator<ForwardReadableRange>::type
89  write(Handle & handle, ForwardReadableRange & range);
90 
91  static typename boost::range_const_iterator<ForwardReadableRange>::type
92  writeto(Handle & handle, ForwardReadableRange & range,
93  typename Handle::Address const & addr);
94  };
95 
96 # endif
97 
98 }}
99 
100 //-/////////////////////////////////////////////////////////////////////////////////////////////////
101 #endif
102 
103 
104 // Local Variables:
105 // mode: c++
106 // fill-column: 100
107 // c-file-style: "senf"
108 // indent-tabs-mode: nil
109 // ispell-local-dictionary: "american"
110 // compile-command: "scons -u test"
111 // comment-column: 40
112 // End: