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.
23 // Definition of inline non-template functions
25 //#include "FileHandle.ih"
29 #include "Utils/Exception.hh"
31 #define prefix_ inline
32 ///////////////////////////////cci.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
35 // satcom::lib::FileBody
37 prefix_ satcom::lib::FileBody::FileBody(int fd)
41 prefix_ satcom::lib::FileBody::~FileBody()
52 prefix_ void satcom::lib::FileBody::close()
55 throw SystemException(EBADF);
60 prefix_ void satcom::lib::FileBody::terminate()
68 prefix_ int satcom::lib::FileBody::fd()
74 prefix_ void satcom::lib::FileBody::fd(int fd)
79 prefix_ bool satcom::lib::FileBody::eof()
85 prefix_ bool satcom::lib::FileBody::valid()
88 return fd_!=-1 && v_valid();
91 prefix_ bool satcom::lib::FileBody::readable()
94 return pollCheck(fd(),true);
97 prefix_ void satcom::lib::FileBody::waitReadable()
100 pollCheck(fd(),true,true);
103 prefix_ bool satcom::lib::FileBody::writeable()
106 return pollCheck(fd(),false);
109 prefix_ void satcom::lib::FileBody::waitWriteable()
112 pollCheck(fd(),false,true);
115 ///////////////////////////////////////////////////////////////////////////
116 // satcom::lib::FileHandle
118 prefix_ void satcom::lib::FileHandle::close()
123 prefix_ void satcom::lib::FileHandle::terminate()
128 prefix_ bool satcom::lib::FileHandle::readable()
131 return body().readable();
134 prefix_ void satcom::lib::FileHandle::waitReadable()
137 body().waitReadable();
140 prefix_ bool satcom::lib::FileHandle::writeable()
143 return body().writeable();
146 prefix_ void satcom::lib::FileHandle::waitWriteable()
149 body().waitWriteable();
152 prefix_ bool satcom::lib::FileHandle::blocking()
155 return body().blocking();
158 prefix_ void satcom::lib::FileHandle::blocking(bool status)
160 body().blocking(status);
163 prefix_ bool satcom::lib::FileHandle::eof()
169 prefix_ bool satcom::lib::FileHandle::valid()
172 return body().valid();
175 prefix_ bool satcom::lib::FileHandle::boolean_test()
178 return valid() && !eof();
181 prefix_ int satcom::lib::FileHandle::fd()
187 prefix_ satcom::lib::FileHandle::FileHandle(std::auto_ptr<FileBody> body)
188 : body_(body.release())
191 prefix_ satcom::lib::FileBody & satcom::lib::FileHandle::body()
196 prefix_ satcom::lib::FileBody const & satcom::lib::FileHandle::body()
202 prefix_ satcom::lib::FileBody & satcom::lib::FileHandle::body(FileHandle & handle)
204 return handle.body();
207 prefix_ satcom::lib::FileBody const &
208 satcom::lib::FileHandle::body(FileHandle const & handle)
210 return handle.body();
213 prefix_ void satcom::lib::FileHandle::fd(int fd)
218 prefix_ satcom::lib::FileHandle::FileHandle
219 satcom::lib::FileHandle::cast_static(FileHandle handle)
224 prefix_ satcom::lib::FileHandle
225 satcom::lib::FileHandle::cast_dynamic(FileHandle handle)
230 prefix_ int satcom::lib::retrieve_filehandle(FileHandle handle)
235 ///////////////////////////////cci.e///////////////////////////////////////
241 // c-file-style: "satcom"