mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-05-27 21:29:21 +03:00
24 lines
836 B
C++
24 lines
836 B
C++
|
|
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||
|
|
// Copyright Benoit Blanchon 2019-2021
|
||
|
|
// MIT License
|
||
|
|
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "../Policies/ReadForwardingPolicy.hpp"
|
||
|
|
#include "../Policies/WriteBufferingPolicy.hpp"
|
||
|
|
#include "../Ports/DefaultAllocator.hpp"
|
||
|
|
#include "StreamProxy.hpp"
|
||
|
|
|
||
|
|
namespace StreamUtils {
|
||
|
|
|
||
|
|
template <typename TAllocator>
|
||
|
|
struct BasicWriteBufferingStream
|
||
|
|
: StreamProxy<ReadForwardingPolicy, WriteBufferingPolicy<TAllocator>> {
|
||
|
|
explicit BasicWriteBufferingStream(Stream &upstream, size_t capacity,
|
||
|
|
TAllocator allocator = TAllocator())
|
||
|
|
: StreamProxy<ReadForwardingPolicy, WriteBufferingPolicy<TAllocator>>(
|
||
|
|
upstream, {}, {capacity, allocator}) {}
|
||
|
|
};
|
||
|
|
|
||
|
|
using WriteBufferingStream = BasicWriteBufferingStream<DefaultAllocator>;
|
||
|
|
} // namespace StreamUtils
|