// $Id$ // // Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef IH_FileHandle_ #define IH_FileHandle_ 1 // Custom includes #include #include "Utils/intrusive_refcount.hh" ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { /** \brief */ class FileBody : public senf::intrusive_refcount { public: /////////////////////////////////////////////////////////////////////////// // Types typedef boost::intrusive_ptr ptr; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ explicit FileBody(int fd=-1); virtual ~FileBody(); // no copy // no conversion constructors ///@} /////////////////////////////////////////////////////////////////////////// int fd() const; void fd(int fd); void close(); void terminate(); bool readable() const; void waitReadable() const; bool writeable() const; void waitWriteable() const; bool blocking() const; void blocking(bool status); bool eof() const; bool valid() const; private: /////////////////////////////////////////////////////////////////////////// // Virtual interface for subclasses to override virtual void v_close(); virtual void v_terminate(); virtual bool v_eof() const; virtual bool v_valid() const; protected: private: bool pollCheck(int fd, bool incoming, bool block=false) const; int fd_; }; } ///////////////////////////////ih.e//////////////////////////////////////// #endif // Local Variables: // mode: c++ // c-file-style: "senf" // End: