3d0ca443e55c853ebc22afb4890706854166b89c
[senf.git] / senf / Socket / ClientSocketHandle.ih
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief ClientSocketHandle internal header */
25
26 #ifndef IH_SENF_Socket_ClientSocketHandle_
27 #define IH_SENF_Socket_ClientSocketHandle_ 1
28
29 // Custom includes
30 #include <senf/Utils/IteratorTraits.hh>
31
32 //-/////////////////////////////////////////////////////////////////////////////////////////////////
33
34 namespace senf {
35 namespace detail {
36
37     //-/////////////////////////////////////////////////////////////////////////////////////////////
38     // senf::detail::ReadRange
39
40     /** \brief Internal: Choose optimal read implementation
41
42         \internal
43
44         If the range iterator is a contiguous_storage_iterator, the data is *directly* read into the
45         range, otherwise a temporary storage area is used.
46      */
47     template <class Handle, class ForwardWritableRange, bool IsContiguous>
48     struct ReadRange
49     {
50         static typename boost::range_iterator<ForwardWritableRange>::type
51         read(Handle & handle, ForwardWritableRange & range);
52
53         static typename boost::range_iterator<ForwardWritableRange>::type
54         readfrom(Handle & handle, ForwardWritableRange & range, typename Handle::Address & addr);
55     };
56
57 #   ifndef DOXYGEN
58
59     template <class Handle, class ForwardWritableRange>
60     struct ReadRange<Handle, ForwardWritableRange, true>
61     {
62         static typename boost::range_iterator<ForwardWritableRange>::type
63         read(Handle & handle, ForwardWritableRange & range);
64
65         static typename boost::range_iterator<ForwardWritableRange>::type
66         readfrom(Handle & handle, ForwardWritableRange & range, typename Handle::Address & addr);
67     };
68
69 #   endif
70
71     //-/////////////////////////////////////////////////////////////////////////////////////////////
72     // senf::detail::WriteRange
73
74     /** \brief Internal: Choose optimal write implementation
75
76         \internal
77
78         If the range iterator is a contiguous_storage_iterator, the data is *directly* written from
79         the range, otherwise a temporary storage area is used.
80      */
81     template <class Handle, class ForwardReadableRange, bool IsContiguous>
82     struct WriteRange
83     {
84         static typename boost::range_const_iterator<ForwardReadableRange>::type
85         write(Handle & handle, ForwardReadableRange & range);
86
87         static typename boost::range_const_iterator<ForwardReadableRange>::type
88         writeto(Handle & handle, ForwardReadableRange & range,
89                 typename Handle::Address const & addr);
90     };
91
92 #   ifndef DOXYGEN
93
94     template <class Handle, class ForwardReadableRange>
95     struct WriteRange<Handle, ForwardReadableRange, true>
96     {
97         static typename boost::range_const_iterator<ForwardReadableRange>::type
98         write(Handle & handle, ForwardReadableRange & range);
99
100         static typename boost::range_const_iterator<ForwardReadableRange>::type
101         writeto(Handle & handle, ForwardReadableRange & range,
102                 typename Handle::Address const & addr);
103     };
104
105 #   endif
106
107 }}
108
109 //-/////////////////////////////////////////////////////////////////////////////////////////////////
110 #endif
111
112 \f
113 // Local Variables:
114 // mode: c++
115 // fill-column: 100
116 // c-file-style: "senf"
117 // indent-tabs-mode: nil
118 // ispell-local-dictionary: "american"
119 // compile-command: "scons -u test"
120 // comment-column: 40
121 // End: