GEOS
Classes | Public Types | Public Member Functions | List of all members
geos::OutputStreamDeviation Class Reference

This class implements pipe redirection to allow to capture and process externally streamed messages. More...

#include <ExternalErrorHandler.hpp>

Public Types

using PosixId = int
 Posix identifier, can be a file handle, an error number... Must be consistent with posix functions.
 
using LineHandlingFunctor = std::function< void(std::string_view, std::string_view) >
 A functor executed for each independant lines to process, taking the line as the 1st string_view parameter, and the detectionLocation as the 2nd.
 

Public Member Functions

 OutputStreamDeviation (PosixId fileNo)
 Construct and enable a new pipe redirection. More...
 
 ~OutputStreamDeviation ()
 Destroy the OutputStreamDeviation object, restoring the original pipe state.
 
void flush (LineHandlingFunctor const &lineProcessingFunctor, std::string_view detectionLocation)
 Flush the buffer from the original output pipe in a string, allowing to log it where needed. More...
 

Detailed Description

This class implements pipe redirection to allow to capture and process externally streamed messages.

Definition at line 68 of file ExternalErrorHandler.hpp.

Constructor & Destructor Documentation

◆ OutputStreamDeviation()

geos::OutputStreamDeviation::OutputStreamDeviation ( PosixId  fileNo)

Construct and enable a new pipe redirection.

Parameters
fileNoThe file descriptor number, as returned by fileno() or can be one of the following: "STDOUT_FILENO" (1), "STDERR_FILENO" (2).

Member Function Documentation

◆ flush()

void geos::OutputStreamDeviation::flush ( LineHandlingFunctor const &  lineProcessingFunctor,
std::string_view  detectionLocation 
)

Flush the buffer from the original output pipe in a string, allowing to log it where needed.

Parameters
lineProcessingFunctorsee LineHandlingFunctor.
detectionLocationA label to describe when the flush() operation is being made, thus explaining to the user when the error has been detected.

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