The Gaudi Framework  master (37c0b60a)
ProcStats::unique_fd Class Reference

Public Member Functions

 unique_fd (const int fd=-1)
 
 unique_fd (unique_fd &&other)
 
 ~unique_fd ()
 
 operator bool () const
 
template<typename... Args>
unique_fdopen (Args &&... args)
 
int close ()
 

Private Member Functions

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

Private Attributes

int m_fd { -1 }
 

Detailed Description

Definition at line 52 of file ProcStats.h.

Constructor & Destructor Documentation

◆ unique_fd() [1/3]

ProcStats::unique_fd::unique_fd ( const unique_fd )
privatedelete

◆ unique_fd() [2/3]

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

Definition at line 62 of file ProcStats.h.

62 : m_fd( fd ) {}

◆ unique_fd() [3/3]

ProcStats::unique_fd::unique_fd ( unique_fd &&  other)
inline

Definition at line 63 of file ProcStats.h.

63  {
64  m_fd = other.m_fd;
65  other.m_fd = -1;
66  }

◆ ~unique_fd()

ProcStats::unique_fd::~unique_fd ( )
inline

Definition at line 67 of file ProcStats.h.

67 { close(); }

Member Function Documentation

◆ close()

int ProcStats::unique_fd::close ( )
inline

Definition at line 76 of file ProcStats.h.

76  {
77  int r = 0;
78  if ( m_fd != -1 ) {
79  r = ::close( m_fd );
80  m_fd = -1;
81  }
82  return r;
83  }

◆ open()

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

Definition at line 72 of file ProcStats.h.

72  {
73  m_fd = ::open( std::forward<Args>( args )... );
74  return *this;
75  }

◆ operator bool()

ProcStats::unique_fd::operator bool ( ) const
inlineexplicit

Definition at line 70 of file ProcStats.h.

70 { return m_fd != -1; }

◆ operator=()

unique_fd& ProcStats::unique_fd::operator= ( const unique_fd )
privatedelete

Member Data Documentation

◆ m_fd

int ProcStats::unique_fd::m_fd { -1 }
private

Definition at line 55 of file ProcStats.h.


The documentation for this class was generated from the following file:
gaudirun.fd
fd
Definition: gaudirun.py:630
ProcStats::unique_fd::open
unique_fd & open(Args &&... args)
Definition: ProcStats.h:72
ProcStats::unique_fd::close
int close()
Definition: ProcStats.h:76
gaudirun.args
args
Definition: gaudirun.py:336
ProcStats::unique_fd::m_fd
int m_fd
Definition: ProcStats.h:55