utilmm::auto_close Class Reference
[OS-related tools]

#include <system.hh>

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

List of all members.

Public Member Functions

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

Private Attributes

int m_fileno
FILE * m_stream

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.

Definition at line 39 of file install/include/utilmm/system/system.hh.


Constructor & Destructor Documentation

auto_close::auto_close (  ) 

Definition at line 40 of file system.cc.

auto_close::auto_close ( int  fileno  )  [explicit]

Definition at line 42 of file system.cc.

auto_close::auto_close ( FILE *  stream  )  [explicit]

Definition at line 44 of file system.cc.

auto_close::~auto_close (  ) 

Definition at line 46 of file system.cc.

utilmm::auto_close::auto_close (  ) 
utilmm::auto_close::auto_close ( int  fileno  )  [explicit]
utilmm::auto_close::auto_close ( FILE *  stream  )  [explicit]
utilmm::auto_close::~auto_close (  ) 

Member Function Documentation

void utilmm::auto_close::close (  ) 

Close the file descriptor right away

void auto_close::close (  ) 

Close the file descriptor right away

Definition at line 48 of file system.cc.

void utilmm::auto_close::detach (  ) 

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

void auto_close::detach (  ) 

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

Definition at line 62 of file system.cc.

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

Access to the file descriptor.

Exceptions:
std::bad_cast Raised 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)
int utilmm::auto_close::handle< int > (  )  const [inline]

Access to the file descriptor.

Exceptions:
std::bad_cast Raised 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)
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.

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.

void 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.

Definition at line 84 of file system.cc.

void 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.

Definition at line 79 of file system.cc.


Member Data Documentation

Definition at line 76 of file install/include/utilmm/system/system.hh.

FILE * utilmm::auto_close::m_stream [private]

Definition at line 77 of file install/include/utilmm/system/system.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Fri Jan 11 10:07:42 2013