Util--  1.1
Public Member Functions | List of all members
utilmm::auto_close Class Reference

#include <utilmm/system/system.hh>

Inheritance diagram for utilmm::auto_close:
Inheritance graph
[legend]
Collaboration diagram for utilmm::auto_close:
Collaboration graph
[legend]

Public Member Functions

 auto_close ()
 
 auto_close (int fileno)
 
 auto_close (FILE *stream)
 
 ~auto_close ()
 
template<typename T >
handle () const
 
void close ()
 
void reset (int fd)
 
void reset (FILE *stream)
 
void detach ()
 
template<>
FILE * handle () const
 
template<>
int handle () const
 

Detailed Description

The C++ guard mechanism applied to file descriptors: when destroyed, an auto_close object releases the file descriptor it has been given at construction.

Constructor & Destructor Documentation

◆ auto_close() [1/3]

utilmm::auto_close::auto_close ( )

◆ auto_close() [2/3]

utilmm::auto_close::auto_close ( int  fileno)
explicit

◆ auto_close() [3/3]

utilmm::auto_close::auto_close ( FILE *  stream)
explicit

◆ ~auto_close()

utilmm::auto_close::~auto_close ( )

Member Function Documentation

◆ close()

void utilmm::auto_close::close ( )

Close the file descriptor right away

◆ detach()

void utilmm::auto_close::detach ( )

Disassociates this object and the file descriptor associated with it without closing the file descriptor

◆ handle() [1/3]

template<typename T >
T utilmm::auto_close::handle ( ) const

Access to the file descriptor.

Exceptions
std::bad_castRaised if the required type is not the right file descriptor type (i.e. if handle<FILE> is calledd on a auto_close object created with an 'int' fd)

◆ handle() [2/3]

template<>
FILE* utilmm::auto_close::handle ( ) const

◆ handle() [3/3]

template<>
int utilmm::auto_close::handle ( ) const

◆ reset() [1/2]

void utilmm::auto_close::reset ( int  fd)

First, close the current defined file descriptor and then sets it to a new one. Calling reset(-1) is equivalent to calling close() directly.

◆ reset() [2/2]

void utilmm::auto_close::reset ( FILE *  stream)

First, close the current defined file descriptor and then sets it to a new one. Calling reset(-1) is equivalent to calling close() directly.


The documentation for this class was generated from the following file:

Generated on Wed Oct 17 2018 09:34:19 for Util-- by doxygen 1.8.13
SourceForge.net Project Page