Fix Doxygen builder file globbing
[senf.git] / Socket / FileHandle.hh
1 // $Id$
2 //
3 // Copyright (C) 2006 
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
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.
12 //
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.
17 //
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.
22
23 #ifndef HH_FileHandle_
24 #define HH_FileHandle_ 1
25
26 // Custom includes
27 #include <memory> // std::auto_ptr
28 #include "Utils/SafeBool.hh"
29
30 //#include "FileHandle.mpp"
31 ///////////////////////////////hh.p////////////////////////////////////////
32 #include "FileHandle.ih"
33
34 namespace senf {
35
36     
37     /** \brief
38      */
39     class FileHandle
40         : public SafeBool<FileHandle>
41     {
42     public:
43         ///////////////////////////////////////////////////////////////////////////
44         // Types
45
46         ///////////////////////////////////////////////////////////////////////////
47         ///\name Structors and default members
48         ///@{
49
50         // protected default constructor
51         // default copy constructor
52         // default copy assignment
53         // default destructor
54
55         // no conversion constructors
56
57         ///@}
58         ///////////////////////////////////////////////////////////////////////////
59         
60         void close();
61         void terminate();
62
63         bool readable() const;
64         void waitReadable() const;
65         bool writeable() const;
66         void waitWriteable() const;
67
68         bool blocking() const;
69         void blocking(bool status);
70
71         bool eof() const;
72         bool valid() const;
73
74         bool boolean_test() const;
75
76         int fd() const;
77
78         static FileHandle cast_static(FileHandle handle);
79         static FileHandle cast_dynamic(FileHandle handle);
80
81     protected:
82         explicit FileHandle(std::auto_ptr<FileBody> body);
83
84         FileBody & body();
85         FileBody const & body() const;
86         static FileBody & body(FileHandle & handle);
87         static FileBody const & body(FileHandle const & handle);
88
89         void fd(int fd);
90
91     private:
92         FileBody::ptr body_;
93     };
94
95     int retrieve_filehandle(FileHandle handle);
96
97 }
98
99 ///////////////////////////////hh.e////////////////////////////////////////
100 #include "FileHandle.cci"
101 //#include "FileHandle.ct"
102 //#include "FileHandle.cti"
103 #endif
104
105 \f
106 // Local Variables:
107 // mode: c++
108 // c-file-style: "senf"
109 // End: