From 14ec8c0a4f3c72f2ed3c62beb0b9ff356b7cae3c Mon Sep 17 00:00:00 2001 From: lganzzzo Date: Fri, 5 Apr 2019 01:15:58 +0300 Subject: [PATCH] rename coroutine start methods --- .../codegen/codegen_define_ApiClient_.hpp | 6 +- .../codegen/codegen_define_ApiController_.hpp | 4 +- src/oatpp/core/async/Coroutine.cpp | 14 ++-- src/oatpp/core/async/Coroutine.hpp | 73 +++++++++---------- src/oatpp/core/data/buffer/FIFOBuffer.cpp | 4 +- src/oatpp/core/data/buffer/FIFOBuffer.hpp | 4 +- src/oatpp/core/data/stream/ChunkedBuffer.cpp | 4 +- src/oatpp/core/data/stream/ChunkedBuffer.hpp | 4 +- src/oatpp/core/data/stream/Stream.cpp | 10 +-- src/oatpp/core/data/stream/Stream.hpp | 2 +- .../core/data/stream/StreamBufferedProxy.cpp | 2 +- .../core/data/stream/StreamBufferedProxy.hpp | 2 +- src/oatpp/network/ConnectionProvider.hpp | 4 +- .../client/SimpleTCPConnectionProvider.cpp | 4 +- .../client/SimpleTCPConnectionProvider.hpp | 4 +- .../server/SimpleTCPConnectionProvider.hpp | 2 +- .../virtual_/client/ConnectionProvider.cpp | 4 +- .../virtual_/client/ConnectionProvider.hpp | 4 +- .../virtual_/server/ConnectionProvider.hpp | 2 +- src/oatpp/web/client/ApiClient.cpp | 4 +- src/oatpp/web/client/ApiClient.hpp | 6 +- src/oatpp/web/client/HttpRequestExecutor.cpp | 8 +- src/oatpp/web/client/HttpRequestExecutor.hpp | 8 +- src/oatpp/web/client/RequestExecutor.hpp | 8 +- .../protocol/http/incoming/BodyDecoder.hpp | 20 ++--- .../web/protocol/http/incoming/Request.cpp | 2 +- .../web/protocol/http/incoming/Request.hpp | 12 +-- .../http/incoming/RequestHeadersReader.cpp | 4 +- .../http/incoming/RequestHeadersReader.hpp | 4 +- .../web/protocol/http/incoming/Response.cpp | 2 +- .../web/protocol/http/incoming/Response.hpp | 12 +-- .../http/incoming/ResponseHeadersReader.cpp | 4 +- .../http/incoming/ResponseHeadersReader.hpp | 4 +- .../http/incoming/SimpleBodyDecoder.cpp | 10 +-- .../http/incoming/SimpleBodyDecoder.hpp | 10 +-- src/oatpp/web/protocol/http/outgoing/Body.hpp | 4 +- .../web/protocol/http/outgoing/BufferBody.cpp | 4 +- .../web/protocol/http/outgoing/BufferBody.hpp | 4 +- .../http/outgoing/ChunkedBufferBody.cpp | 4 +- .../http/outgoing/ChunkedBufferBody.hpp | 4 +- .../web/protocol/http/outgoing/Request.cpp | 4 +- .../web/protocol/http/outgoing/Request.hpp | 4 +- .../web/protocol/http/outgoing/Response.cpp | 4 +- .../web/protocol/http/outgoing/Response.hpp | 4 +- src/oatpp/web/server/api/ApiController.hpp | 4 +- src/oatpp/web/url/mapping/Router.hpp | 4 +- src/oatpp/web/url/mapping/Subscriber.hpp | 4 +- 47 files changed, 159 insertions(+), 160 deletions(-) diff --git a/src/oatpp/codegen/codegen_define_ApiClient_.hpp b/src/oatpp/codegen/codegen_define_ApiClient_.hpp index f1820444..1d8b9f63 100644 --- a/src/oatpp/codegen/codegen_define_ApiClient_.hpp +++ b/src/oatpp/codegen/codegen_define_ApiClient_.hpp @@ -218,7 +218,7 @@ static PathPattern Z_getPathPattern_##NAME(const oatpp::String& path) { \ return pattern; \ } \ \ -oatpp::async::CoroutineCallForResult&> NAME( \ +oatpp::async::CoroutineStarterForResult&> NAME( \ const std::shared_ptr& __connectionHandle = nullptr \ ) { \ std::shared_ptr body; \ @@ -237,7 +237,7 @@ static PathPattern Z_getPathPattern_##NAME(const oatpp::String& path) { \ return pattern; \ } \ \ -oatpp::async::CoroutineCallForResult&> NAME(\ +oatpp::async::CoroutineStarterForResult&> NAME(\ OATPP_MACRO_FOREACH(OATPP_MACRO_API_CLIENT_PARAM_DECL, LIST) \ const std::shared_ptr& __connectionHandle = nullptr \ ) { \ @@ -264,7 +264,7 @@ oatpp::async::CoroutineCallForResult&>. + * @return - &id:oatpp::async::CoroutineStarterForResult;&>. */ #define API_CALL_ASYNC(METHOD, PATH, NAME, ...) \ OATPP_API_CALL_ASYNC___(NAME, METHOD, PATH, (__VA_ARGS__)) diff --git a/src/oatpp/codegen/codegen_define_ApiController_.hpp b/src/oatpp/codegen/codegen_define_ApiController_.hpp index 30c85918..2cd304da 100644 --- a/src/oatpp/codegen/codegen_define_ApiController_.hpp +++ b/src/oatpp/codegen/codegen_define_ApiController_.hpp @@ -473,10 +473,10 @@ const std::shared_ptr Z__ENDPOINT_##NAME = createEndpoint(m_endpoints, OATPP_MACRO_API_CONTROLLER_ENDPOINT_ASYNC_DECL_DEFAULTS(NAME, METHOD, PATH) \ OATPP_MACRO_API_CONTROLLER_ENDPOINT_ASYNC_DECL(NAME, METHOD, PATH) \ \ -oatpp::async::CoroutineCallForResult&> \ +oatpp::async::CoroutineStarterForResult&> \ Z__PROXY_METHOD_##NAME(const std::shared_ptr& __request) \ { \ - return NAME::callForResult(this, __request); \ + return NAME::startForResult(this, __request); \ } \ \ class NAME : public HandlerCoroutine diff --git a/src/oatpp/core/async/Coroutine.cpp b/src/oatpp/core/async/Coroutine.cpp index 189d4a47..076ff68a 100644 --- a/src/oatpp/core/async/Coroutine.cpp +++ b/src/oatpp/core/async/Coroutine.cpp @@ -81,14 +81,14 @@ v_int32 Action::getType() { } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Pipeline +// CoroutineStarter -Pipeline::Pipeline(AbstractCoroutine* coroutine) +CoroutineStarter::CoroutineStarter(AbstractCoroutine* coroutine) : m_first(coroutine) , m_last(coroutine) {} -Pipeline::Pipeline(Pipeline&& other) +CoroutineStarter::CoroutineStarter(CoroutineStarter&& other) : m_first(other.m_first) , m_last(other.m_last) { @@ -96,7 +96,7 @@ Pipeline::Pipeline(Pipeline&& other) other.m_last = nullptr; } -Pipeline::~Pipeline() { +CoroutineStarter::~CoroutineStarter() { if(m_first != nullptr) { auto curr = m_first; while(curr != nullptr) { @@ -113,7 +113,7 @@ Pipeline::~Pipeline() { /* * Move assignment operator. */ -Pipeline& Pipeline::operator=(Pipeline&& other) { +CoroutineStarter& CoroutineStarter::operator=(CoroutineStarter&& other) { m_first = other.m_first; m_last = other.m_last; other.m_first = nullptr; @@ -121,7 +121,7 @@ Pipeline& Pipeline::operator=(Pipeline&& other) { return *this; } -Action Pipeline::next(Action&& action) { +Action CoroutineStarter::next(Action&& action) { if(m_last == nullptr) { return std::forward(action); } @@ -132,7 +132,7 @@ Action Pipeline::next(Action&& action) { return std::move(result); } -Pipeline& Pipeline::next(Pipeline&& starter) { +CoroutineStarter& CoroutineStarter::next(CoroutineStarter&& starter) { m_last->m_parentReturnAction = starter.m_first; m_last = starter.m_last; starter.m_first = nullptr; diff --git a/src/oatpp/core/async/Coroutine.hpp b/src/oatpp/core/async/Coroutine.hpp index 7b00ab18..d0aad38a 100644 --- a/src/oatpp/core/async/Coroutine.hpp +++ b/src/oatpp/core/async/Coroutine.hpp @@ -38,7 +38,7 @@ namespace oatpp { namespace async { class AbstractCoroutine; // FWD class Processor; // FWD -class Pipeline; // FWD +class CoroutineStarter; // FWD /** * Class Action represents an asynchronous action. @@ -46,7 +46,7 @@ class Pipeline; // FWD class Action { friend Processor; friend AbstractCoroutine; - friend Pipeline; + friend CoroutineStarter; public: typedef Action (AbstractCoroutine::*FunctionPtr)(); public: @@ -150,9 +150,9 @@ public: }; /** - * Pipeline of Coroutine calls. + * CoroutineStarter of Coroutine calls. */ -class Pipeline { +class CoroutineStarter { private: AbstractCoroutine* m_first; AbstractCoroutine* m_last; @@ -162,47 +162,47 @@ public: * Constructor. * @param coroutine - coroutine. */ - Pipeline(AbstractCoroutine* coroutine); + CoroutineStarter(AbstractCoroutine* coroutine); /** * Deleted copy-constructor. */ - Pipeline(const Pipeline&) = delete; + CoroutineStarter(const CoroutineStarter&) = delete; /** * Move constructor. - * @param other - other pipeline. + * @param other - other starter. */ - Pipeline(Pipeline&& other); + CoroutineStarter(CoroutineStarter&& other); /** * Non-virtual destructor. */ - ~Pipeline(); + ~CoroutineStarter(); /* * Deleted copy-assignment operator. */ - Pipeline& operator=(const Pipeline&) = delete; + CoroutineStarter& operator=(const CoroutineStarter&) = delete; /* * Move assignment operator. */ - Pipeline& operator=(Pipeline&& other); + CoroutineStarter& operator=(CoroutineStarter&& other); /** - * Set final pipeline action. + * Set final starter action. * @param action - &l:Action;. * @return - &l:Action;. */ Action next(Action&& action); /** - * Add coroutine pipeline to this pipeline. + * Add coroutine starter pipeline to this starter. * @param pipeline - pipeline to add. * @return - this pipeline. */ - Pipeline& next(Pipeline&& pipeline); + CoroutineStarter& next(CoroutineStarter&& starter); }; @@ -212,7 +212,7 @@ public: class AbstractCoroutine {// : public oatpp::base::Countable { friend oatpp::collection::FastQueue; friend Processor; - friend Pipeline; + friend CoroutineStarter; public: /** * Convenience typedef for Action @@ -303,18 +303,6 @@ public: return getMemberCaller().call(ptr, args...); } - /** - * Start new Coroutine as a "nested" Coroutine, keeping track of a coroutine call stack. - * @tparam C - Coroutine to start. - * @tparam Args - arguments to be passed to a starting coroutine. - * @param args - actual parameters passed to startCoroutine call. - * @return - &l:Pipeline; of coroutine calls. - */ - template - static Pipeline startCoroutine(Args... args) { - return Pipeline(new C(args...)); - } - /** * Check if coroutine is finished * @return - true if finished @@ -364,6 +352,17 @@ public: public: + /** + * Create coroutine and return it's starter + * @tparam ConstructorArgs - coroutine constructor arguments. + * @param args - actual coroutine constructor arguments. + * @return - &id:oatpp::async::CoroutineStarter;. + */ + template + static CoroutineStarter start(ConstructorArgs... args) { + return new T(args...); + } + /** * Call function of Coroutine specified by ptr.
* Overridden `AbstractCoroutine::call()` method. @@ -423,7 +422,7 @@ public: * Class representing Coroutine call for result; */ template - class CallForResult { + class StarterForResult { public: template @@ -437,20 +436,20 @@ public: * Constructor. * @param coroutine - coroutine. */ - CallForResult(AbstractCoroutineWithResult* coroutine) + StarterForResult(AbstractCoroutineWithResult* coroutine) : m_coroutine(coroutine) {} /** * Deleted copy-constructor. */ - CallForResult(const CallForResult&) = delete; + StarterForResult(const StarterForResult&) = delete; /** * Move constructor. * @param other - other pipeline. */ - CallForResult(CallForResult&& other) + StarterForResult(StarterForResult&& other) : m_coroutine(other.m_coroutine) { other.m_coroutine = nullptr; @@ -459,7 +458,7 @@ public: /** * Non-virtual destructor. */ - ~CallForResult() { + ~StarterForResult() { if(m_coroutine != nullptr) { delete m_coroutine; } @@ -468,12 +467,12 @@ public: /* * Deleted copy-assignment operator. */ - CallForResult& operator=(const CallForResult&) = delete; + StarterForResult& operator=(const StarterForResult&) = delete; /* * Move assignment operator. */ - CallForResult& operator=(CallForResult&& other) { + StarterForResult& operator=(StarterForResult&& other) { m_coroutine = other.m_coroutine; other.m_coroutine = nullptr; return *this; @@ -482,7 +481,7 @@ public: template Action callbackTo(Callback callback) { if(m_coroutine == nullptr) { - throw std::runtime_error("[oatpp::async::AbstractCoroutineWithResult::CallForResult::callbackTo()]: Error. Coroutine is null."); + throw std::runtime_error("[oatpp::async::AbstractCoroutineWithResult::StarterForResult::callbackTo()]: Error. Coroutine is null."); } m_coroutine->m_callback = (FunctionPtr)(callback); Action result = m_coroutine; @@ -497,7 +496,7 @@ public: template using -CoroutineCallForResult = typename AbstractCoroutineWithResult::CallForResult; +CoroutineStarterForResult = typename AbstractCoroutineWithResult::StarterForResult; /** * Coroutine with result template.
@@ -529,7 +528,7 @@ public: * @return - &l:CoroutineWithResult::CoroutineWithResult;. */ template - static CoroutineCallForResult callForResult(ConstructorArgs... args) { + static CoroutineStarterForResult startForResult(ConstructorArgs... args) { return new T(args...); } diff --git a/src/oatpp/core/data/buffer/FIFOBuffer.cpp b/src/oatpp/core/data/buffer/FIFOBuffer.cpp index 2c1dcb87..ad011c50 100644 --- a/src/oatpp/core/data/buffer/FIFOBuffer.cpp +++ b/src/oatpp/core/data/buffer/FIFOBuffer.cpp @@ -286,7 +286,7 @@ data::v_io_size FIFOBuffer::flushToStream(data::stream::OutputStream& stream) { } -async::Pipeline FIFOBuffer::flushToStreamAsync(const std::shared_ptr& stream) +async::CoroutineStarter FIFOBuffer::flushToStreamAsync(const std::shared_ptr& stream) { class FlushCoroutine : public oatpp::async::Coroutine { @@ -352,7 +352,7 @@ async::Pipeline FIFOBuffer::flushToStreamAsync(const std::shared_ptr(shared_from_this(), stream); + return FlushCoroutine::start(shared_from_this(), stream); } diff --git a/src/oatpp/core/data/buffer/FIFOBuffer.hpp b/src/oatpp/core/data/buffer/FIFOBuffer.hpp index bcddf204..8ab81561 100644 --- a/src/oatpp/core/data/buffer/FIFOBuffer.hpp +++ b/src/oatpp/core/data/buffer/FIFOBuffer.hpp @@ -127,9 +127,9 @@ public: /** * flush all availableToRead bytes to stream in asynchronous manner * @param stream - &id:data::stream::OutputStream;. - * @return - &id:async::Pipeline;. + * @return - &id:async::CoroutineStarter;. */ - async::Pipeline flushToStreamAsync(const std::shared_ptr& stream); + async::CoroutineStarter flushToStreamAsync(const std::shared_ptr& stream); }; diff --git a/src/oatpp/core/data/stream/ChunkedBuffer.cpp b/src/oatpp/core/data/stream/ChunkedBuffer.cpp index c8d2938e..0a9d8823 100644 --- a/src/oatpp/core/data/stream/ChunkedBuffer.cpp +++ b/src/oatpp/core/data/stream/ChunkedBuffer.cpp @@ -224,7 +224,7 @@ bool ChunkedBuffer::flushToStream(const std::shared_ptr& stream){ return true; } -oatpp::async::Pipeline ChunkedBuffer::flushToStreamAsync(const std::shared_ptr& stream) { +oatpp::async::CoroutineStarter ChunkedBuffer::flushToStreamAsync(const std::shared_ptr& stream) { class FlushCoroutine : public oatpp::async::Coroutine { private: @@ -278,7 +278,7 @@ oatpp::async::Pipeline ChunkedBuffer::flushToStreamAsync(const std::shared_ptr(shared_from_this(), stream); + return FlushCoroutine::start(shared_from_this(), stream); } diff --git a/src/oatpp/core/data/stream/ChunkedBuffer.hpp b/src/oatpp/core/data/stream/ChunkedBuffer.hpp index 89f46b96..bad52d90 100644 --- a/src/oatpp/core/data/stream/ChunkedBuffer.hpp +++ b/src/oatpp/core/data/stream/ChunkedBuffer.hpp @@ -206,9 +206,9 @@ public: /** * Write all data from ChunkedBuffer to &id:oatpp::data::stream::OutputStream; in asynchronous manner. * @param stream - &id:oatpp::data::stream::OutputStream; stream to write all data to. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline flushToStreamAsync(const std::shared_ptr& stream); + oatpp::async::CoroutineStarter flushToStreamAsync(const std::shared_ptr& stream); std::shared_ptr getChunks(); diff --git a/src/oatpp/core/data/stream/Stream.cpp b/src/oatpp/core/data/stream/Stream.cpp index 8d325443..62faa2bb 100644 --- a/src/oatpp/core/data/stream/Stream.cpp +++ b/src/oatpp/core/data/stream/Stream.cpp @@ -208,10 +208,10 @@ oatpp::data::v_io_size transfer(const std::shared_ptr& fromStream, } -oatpp::async::Pipeline transferAsync(const std::shared_ptr& fromStream, - const std::shared_ptr& toStream, - oatpp::data::v_io_size transferSize, - const std::shared_ptr& buffer) { +oatpp::async::CoroutineStarter transferAsync(const std::shared_ptr& fromStream, + const std::shared_ptr& toStream, + oatpp::data::v_io_size transferSize, + const std::shared_ptr& buffer) { class TransferCoroutine : public oatpp::async::Coroutine { private: @@ -286,7 +286,7 @@ oatpp::async::Pipeline transferAsync(const std::shared_ptr& fromStr }; - return oatpp::async::AbstractCoroutine::startCoroutine(fromStream, toStream, transferSize, buffer); + return TransferCoroutine::start(fromStream, toStream, transferSize, buffer); } diff --git a/src/oatpp/core/data/stream/Stream.hpp b/src/oatpp/core/data/stream/Stream.hpp index 1fda679a..a57cc4dd 100644 --- a/src/oatpp/core/data/stream/Stream.hpp +++ b/src/oatpp/core/data/stream/Stream.hpp @@ -216,7 +216,7 @@ oatpp::data::v_io_size transfer(const std::shared_ptr& fromStream, /** * Same as transfer but asynchronous */ -oatpp::async::Pipeline transferAsync(const std::shared_ptr& fromStream, +oatpp::async::CoroutineStarter transferAsync(const std::shared_ptr& fromStream, const std::shared_ptr& toStream, oatpp::data::v_io_size transferSize, const std::shared_ptr& buffer); diff --git a/src/oatpp/core/data/stream/StreamBufferedProxy.cpp b/src/oatpp/core/data/stream/StreamBufferedProxy.cpp index e3cea990..9497e33a 100644 --- a/src/oatpp/core/data/stream/StreamBufferedProxy.cpp +++ b/src/oatpp/core/data/stream/StreamBufferedProxy.cpp @@ -42,7 +42,7 @@ data::v_io_size OutputStreamBufferedProxy::flush() { return m_buffer->flushToStream(*m_outputStream); } -oatpp::async::Pipeline OutputStreamBufferedProxy::flushAsync() { +oatpp::async::CoroutineStarter OutputStreamBufferedProxy::flushAsync() { return m_buffer->flushToStreamAsync(m_outputStream); } diff --git a/src/oatpp/core/data/stream/StreamBufferedProxy.hpp b/src/oatpp/core/data/stream/StreamBufferedProxy.hpp index 9fabc7c5..0ceeb320 100644 --- a/src/oatpp/core/data/stream/StreamBufferedProxy.hpp +++ b/src/oatpp/core/data/stream/StreamBufferedProxy.hpp @@ -74,7 +74,7 @@ public: data::v_io_size write(const void *data, data::v_io_size count) override; data::v_io_size flush(); - oatpp::async::Pipeline flushAsync(); + oatpp::async::CoroutineStarter flushAsync(); void setBufferPosition(data::v_io_size readPosition, data::v_io_size writePosition, bool canRead) { m_buffer->setBufferPosition(readPosition, writePosition, canRead); diff --git a/src/oatpp/network/ConnectionProvider.hpp b/src/oatpp/network/ConnectionProvider.hpp index 0b00fb1a..93a60812 100644 --- a/src/oatpp/network/ConnectionProvider.hpp +++ b/src/oatpp/network/ConnectionProvider.hpp @@ -85,9 +85,9 @@ public: /** * Implement this method. * Obtain IOStream representing connection to resource. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - virtual oatpp::async::CoroutineCallForResult&> getConnectionAsync() = 0; + virtual oatpp::async::CoroutineStarterForResult&> getConnectionAsync() = 0; /** * Should close all handles here. diff --git a/src/oatpp/network/client/SimpleTCPConnectionProvider.cpp b/src/oatpp/network/client/SimpleTCPConnectionProvider.cpp index 6d589069..3579b764 100644 --- a/src/oatpp/network/client/SimpleTCPConnectionProvider.cpp +++ b/src/oatpp/network/client/SimpleTCPConnectionProvider.cpp @@ -84,7 +84,7 @@ std::shared_ptr SimpleTCPConnectionProvider::getC } -oatpp::async::CoroutineCallForResult&> SimpleTCPConnectionProvider::getConnectionAsync() { +oatpp::async::CoroutineStarterForResult&> SimpleTCPConnectionProvider::getConnectionAsync() { class ConnectCoroutine : public oatpp::async::CoroutineWithResult&> { private: @@ -188,7 +188,7 @@ oatpp::async::CoroutineCallForResult&> getConnectionAsync() override; + oatpp::async::CoroutineStarterForResult&> getConnectionAsync() override; /** * Get host name. diff --git a/src/oatpp/network/server/SimpleTCPConnectionProvider.hpp b/src/oatpp/network/server/SimpleTCPConnectionProvider.hpp index 151c8bbc..63bf519c 100644 --- a/src/oatpp/network/server/SimpleTCPConnectionProvider.hpp +++ b/src/oatpp/network/server/SimpleTCPConnectionProvider.hpp @@ -87,7 +87,7 @@ public: *
* *It may be implemented later* */ - oatpp::async::CoroutineCallForResult&> getConnectionAsync() override { + oatpp::async::CoroutineStarterForResult&> getConnectionAsync() override { /* * No need to implement this. * For Asynchronous IO in oatpp it is considered to be a good practice diff --git a/src/oatpp/network/virtual_/client/ConnectionProvider.cpp b/src/oatpp/network/virtual_/client/ConnectionProvider.cpp index de7e6a7f..34d38183 100644 --- a/src/oatpp/network/virtual_/client/ConnectionProvider.cpp +++ b/src/oatpp/network/virtual_/client/ConnectionProvider.cpp @@ -51,7 +51,7 @@ std::shared_ptr ConnectionProvider::getConnection( return socket; } -oatpp::async::CoroutineCallForResult&> ConnectionProvider::getConnectionAsync() { +oatpp::async::CoroutineStarterForResult&> ConnectionProvider::getConnectionAsync() { class ConnectCoroutine : public oatpp::async::CoroutineWithResult&> { private: @@ -98,7 +98,7 @@ oatpp::async::CoroutineCallForResult&> getConnectionAsync() override; + oatpp::async::CoroutineStarterForResult&> getConnectionAsync() override; }; diff --git a/src/oatpp/network/virtual_/server/ConnectionProvider.hpp b/src/oatpp/network/virtual_/server/ConnectionProvider.hpp index 0a34bc3b..7e8e7f50 100644 --- a/src/oatpp/network/virtual_/server/ConnectionProvider.hpp +++ b/src/oatpp/network/virtual_/server/ConnectionProvider.hpp @@ -87,7 +87,7 @@ public: *
* *It may be implemented later.* */ - oatpp::async::CoroutineCallForResult&> getConnectionAsync() override { + oatpp::async::CoroutineStarterForResult&> getConnectionAsync() override { /* * No need to implement this. * For Asynchronous IO in oatpp it is considered to be a good practice diff --git a/src/oatpp/web/client/ApiClient.cpp b/src/oatpp/web/client/ApiClient.cpp index f706c7c5..508faf5d 100644 --- a/src/oatpp/web/client/ApiClient.cpp +++ b/src/oatpp/web/client/ApiClient.cpp @@ -142,7 +142,7 @@ std::shared_ptr ApiClient::getConnection() { return m_requestExecutor->getConnection(); } -oatpp::async::CoroutineCallForResult&> ApiClient::getConnectionAsync() { +oatpp::async::CoroutineStarterForResult&> ApiClient::getConnectionAsync() { return m_requestExecutor->getConnectionAsync(); } @@ -164,7 +164,7 @@ std::shared_ptr ApiClient::executeRequest(const oatpp::Stri } -oatpp::async::CoroutineCallForResult&> +oatpp::async::CoroutineStarterForResult&> ApiClient::executeRequestAsync(const oatpp::String& method, const PathPattern& pathPattern, const std::shared_ptr& headers, diff --git a/src/oatpp/web/client/ApiClient.hpp b/src/oatpp/web/client/ApiClient.hpp index 25e7e552..0551f07c 100644 --- a/src/oatpp/web/client/ApiClient.hpp +++ b/src/oatpp/web/client/ApiClient.hpp @@ -188,9 +188,9 @@ public: /** * Call &id:oatpp::web::client::RequestExecutor::getConnectionAsync;. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - virtual oatpp::async::CoroutineCallForResult&> getConnectionAsync(); + virtual oatpp::async::CoroutineStarterForResult&> getConnectionAsync(); virtual std::shared_ptr executeRequest(const oatpp::String& method, @@ -201,7 +201,7 @@ public: const std::shared_ptr& body, const std::shared_ptr& connectionHandle = nullptr); - virtual oatpp::async::CoroutineCallForResult&> + virtual oatpp::async::CoroutineStarterForResult&> executeRequestAsync(const oatpp::String& method, const PathPattern& pathPattern, const std::shared_ptr& headers, diff --git a/src/oatpp/web/client/HttpRequestExecutor.cpp b/src/oatpp/web/client/HttpRequestExecutor.cpp index c38c8620..75cb3fd4 100644 --- a/src/oatpp/web/client/HttpRequestExecutor.cpp +++ b/src/oatpp/web/client/HttpRequestExecutor.cpp @@ -63,7 +63,7 @@ std::shared_ptr HttpRequestExecutor::getC return std::make_shared(connection); } -oatpp::async::CoroutineCallForResult&> +oatpp::async::CoroutineStarterForResult&> HttpRequestExecutor::getConnectionAsync() { class GetConnectionCoroutine : public oatpp::async::CoroutineWithResult&> { @@ -85,7 +85,7 @@ HttpRequestExecutor::getConnectionAsync() { }; - return GetConnectionCoroutine::callForResult(m_connectionProvider); + return GetConnectionCoroutine::startForResult(m_connectionProvider); } @@ -144,7 +144,7 @@ HttpRequestExecutor::execute(const String& method, } -oatpp::async::CoroutineCallForResult&> +oatpp::async::CoroutineStarterForResult&> HttpRequestExecutor::executeAsync(const String& method, const String& path, const Headers& headers, @@ -227,7 +227,7 @@ HttpRequestExecutor::executeAsync(const String& method, }; - return ExecutorCoroutine::callForResult(m_connectionProvider, method, path, headers, body, m_bodyDecoder, connectionHandle); + return ExecutorCoroutine::startForResult(m_connectionProvider, method, path, headers, body, m_bodyDecoder, connectionHandle); } diff --git a/src/oatpp/web/client/HttpRequestExecutor.hpp b/src/oatpp/web/client/HttpRequestExecutor.hpp index c4c9297f..1a308d1e 100644 --- a/src/oatpp/web/client/HttpRequestExecutor.hpp +++ b/src/oatpp/web/client/HttpRequestExecutor.hpp @@ -93,9 +93,9 @@ public: /** * Same as &l:HttpRequestExecutor::getConnection (); but async. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult&> getConnectionAsync() override; + oatpp::async::CoroutineStarterForResult&> getConnectionAsync() override; /** * Execute http request. @@ -120,9 +120,9 @@ public: * @param headers - headers map &id:oatpp::web::client::RequestExecutor::Headers;. * @param body - `std::shared_ptr` to &id:oatpp::web::client::RequestExecutor::Body; object. * @param connectionHandle - ConnectionHandle obtain in call to &l:HttpRequestExecutor::getConnection ();. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult&> + oatpp::async::CoroutineStarterForResult&> executeAsync(const String& method, const String& path, const Headers& headers, diff --git a/src/oatpp/web/client/RequestExecutor.hpp b/src/oatpp/web/client/RequestExecutor.hpp index 378fdad0..44c11bf2 100644 --- a/src/oatpp/web/client/RequestExecutor.hpp +++ b/src/oatpp/web/client/RequestExecutor.hpp @@ -160,9 +160,9 @@ public: /** * Same as &l:RequestExecutor::getConnection (); but Async. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - virtual oatpp::async::CoroutineCallForResult&> getConnectionAsync() = 0; + virtual oatpp::async::CoroutineStarterForResult&> getConnectionAsync() = 0; /** * Execute request. @@ -186,9 +186,9 @@ public: * @param headers - headers map &l:RequestExecutor::Headers;. * @param body - `std::shared_ptr` to &l:RequestExecutor::Body; object. * @param connectionHandle - &l:RequestExecutor::ConnectionHandle;. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - virtual oatpp::async::CoroutineCallForResult&> + virtual oatpp::async::CoroutineStarterForResult&> executeAsync(const String& method, const String& path, const Headers& headers, diff --git a/src/oatpp/web/protocol/http/incoming/BodyDecoder.hpp b/src/oatpp/web/protocol/http/incoming/BodyDecoder.hpp index 28a5f69d..1c69a59f 100644 --- a/src/oatpp/web/protocol/http/incoming/BodyDecoder.hpp +++ b/src/oatpp/web/protocol/http/incoming/BodyDecoder.hpp @@ -115,11 +115,11 @@ public: * @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;. * @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;. * @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - virtual oatpp::async::Pipeline decodeAsync(const Headers& headers, - const std::shared_ptr& bodyStream, - const std::shared_ptr& toStream) const = 0; + virtual oatpp::async::CoroutineStarter decodeAsync(const Headers& headers, + const std::shared_ptr& bodyStream, + const std::shared_ptr& toStream) const = 0; /** * Read body stream and decode it to string. @@ -153,11 +153,11 @@ public: * Same as &l:BodyDecoder::decodeToString (); but Async. * @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;. * @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult + oatpp::async::CoroutineStarterForResult decodeToStringAsync(const Headers& headers, const std::shared_ptr& bodyStream) const { - return ToStringDecoder::callForResult(this, headers, bodyStream); + return ToStringDecoder::startForResult(this, headers, bodyStream); } /** @@ -166,14 +166,14 @@ public: * @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;. * @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;. * @param objectMapper - `std::shared_ptr` to &id:oatpp::data::mapping::ObjectMapper;. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ template - oatpp::async::CoroutineCallForResult + oatpp::async::CoroutineStarterForResult decodeToDtoAsync(const Headers& headers, const std::shared_ptr& bodyStream, const std::shared_ptr& objectMapper) const { - return ToDtoDecoder::callForResult(this, headers, bodyStream, objectMapper); + return ToDtoDecoder::startForResult(this, headers, bodyStream, objectMapper); } }; diff --git a/src/oatpp/web/protocol/http/incoming/Request.cpp b/src/oatpp/web/protocol/http/incoming/Request.cpp index f83d21ff..ad70b7f4 100644 --- a/src/oatpp/web/protocol/http/incoming/Request.cpp +++ b/src/oatpp/web/protocol/http/incoming/Request.cpp @@ -113,7 +113,7 @@ oatpp::String Request::readBodyToString() const { return m_bodyDecoder->decodeToString(m_headers, m_bodyStream); } -oatpp::async::Pipeline Request::streamBodyAsync(const std::shared_ptr& toStream) const { +oatpp::async::CoroutineStarter Request::streamBodyAsync(const std::shared_ptr& toStream) const { return m_bodyDecoder->decodeAsync(m_headers, m_bodyStream, toStream); } diff --git a/src/oatpp/web/protocol/http/incoming/Request.hpp b/src/oatpp/web/protocol/http/incoming/Request.hpp index 7b7082e7..7b246b57 100644 --- a/src/oatpp/web/protocol/http/incoming/Request.hpp +++ b/src/oatpp/web/protocol/http/incoming/Request.hpp @@ -190,15 +190,15 @@ public: /** * Transfer body stream to toStream Async * @param toStream - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline streamBodyAsync(const std::shared_ptr& toStream) const; + oatpp::async::CoroutineStarter streamBodyAsync(const std::shared_ptr& toStream) const; /** * Transfer body stream to string Async. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult readBodyToStringAsync() const { + oatpp::async::CoroutineStarterForResult readBodyToStringAsync() const { return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream); } @@ -206,10 +206,10 @@ public: * Transfer body to String and parse it as DTO * @tparam DtoType - DTO object type. * @param objectMapper - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ template - oatpp::async::CoroutineCallForResult + oatpp::async::CoroutineStarterForResult readBodyToDtoAsync(const std::shared_ptr& objectMapper) const { return m_bodyDecoder->decodeToDtoAsync(m_headers, m_bodyStream, objectMapper); } diff --git a/src/oatpp/web/protocol/http/incoming/RequestHeadersReader.cpp b/src/oatpp/web/protocol/http/incoming/RequestHeadersReader.cpp index f227e2b3..991efef8 100644 --- a/src/oatpp/web/protocol/http/incoming/RequestHeadersReader.cpp +++ b/src/oatpp/web/protocol/http/incoming/RequestHeadersReader.cpp @@ -95,7 +95,7 @@ RequestHeadersReader::Result RequestHeadersReader::readHeaders(const std::shared } -oatpp::async::CoroutineCallForResult +oatpp::async::CoroutineStarterForResult RequestHeadersReader::readHeadersAsync(const std::shared_ptr& connection) { @@ -181,7 +181,7 @@ RequestHeadersReader::readHeadersAsync(const std::shared_ptr readHeadersAsync(const std::shared_ptr& connection); + oatpp::async::CoroutineStarterForResult readHeadersAsync(const std::shared_ptr& connection); }; diff --git a/src/oatpp/web/protocol/http/incoming/Response.cpp b/src/oatpp/web/protocol/http/incoming/Response.cpp index 8b0a86b9..4a251793 100644 --- a/src/oatpp/web/protocol/http/incoming/Response.cpp +++ b/src/oatpp/web/protocol/http/incoming/Response.cpp @@ -74,7 +74,7 @@ oatpp::String Response::readBodyToString() const { return m_bodyDecoder->decodeToString(m_headers, m_bodyStream); } -oatpp::async::Pipeline Response::streamBodyAsync(const std::shared_ptr& toStream) const { +oatpp::async::CoroutineStarter Response::streamBodyAsync(const std::shared_ptr& toStream) const { return m_bodyDecoder->decodeAsync(m_headers, m_bodyStream, toStream); } diff --git a/src/oatpp/web/protocol/http/incoming/Response.hpp b/src/oatpp/web/protocol/http/incoming/Response.hpp index 2edaf19e..6df594b2 100644 --- a/src/oatpp/web/protocol/http/incoming/Response.hpp +++ b/src/oatpp/web/protocol/http/incoming/Response.hpp @@ -142,15 +142,15 @@ public: /** * Same as &l:Response::readBodyToDto (); but Async. * @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline streamBodyAsync(const std::shared_ptr& toStream) const; + oatpp::async::CoroutineStarter streamBodyAsync(const std::shared_ptr& toStream) const; /** * Same as &l:Response::readBodyToString (); but Async. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult readBodyToStringAsync() const { + oatpp::async::CoroutineStarterForResult readBodyToStringAsync() const { return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream); } @@ -158,10 +158,10 @@ public: * Same as &l:Response::readBodyToDto (); but Async. * @tparam DtoType - DTO object type. * @param objectMapper - `std::shared_ptr` to &id:oatpp::data::mapping::ObjectMapper;. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ template - oatpp::async::CoroutineCallForResult + oatpp::async::CoroutineStarterForResult readBodyToDtoAsync(const std::shared_ptr& objectMapper) const { return m_bodyDecoder->decodeToDtoAsync(m_headers, m_bodyStream, objectMapper); } diff --git a/src/oatpp/web/protocol/http/incoming/ResponseHeadersReader.cpp b/src/oatpp/web/protocol/http/incoming/ResponseHeadersReader.cpp index 486eb97d..98fbcf94 100644 --- a/src/oatpp/web/protocol/http/incoming/ResponseHeadersReader.cpp +++ b/src/oatpp/web/protocol/http/incoming/ResponseHeadersReader.cpp @@ -94,7 +94,7 @@ ResponseHeadersReader::Result ResponseHeadersReader::readHeaders(const std::shar } -oatpp::async::CoroutineCallForResult +oatpp::async::CoroutineStarterForResult ResponseHeadersReader::readHeadersAsync(const std::shared_ptr& connection) { @@ -180,7 +180,7 @@ ResponseHeadersReader::readHeadersAsync(const std::shared_ptr readHeadersAsync(const std::shared_ptr& connection); + oatpp::async::CoroutineStarterForResult readHeadersAsync(const std::shared_ptr& connection); }; diff --git a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp index b24ba353..4ba83e6a 100644 --- a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp +++ b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp @@ -110,7 +110,7 @@ void SimpleBodyDecoder::decode(const Headers& headers, } -oatpp::async::Pipeline SimpleBodyDecoder::doChunkedDecodingAsync(const std::shared_ptr& fromStream, +oatpp::async::CoroutineStarter SimpleBodyDecoder::doChunkedDecodingAsync(const std::shared_ptr& fromStream, const std::shared_ptr& toStream) { class ChunkedDecoder : public oatpp::async::Coroutine { @@ -205,13 +205,13 @@ oatpp::async::Pipeline SimpleBodyDecoder::doChunkedDecodingAsync(const std::shar }; - return oatpp::async::AbstractCoroutine::startCoroutine(fromStream, toStream); + return ChunkedDecoder::start(fromStream, toStream); } -oatpp::async::Pipeline SimpleBodyDecoder::decodeAsync(const Headers& headers, - const std::shared_ptr& bodyStream, - const std::shared_ptr& toStream) const { +oatpp::async::CoroutineStarter SimpleBodyDecoder::decodeAsync(const Headers& headers, + const std::shared_ptr& bodyStream, + const std::shared_ptr& toStream) const { auto transferEncodingIt = headers.find(Header::TRANSFER_ENCODING); if(transferEncodingIt != headers.end() && transferEncodingIt->second == Header::Value::TRANSFER_ENCODING_CHUNKED) { return doChunkedDecodingAsync(bodyStream, toStream); diff --git a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.hpp b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.hpp index 0c592a90..78a29696 100644 --- a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.hpp +++ b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.hpp @@ -40,7 +40,7 @@ private: static void doChunkedDecoding(const std::shared_ptr& from, const std::shared_ptr& toStream); - static oatpp::async::Pipeline doChunkedDecodingAsync(const std::shared_ptr& fromStream, + static oatpp::async::CoroutineStarter doChunkedDecodingAsync(const std::shared_ptr& fromStream, const std::shared_ptr& toStream); public: @@ -59,11 +59,11 @@ public: * @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;. * @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;. * @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline decodeAsync(const Headers& headers, - const std::shared_ptr& bodyStream, - const std::shared_ptr& toStream) const override; + oatpp::async::CoroutineStarter decodeAsync(const Headers& headers, + const std::shared_ptr& bodyStream, + const std::shared_ptr& toStream) const override; }; diff --git a/src/oatpp/web/protocol/http/outgoing/Body.hpp b/src/oatpp/web/protocol/http/outgoing/Body.hpp index 3333a7e6..827ac2b9 100644 --- a/src/oatpp/web/protocol/http/outgoing/Body.hpp +++ b/src/oatpp/web/protocol/http/outgoing/Body.hpp @@ -67,9 +67,9 @@ public: /** * Same as &l:Body::writeToStream (); but async. * @param stream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - virtual oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr& stream) = 0; + virtual oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr& stream) = 0; }; diff --git a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp index d4f1f691..f1cb2ab0 100644 --- a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp +++ b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp @@ -55,8 +55,8 @@ void BufferBody::writeToStream(const std::shared_ptr& stream) noex } -oatpp::async::Pipeline BufferBody::writeToStreamAsync(const std::shared_ptr& stream) { - return oatpp::async::AbstractCoroutine::startCoroutine(shared_from_this(), stream); +oatpp::async::CoroutineStarter BufferBody::writeToStreamAsync(const std::shared_ptr& stream) { + return WriteToStreamCoroutine::start(shared_from_this(), stream); } }}}}} \ No newline at end of file diff --git a/src/oatpp/web/protocol/http/outgoing/BufferBody.hpp b/src/oatpp/web/protocol/http/outgoing/BufferBody.hpp index bfcc556b..062bcc59 100644 --- a/src/oatpp/web/protocol/http/outgoing/BufferBody.hpp +++ b/src/oatpp/web/protocol/http/outgoing/BufferBody.hpp @@ -94,9 +94,9 @@ public: /** * Start &l:BufferBody::WriteToStreamCoroutine; to write buffer data to stream. * @param stream - &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr& stream) override; + oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr& stream) override; }; diff --git a/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.cpp b/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.cpp index 8f971ada..f8ebeb5a 100644 --- a/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.cpp +++ b/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.cpp @@ -113,9 +113,9 @@ async::Action ChunkedBufferBody::WriteToStreamCoroutine::writeCurrData() { return oatpp::data::stream::writeExactSizeDataAsyncInline(this, m_stream.get(), m_currData, m_currDataSize, Action::clone(m_nextAction)); } -oatpp::async::Pipeline ChunkedBufferBody::writeToStreamAsync(const std::shared_ptr& stream) { +oatpp::async::CoroutineStarter ChunkedBufferBody::writeToStreamAsync(const std::shared_ptr& stream) { if(m_chunked) { - return oatpp::async::AbstractCoroutine::startCoroutine(shared_from_this(), stream); + return WriteToStreamCoroutine::start(shared_from_this(), stream); } else { return m_buffer->flushToStreamAsync(stream); } diff --git a/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.hpp b/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.hpp index dd6ed43f..6e4fb84f 100644 --- a/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.hpp +++ b/src/oatpp/web/protocol/http/outgoing/ChunkedBufferBody.hpp @@ -112,9 +112,9 @@ public: /** * Start &l:ChunkedBufferBody::WriteToStreamCoroutine; to write buffer data to stream. * @param stream - &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr& stream) override; + oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr& stream) override; }; diff --git a/src/oatpp/web/protocol/http/outgoing/Request.cpp b/src/oatpp/web/protocol/http/outgoing/Request.cpp index e4d4ef42..2b8fb458 100644 --- a/src/oatpp/web/protocol/http/outgoing/Request.cpp +++ b/src/oatpp/web/protocol/http/outgoing/Request.cpp @@ -104,7 +104,7 @@ void Request::send(const std::shared_ptr& stream){ } -oatpp::async::Pipeline Request::sendAsync(const std::shared_ptr& stream){ +oatpp::async::CoroutineStarter Request::sendAsync(const std::shared_ptr& stream){ class SendAsyncCoroutine : public oatpp::async::Coroutine { private: @@ -163,7 +163,7 @@ oatpp::async::Pipeline Request::sendAsync(const std::shared_ptr(shared_from_this(), stream); + return SendAsyncCoroutine::start(shared_from_this(), stream); } diff --git a/src/oatpp/web/protocol/http/outgoing/Request.hpp b/src/oatpp/web/protocol/http/outgoing/Request.hpp index 16e8a4d2..6465e4f1 100644 --- a/src/oatpp/web/protocol/http/outgoing/Request.hpp +++ b/src/oatpp/web/protocol/http/outgoing/Request.hpp @@ -125,9 +125,9 @@ public: /** * Write request to stream in asynchronous manner. * @param stream - &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline sendAsync(const std::shared_ptr& stream); + oatpp::async::CoroutineStarter sendAsync(const std::shared_ptr& stream); }; diff --git a/src/oatpp/web/protocol/http/outgoing/Response.cpp b/src/oatpp/web/protocol/http/outgoing/Response.cpp index 0e24944a..3fef0261 100644 --- a/src/oatpp/web/protocol/http/outgoing/Response.cpp +++ b/src/oatpp/web/protocol/http/outgoing/Response.cpp @@ -98,7 +98,7 @@ void Response::send(const std::shared_ptr& stream) { } -oatpp::async::Pipeline Response::sendAsync(const std::shared_ptr& stream){ +oatpp::async::CoroutineStarter Response::sendAsync(const std::shared_ptr& stream){ class SendAsyncCoroutine : public oatpp::async::Coroutine { private: @@ -156,7 +156,7 @@ oatpp::async::Pipeline Response::sendAsync(const std::shared_ptr(shared_from_this(), stream); + return SendAsyncCoroutine::start(shared_from_this(), stream); } diff --git a/src/oatpp/web/protocol/http/outgoing/Response.hpp b/src/oatpp/web/protocol/http/outgoing/Response.hpp index 22346010..8d63079c 100644 --- a/src/oatpp/web/protocol/http/outgoing/Response.hpp +++ b/src/oatpp/web/protocol/http/outgoing/Response.hpp @@ -117,9 +117,9 @@ public: /** * Same as &l:Response::send (); but async. * @param stream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;. - * @return - &id:oatpp::async::Pipeline;. + * @return - &id:oatpp::async::CoroutineStarter;. */ - oatpp::async::Pipeline sendAsync(const std::shared_ptr& stream); + oatpp::async::CoroutineStarter sendAsync(const std::shared_ptr& stream); }; diff --git a/src/oatpp/web/server/api/ApiController.hpp b/src/oatpp/web/server/api/ApiController.hpp index 584d5e54..51669554 100644 --- a/src/oatpp/web/server/api/ApiController.hpp +++ b/src/oatpp/web/server/api/ApiController.hpp @@ -171,7 +171,7 @@ protected: class Handler : public oatpp::web::url::mapping::Subscriber, std::shared_ptr> { public: typedef std::shared_ptr (T::*Method)(const std::shared_ptr&); - typedef oatpp::async::CoroutineCallForResult&> + typedef oatpp::async::CoroutineStarterForResult&> (T::*MethodAsync)(const std::shared_ptr&); private: T* m_controller; @@ -197,7 +197,7 @@ protected: } } - oatpp::async::CoroutineCallForResult&> + oatpp::async::CoroutineStarterForResult&> processEventAsync(const std::shared_ptr& request) override { if(m_methodAsync != nullptr) { return (m_controller->*m_methodAsync)(request); diff --git a/src/oatpp/web/url/mapping/Router.hpp b/src/oatpp/web/url/mapping/Router.hpp index a993508d..9e58e996 100644 --- a/src/oatpp/web/url/mapping/Router.hpp +++ b/src/oatpp/web/url/mapping/Router.hpp @@ -95,9 +95,9 @@ public: /** * Call &id:oatpp::web::url::mapping::Subscriber::processEventAsync; with corresponding parameter. * @param param - * @return - &id:oatpp::async::CaroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - oatpp::async::CoroutineCallForResult processEventAsync(const Param& param) const { + oatpp::async::CoroutineStarterForResult processEventAsync(const Param& param) const { return m_subscriber->processEventAsync(param); } diff --git a/src/oatpp/web/url/mapping/Subscriber.hpp b/src/oatpp/web/url/mapping/Subscriber.hpp index 7769859f..cccbc577 100644 --- a/src/oatpp/web/url/mapping/Subscriber.hpp +++ b/src/oatpp/web/url/mapping/Subscriber.hpp @@ -48,9 +48,9 @@ public: /** * Process event in asynchronous manner. * @param event - some incoming data. - * @return - &id:oatpp::async::CoroutineCallForResult;. + * @return - &id:oatpp::async::CoroutineStarterForResult;. */ - virtual oatpp::async::CoroutineCallForResult processEventAsync(const Event& event) = 0; + virtual oatpp::async::CoroutineStarterForResult processEventAsync(const Event& event) = 0; }; }}}}