Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ReadHelper.cti

Go to the documentation of this file.
00001 // $Id: ReadHelper.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2006 Stefan Bund <g0dil@berlios.de>
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the
00017 // Free Software Foundation, Inc.,
00018 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 // Copyright (C) 2006
00020 
00024 #include "ReadHelper.ih"
00025 
00026 // Custom includes
00027 #include <senf/Utils/Exception.hh>
00028 
00029 #define prefix_ inline
00030 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00031 
00032 template <class Handle>
00033 prefix_ typename senf::ReadHelper<Handle>::ptr
00034 senf::ReadHelper<Handle>::dispatch(Handle handle, std::string::size_type maxSize,
00035                                           Callback callback)
00036 {
00037     return ptr(new ReadHelper(handle, maxSize, 0, callback));
00038 }
00039 
00040 template <class Handle>
00041 template <class Predicate>
00042 prefix_ typename senf::ReadHelper<Handle>::ptr
00043 senf::ReadHelper<Handle>::dispatch(Handle handle, std::string::size_type maxSize,
00044                                    Predicate const & predicate, Callback callback)
00045 {
00046     return ptr(new ReadHelper(handle, maxSize,
00047                               new typename InternalPredicate::template Dispatcher<Predicate>(predicate),
00048                               callback));
00049 }
00050 
00051 template <class Handle>
00052 prefix_ Handle senf::ReadHelper<Handle>::handle()
00053     const
00054 {
00055     return handle_;
00056 }
00057 
00058 template <class Handle>
00059 prefix_ std::string::size_type senf::ReadHelper<Handle>::maxSize()
00060     const
00061 {
00062     return maxSize_;
00063 }
00064 
00065 template <class Handle>
00066 prefix_ std::string const & senf::ReadHelper<Handle>::data()
00067     const
00068 {
00069     return data_;
00070 }
00071 
00072 template <class Handle>
00073 prefix_ std::string const & senf::ReadHelper<Handle>::tail()
00074     const
00075 {
00076     return tail_;
00077 }
00078 
00079 template <class Handle>
00080 prefix_ bool senf::ReadHelper<Handle>::complete()
00081     const
00082 {
00083     return complete_;
00084 }
00085 
00086 template <class Handle>
00087 prefix_ bool senf::ReadHelper<Handle>::error()
00088     const
00089 {
00090     return errno_ != 0;
00091 }
00092 
00093 template <class Handle>
00094 prefix_ void senf::ReadHelper<Handle>::throw_error()
00095     const
00096 {
00097     if (errno_ != 0) throw SystemException(errno_ SENF_EXC_DEBUGINFO);
00098 }
00099 
00100 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00101 #undef prefix_
00102 
00103 
00104 // Local Variables:
00105 // mode: c++
00106 // fill-column: 100
00107 // c-file-style: "senf"
00108 // indent-tabs-mode: nil
00109 // ispell-local-dictionary: "american"
00110 // compile-command: "scons -u test"
00111 // comment-column: 40
00112 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research