4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
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.
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.
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.
24 \brief FileHandle inline non-template implementation
27 //#include "FileHandle.ih"
31 #include "Utils/Exception.hh"
33 #define prefix_ inline
34 ///////////////////////////////cci.p///////////////////////////////////////
36 ///////////////////////////////////////////////////////////////////////////
39 prefix_ senf::FileBody::FileBody(int fd)
43 prefix_ senf::FileBody::~FileBody()
54 prefix_ void senf::FileBody::close()
57 throw SystemException(EBADF);
62 prefix_ void senf::FileBody::terminate()
70 prefix_ int senf::FileBody::fd()
76 prefix_ void senf::FileBody::fd(int fd)
81 prefix_ bool senf::FileBody::eof()
87 prefix_ bool senf::FileBody::valid()
90 return fd_!=-1 && v_valid();
93 prefix_ bool senf::FileBody::readable()
96 return pollCheck(fd(),true);
99 prefix_ void senf::FileBody::waitReadable()
102 pollCheck(fd(),true,true);
105 prefix_ bool senf::FileBody::writeable()
108 return pollCheck(fd(),false);
111 prefix_ void senf::FileBody::waitWriteable()
114 pollCheck(fd(),false,true);
117 ///////////////////////////////////////////////////////////////////////////
120 prefix_ void senf::FileHandle::close()
125 prefix_ void senf::FileHandle::terminate()
130 prefix_ bool senf::FileHandle::readable()
133 return body().readable();
136 prefix_ void senf::FileHandle::waitReadable()
139 body().waitReadable();
142 prefix_ bool senf::FileHandle::writeable()
145 return body().writeable();
148 prefix_ void senf::FileHandle::waitWriteable()
151 body().waitWriteable();
154 prefix_ bool senf::FileHandle::blocking()
157 return body().blocking();
160 prefix_ void senf::FileHandle::blocking(bool status)
162 body().blocking(status);
165 prefix_ bool senf::FileHandle::eof()
171 prefix_ bool senf::FileHandle::valid()
174 return body().valid();
177 prefix_ bool senf::FileHandle::boolean_test()
180 return valid() && !eof();
183 prefix_ int senf::FileHandle::fd()
189 prefix_ senf::FileHandle::FileHandle(std::auto_ptr<FileBody> body)
190 : body_(body.release())
193 prefix_ senf::FileBody & senf::FileHandle::body()
198 prefix_ senf::FileBody const & senf::FileHandle::body()
204 prefix_ senf::FileBody & senf::FileHandle::body(FileHandle & handle)
206 return handle.body();
209 prefix_ senf::FileBody const &
210 senf::FileHandle::body(FileHandle const & handle)
212 return handle.body();
215 prefix_ void senf::FileHandle::fd(int fd)
220 prefix_ senf::FileHandle::FileHandle
221 senf::FileHandle::cast_static(FileHandle handle)
226 prefix_ senf::FileHandle
227 senf::FileHandle::cast_dynamic(FileHandle handle)
232 prefix_ int senf::retrieve_filehandle(FileHandle handle)
237 ///////////////////////////////cci.e///////////////////////////////////////
244 // c-file-style: "senf"
245 // indent-tabs-mode: nil
246 // ispell-local-dictionary: "american"