XRootD
XrdCl::ScopedDescriptor Class Reference

Smart descriptor - closes the descriptor on destruction. More...

#include <XrdClUtils.hh>

+ Collaboration diagram for XrdCl::ScopedDescriptor:

Public Member Functions

 ScopedDescriptor (int descriptor)
 Constructor. More...
 
 ~ScopedDescriptor ()
 Destructor. More...
 
int GetDescriptor ()
 Get the descriptor. More...
 
int Release ()
 Release the descriptor being held. More...
 

Detailed Description

Smart descriptor - closes the descriptor on destruction.

Definition at line 294 of file XrdClUtils.hh.

Constructor & Destructor Documentation

◆ ScopedDescriptor()

XrdCl::ScopedDescriptor::ScopedDescriptor ( int  descriptor)
inline

Constructor.

Definition at line 300 of file XrdClUtils.hh.

300 : pDescriptor( descriptor ) {}

◆ ~ScopedDescriptor()

XrdCl::ScopedDescriptor::~ScopedDescriptor ( )
inline

Destructor.

Definition at line 305 of file XrdClUtils.hh.

305 { if( pDescriptor >= 0 ) close( pDescriptor ); }
#define close(a)
Definition: XrdPosix.hh:48

References close.

Member Function Documentation

◆ GetDescriptor()

int XrdCl::ScopedDescriptor::GetDescriptor ( )
inline

Get the descriptor.

Definition at line 320 of file XrdClUtils.hh.

321  {
322  return pDescriptor;
323  }

◆ Release()

int XrdCl::ScopedDescriptor::Release ( )
inline

Release the descriptor being held.

Definition at line 310 of file XrdClUtils.hh.

311  {
312  int desc = pDescriptor;
313  pDescriptor = -1;
314  return desc;
315  }

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