WriteHelper.cti
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 WriteHelper inline template implementation */
16 
17 //#include "WriteHelper.ih"
18 
19 // Custom includes
20 #include <senf/Utils/Exception.hh>
21 
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 template <class Handle>
26 prefix_ typename senf::WriteHelper<Handle>::ptr
27 senf::WriteHelper<Handle>::dispatch(Handle handle, std::string const & data, Callback callback)
28 {
29  return ptr(new WriteHelper(handle, data, callback));
30 }
31 
32 template <class Handle>
33 prefix_ Handle senf::WriteHelper<Handle>::handle()
34  const
35 {
36  return handle_;
37 }
38 
39 template <class Handle>
40 prefix_ bool senf::WriteHelper<Handle>::complete()
41  const
42 {
43  return data_.empty();
44 }
45 
46 template <class Handle>
47 prefix_ bool senf::WriteHelper<Handle>::error()
48  const
49 {
50  return errno_ != 0;
51 }
52 
53 template <class Handle>
54 prefix_ void senf::WriteHelper<Handle>::throw_error()
55  const
56 {
57  if (errno_ != 0)
58  throw SystemException(errno_ SENF_EXC_DEBUGINFO);
59 }
60 
61 
62 //-/////////////////////////////////////////////////////////////////////////////////////////////////
63 #undef prefix_
64 
65 
66 // Local Variables:
67 // mode: c++
68 // fill-column: 100
69 // c-file-style: "senf"
70 // indent-tabs-mode: nil
71 // ispell-local-dictionary: "american"
72 // compile-command: "scons -u test"
73 // comment-column: 40
74 // End: