switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Scheduler / WriteHelper.cti
1 // $Id$
2 //
3 // Copyright (C) 2006 Stefan Bund <g0dil@berlios.de>
4 //
5 // The contents of this file are subject to the Fraunhofer FOKUS Public License
6 // Version 1.0 (the "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at 
8 // http://senf.berlios.de/license.html
9 //
10 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
11 // but modifies the Mozilla Public License Version 1.1.
12 // See the full license text for the amendments.
13 //
14 // Software distributed under the License is distributed on an "AS IS" basis, 
15 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
16 // for the specific language governing rights and limitations under the License.
17 //
18 // The Original Code is Fraunhofer FOKUS code.
19 //
20 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
21 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
22 // All Rights Reserved.
23 //
24 // Contributor(s):
25
26 // Copyright (C) 2006
27 /** \file
28     \brief WriteHelper inline template implementation */
29
30 //#include "WriteHelper.ih"
31
32 // Custom includes
33 #include <senf/Utils/Exception.hh>
34
35 #define prefix_ inline
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37
38 template <class Handle>
39 prefix_ typename senf::WriteHelper<Handle>::ptr
40 senf::WriteHelper<Handle>::dispatch(Handle handle, std::string const & data, Callback callback)
41 {
42     return ptr(new WriteHelper(handle, data, callback));
43 }
44
45 template <class Handle>
46 prefix_ Handle senf::WriteHelper<Handle>::handle()
47     const
48 {
49     return handle_;
50 }
51
52 template <class Handle>
53 prefix_ bool senf::WriteHelper<Handle>::complete()
54     const
55 {
56     return data_.empty();
57 }
58
59 template <class Handle>
60 prefix_ bool senf::WriteHelper<Handle>::error()
61     const
62 {
63     return errno_ != 0;
64 }
65
66 template <class Handle>
67 prefix_ void senf::WriteHelper<Handle>::throw_error()
68     const
69 {
70     if (errno_ != 0)
71         throw SystemException(errno_ SENF_EXC_DEBUGINFO);
72 }
73
74
75 //-/////////////////////////////////////////////////////////////////////////////////////////////////
76 #undef prefix_
77
78 \f
79 // Local Variables:
80 // mode: c++
81 // fill-column: 100
82 // c-file-style: "senf"
83 // indent-tabs-mode: nil
84 // ispell-local-dictionary: "american"
85 // compile-command: "scons -u test"
86 // comment-column: 40
87 // End: