cartobase  5.0.5
carto::fdinhibitor Class Reference

Temporarily closes a file descriptor (typically, stdout/stderr). More...

#include <cartobase/stream/fdinhibitor.h>

Classes

class  ResetCallback
 

Public Member Functions

 fdinhibitor (int fd, bool permanent=false)
 fd: file descriptor to inhibate, permanent: if false, don't reopen the stream when deleting the fdinhibitor More...
 
 fdinhibitor (FILE *fd, bool permanent=false)
 fd: file to inhibate, permanent: if false, don't reopen the stream when deleting the fdinhibitor More...
 
 ~fdinhibitor ()
 
void close (void)
 
void open (void)
 
void notify (int fd)
 

Static Public Member Functions

static void registerResetCallback (const std::string &name, ResetCallback *cbk)
 
static bool hasResetCallback (const std::string &name)
 
static void unregisterResetCallback (const std::string &name)
 

Detailed Description

Temporarily closes a file descriptor (typically, stdout/stderr).

Currently, this low-level implementation doesn't work with all C++ streams: on some systems C++ streams stay in a bad state afterwards and are silent forever. Standard IO streams (cin, cout, cerr) are checked and protected against this problem.

Definition at line 50 of file fdinhibitor.h.

Constructor & Destructor Documentation

◆ fdinhibitor() [1/2]

carto::fdinhibitor::fdinhibitor ( int  fd,
bool  permanent = false 
)

fd: file descriptor to inhibate, permanent: if false, don't reopen the stream when deleting the fdinhibitor

◆ fdinhibitor() [2/2]

carto::fdinhibitor::fdinhibitor ( FILE *  fd,
bool  permanent = false 
)

fd: file to inhibate, permanent: if false, don't reopen the stream when deleting the fdinhibitor

◆ ~fdinhibitor()

carto::fdinhibitor::~fdinhibitor ( )

Member Function Documentation

◆ close()

void carto::fdinhibitor::close ( void  )

◆ hasResetCallback()

static bool carto::fdinhibitor::hasResetCallback ( const std::string &  name)
static

◆ notify()

void carto::fdinhibitor::notify ( int  fd)

◆ open()

void carto::fdinhibitor::open ( void  )

◆ registerResetCallback()

static void carto::fdinhibitor::registerResetCallback ( const std::string &  name,
ResetCallback cbk 
)
static

◆ unregisterResetCallback()

static void carto::fdinhibitor::unregisterResetCallback ( const std::string &  name)
static

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