mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-18 16:43:57 +08:00
Refactor. Streams hierarchy V2. Compiles.
This commit is contained in:
parent
52e1e4835e
commit
a99b5933eb
@ -149,11 +149,10 @@ void PipelineAsyncTest::onRun() {
|
||||
}
|
||||
|
||||
oatpp::data::stream::BufferInputStream inputStream(pipelineStream.toString());
|
||||
oatpp::data::stream::DefaultWriteCallback writeCallback(connection.get());
|
||||
|
||||
oatpp::data::buffer::IOBuffer ioBuffer;
|
||||
|
||||
oatpp::data::stream::transfer(&inputStream, &writeCallback, 0, ioBuffer.getData(), ioBuffer.getSize());
|
||||
oatpp::data::stream::transfer(&inputStream, connection.get(), 0, ioBuffer.getData(), ioBuffer.getSize());
|
||||
|
||||
});
|
||||
|
||||
|
@ -144,11 +144,10 @@ void PipelineTest::onRun() {
|
||||
}
|
||||
|
||||
oatpp::data::stream::BufferInputStream inputStream(pipelineStream.toString());
|
||||
oatpp::data::stream::DefaultWriteCallback writeCallback(connection.get());
|
||||
|
||||
oatpp::data::buffer::IOBuffer ioBuffer;
|
||||
|
||||
oatpp::data::stream::transfer(&inputStream, &writeCallback, 0, ioBuffer.getData(), ioBuffer.getSize());
|
||||
oatpp::data::stream::transfer(&inputStream, connection.get(), 0, ioBuffer.getData(), ioBuffer.getSize());
|
||||
|
||||
});
|
||||
|
||||
|
@ -151,15 +151,20 @@ public:
|
||||
, m_iterations(iterations)
|
||||
{}
|
||||
|
||||
oatpp::async::Action readAsyncInline(oatpp::data::stream::AsyncInlineReadData& inlineData, oatpp::async::Action&& nextAction) override {
|
||||
data::v_io_size read(void *buffer, v_buff_size count) override {
|
||||
if(m_counter < m_iterations) {
|
||||
std::memcpy(inlineData.currBufferPtr, m_text->getData(), m_text->getSize());
|
||||
inlineData.inc(m_text->getSize());
|
||||
std::memcpy(buffer, m_text->getData(), m_text->getSize());
|
||||
m_counter ++;
|
||||
return m_text->getSize();
|
||||
}
|
||||
m_counter ++;
|
||||
return std::forward<oatpp::async::Action>(nextAction);
|
||||
return 0;
|
||||
}
|
||||
|
||||
async::Action suggestInputStreamAction(data::v_io_size ioResult) override {
|
||||
throw std::runtime_error("Not implemented!");
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
Action act() {
|
||||
|
Loading…
Reference in New Issue
Block a user