aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/tee.h
blob: 8445ffd9c40fd315c2d3fe5bd7853842cf0ce85d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "output.h"

/**
 * @addtogroup Streams_Multi
 * @{
 */

/**
 * A proxy output stream that writes into two slave streams simultaneously.
 */
class TTeeOutput: public IOutputStream {
public:
    TTeeOutput(IOutputStream* l Y_LIFETIME_BOUND, IOutputStream* r Y_LIFETIME_BOUND) noexcept;
    ~TTeeOutput() override;

private:
    void DoWrite(const void* buf, size_t len) override;
    void DoFlush() override;
    void DoFinish() override;

private:
    IOutputStream* L_;
    IOutputStream* R_;
};

/** @} */