The Gaudi Framework  v29r0 (ff2e7097)
ProcStats::unique_fd Class Reference

Public Member Functions

 unique_fd (int fd=-1)
 
 unique_fd (unique_fd &&other)
 
 ~unique_fd ()
 
 operator bool () const
 
template<typename... Args>
unique_fdopen (Args &&...args)
 
 unique_fd_forward (lseek) unique_fd_forward(read) unique_fd_forward(write) unique_fd_forward(fcntl) unique_fd_forward(fsync) unique_fd_forward(fchown) unique_fd_forward(stat) int close()
 

Private Member Functions

 unique_fd (const unique_fd &)=delete
 
unique_fdoperator= (const unique_fd &)=delete
 

Private Attributes

int m_fd
 

Detailed Description

Definition at line 60 of file ProcStats.h.

Constructor & Destructor Documentation

ProcStats::unique_fd::unique_fd ( const unique_fd )
privatedelete
ProcStats::unique_fd::unique_fd ( int  fd = -1)
inline

Definition at line 67 of file ProcStats.h.

67 : m_fd( fd ) {}
unique_fd fd
Definition: ProcStats.h:102
ProcStats::unique_fd::unique_fd ( unique_fd &&  other)
inline

Definition at line 68 of file ProcStats.h.

69  {
70  m_fd = other.m_fd;
71  other.m_fd = -1;
72  }
ProcStats::unique_fd::~unique_fd ( )
inline

Definition at line 73 of file ProcStats.h.

74  {
75  if ( m_fd != -1 ) ::close( m_fd );
76  }

Member Function Documentation

template<typename... Args>
unique_fd& ProcStats::unique_fd::open ( Args &&...  args)
inline

Definition at line 80 of file ProcStats.h.

81  {
82  m_fd = ::open( std::forward<Args>( args )... );
83  return *this;
84  }
unique_fd & open(Args &&...args)
Definition: ProcStats.h:80
ProcStats::unique_fd::operator bool ( ) const
inlineexplicit

Definition at line 78 of file ProcStats.h.

78 { return m_fd != -1; }
unique_fd& ProcStats::unique_fd::operator= ( const unique_fd )
privatedelete
ProcStats::unique_fd::unique_fd_forward ( lseek  )
inline

Definition at line 91 of file ProcStats.h.

95  {
96  auto r = ::close( m_fd );
97  m_fd = -1;
98  return r;
99  }

Member Data Documentation

int ProcStats::unique_fd::m_fd
private

Definition at line 62 of file ProcStats.h.


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