AWS SDK for C++
AWS SDK for C++
Loading...
Searching...
No Matches
ConcurrentStreamBuf.h
Go to the documentation of this file.
1
5#pragma once
6
9#include <aws/common/array_list.h>
10
11#include <mutex>
12#include <condition_variable>
13#include <streambuf>
14#include <ios>
15#include <cassert>
16
17namespace Aws
18{
19 namespace Utils
20 {
21 namespace Stream
22 {
29 class AWS_CORE_API ConcurrentStreamBuf : public std::streambuf
30 {
31 public:
32
33 explicit ConcurrentStreamBuf(size_t bufferLength = 4 * 1024);
34
35 void SetEof();
36
37 protected:
38 std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
39 std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
40
41 int underflow() override;
42 int overflow(int ch) override;
43 int sync() override;
44 std::streamsize showmanyc() override;
45
47
48 private:
51 Aws::Vector<unsigned char> m_backbuf; // used to shuttle data from the put area to the get area
52 std::mutex m_lock; // synchronize access to the common backbuffer
53 std::condition_variable m_signal;
54 bool m_eof;
55 };
56 }
57 }
58}
#define AWS_CORE_API
Definition: Core_EXPORTS.h:26
int which
Definition: cJSON.h:248
std::streamsize showmanyc() override
std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) override
std::streampos seekpos(std::streampos pos, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) override
ConcurrentStreamBuf(size_t bufferLength=4 *1024)
std::vector< T, Aws::Allocator< T > > Vector
Definition: AWSVector.h:17