LinePrefixFilter Class Reference#

DiFfRG: DiFfRG::LinePrefixFilter Class Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows

A std::streambuf that forwards everything except whole lines starting with a prefix. More...

#include <stream_filter.hh>

Inheritance diagram for DiFfRG::LinePrefixFilter:

Public Member Functions

 LinePrefixFilter (std::streambuf *sink, std::string_view prefix)
 

Protected Member Functions

int_type overflow (int_type ch) override
 
int sync () override
 

Private Types

enum class  State { undecided , forwarding , dropping }
 

Private Member Functions

void forward ()
 
void reset ()
 

Private Attributes

std::streambuf * sink
 
std::string_view prefix
 
std::string held
 
State state = State::undecided
 

Detailed Description

A std::streambuf that forwards everything except whole lines starting with a prefix.

Bytes are withheld only while the current line is still a prefix of the pattern; the moment it diverges, all of them are forwarded at once. Nothing written for another reason is therefore delayed. That property is the point of the class rather than an optimization: it is used around calls that may abort the process, and a line-buffering filter would swallow the dying message.

Member Enumeration Documentation

◆ State

enum class DiFfRG::LinePrefixFilter::State
strongprivate
Enumerator
undecided 

the line so far is still a prefix of the pattern

forwarding 

this line has diverged and is passed through

dropping 

this line matched and is discarded up to its newline

Constructor & Destructor Documentation

◆ LinePrefixFilter()

DiFfRG::LinePrefixFilter::LinePrefixFilter ( std::streambuf * sink,
std::string_view prefix )
inline

Member Function Documentation

◆ forward()

void DiFfRG::LinePrefixFilter::forward ( )
inlineprivate

◆ overflow()

int_type DiFfRG::LinePrefixFilter::overflow ( int_type ch)
inlineoverrideprotected

◆ reset()

void DiFfRG::LinePrefixFilter::reset ( )
inlineprivate

◆ sync()

int DiFfRG::LinePrefixFilter::sync ( )
inlineoverrideprotected

Member Data Documentation

◆ held

std::string DiFfRG::LinePrefixFilter::held
private

◆ prefix

std::string_view DiFfRG::LinePrefixFilter::prefix
private

◆ sink

std::streambuf* DiFfRG::LinePrefixFilter::sink
private

◆ state

State DiFfRG::LinePrefixFilter::state = State::undecided
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/stream_filter.hh