1#ifndef THREADED_CONNECTION_HPP_INCLUDED
2#define THREADED_CONNECTION_HPP_INCLUDED
4#include <condition_variable>
8#include "cpp_restapi_export.h"
27 using BaseConnection::BaseConnection;
28 using BaseConnection::fetch;
45 std::condition_variable m_cv;
46 unsigned m_activeCount = 0;
base class with common parts for backend specific implementations
Definition base_connection.hpp:18
BaseConnection subclass that implements fetch(url, cb) via a background std::thread.
Definition threaded_connection.hpp:25
~ThreadedConnection() override
void fetchAsync(const std::string &fullUrl, CancellationToken cancel, FetchCallback onSuccess, ErrorCallback onError) override
Definition base_connection.hpp:13
std::shared_ptr< std::atomic< bool > > CancellationToken
Token returned by asynchronous fetch(); set it to true to cancel the request.
Definition iconnection.hpp:33
std::function< void(Response)> FetchCallback
Definition iconnection.hpp:42
std::function< void(HttpError)> ErrorCallback
Definition iconnection.hpp:44