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 292 of file XrdClUtils.hh.

Constructor & Destructor Documentation

◆ ScopedDescriptor()

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

Constructor.

Definition at line 298 of file XrdClUtils.hh.

298 : pDescriptor( descriptor ) {}

◆ ~ScopedDescriptor()

XrdCl::ScopedDescriptor::~ScopedDescriptor ( )
inline

Destructor.

Definition at line 303 of file XrdClUtils.hh.

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

References close.

Member Function Documentation

◆ GetDescriptor()

int XrdCl::ScopedDescriptor::GetDescriptor ( )
inline

Get the descriptor.

Definition at line 318 of file XrdClUtils.hh.

319  {
320  return pDescriptor;
321  }

◆ Release()

int XrdCl::ScopedDescriptor::Release ( )
inline

Release the descriptor being held.

Definition at line 308 of file XrdClUtils.hh.

309  {
310  int desc = pDescriptor;
311  pDescriptor = -1;
312  return desc;
313  }

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