1 /* COPYING ******************************************************************
2 For copyright and licensing terms, see the file named COPYING.
3 // **************************************************************************
4 */
5 
6 #if !defined(INCLUDE_FILEDESCRIPTOROWNER_H)
7 #define INCLUDE_FILEDESCRIPTOROWNER_H
8 
9 /// A class for simple ownership of file descriptors, modelled on the semantics of std::auto_ptr.
10 class FileDescriptorOwner
11 {
12 public:
FileDescriptorOwner(int f)13 	FileDescriptorOwner(int f) : fd(f) {}
14 	~FileDescriptorOwner();
15 	FileDescriptorOwner(FileDescriptorOwner && o);
16 	void reset(int);
17 	int release();
get()18 	int get() const { return fd; }
19 protected:
20 	int fd;
21 private:
22 	FileDescriptorOwner(const FileDescriptorOwner &);
23 };
24 
25 #endif
26