Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Boost future master#698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 5 commits intocpp-netlib:masterfromdvd0101:boost_future_master
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
replace std::promise/std::shared_future with boost equivalents
boost::shared_future has a richer api, notably it has the `is_ready()`method required by the `ready()` wrapper
  • Loading branch information
@dvd0101
dvd0101 committedOct 15, 2016
commit663277ef196a62f07ac80fd69c07e98304f089d2
2 changes: 1 addition & 1 deletionCMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,7 +45,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
# Always use multi-threaded Boost libraries.
set(Boost_USE_MULTI_THREADED ON)

find_package(Boost 1.58.0 REQUIRED COMPONENTS system)
find_package(Boost 1.58.0 REQUIRED COMPONENTS system thread)

if (CPP-NETLIB_ENABLE_HTTPS)
if (APPLE)
Expand Down
4 changes: 2 additions & 2 deletionsboost/network/message/directives/detail/string_value.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,10 +6,10 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/network/traits/string.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
Expand All@@ -20,7 +20,7 @@ namespace detail {

template <class Tag>
struct string_value
: mpl::if_<is_async<Tag>,std::shared_future<typename string<Tag>::type>,
: mpl::if_<is_async<Tag>,boost::shared_future<typename string<Tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<Tag>, is_same<Tag, tags::default_string>,
is_same<Tag, tags::default_wstring> >,
Expand Down
6 changes: 3 additions & 3 deletionsboost/network/message/modifiers/clear_headers.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,11 +6,11 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_pod.hpp>
#include <boost/thread/future.hpp>
#include <boost/utility/enable_if.hpp>

namespace boost {
Expand All@@ -34,8 +34,8 @@ template <class Message, class Tag>
inline typename enable_if<mpl::and_<mpl::not_<is_pod<Tag> >, is_async<Tag> >,
void>::type
clear_headers(Message const &message, Tag const &) {
std::promise<typename Message::headers_container_type> header_promise;
std::shared_future<typename Message::headers_container_type> headers_future(
boost::promise<typename Message::headers_container_type> header_promise;
boost::shared_future<typename Message::headers_container_type> headers_future(
header_promise.get_future());
message.headers(headers_future);
header_promise.set_value(typename Message::headers_container_type());
Expand Down
4 changes: 2 additions & 2 deletionsboost/network/message/traits/body.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,12 +8,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All@@ -27,7 +27,7 @@ template <class Message>
struct body
: mpl::if_<
is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
4 changes: 2 additions & 2 deletionsboost/network/message/traits/destination.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,12 +7,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All@@ -26,7 +26,7 @@ struct unsupported_tag;
template <class Message>
struct destination
: mpl::if_<is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
6 changes: 3 additions & 3 deletionsboost/network/message/traits/headers.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,14 +7,14 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/network/message/directives.hpp>
#include <boost/network/message/transformers.hpp>
#include <boost/network/message/wrappers.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand All@@ -28,7 +28,7 @@ template <class Message>
struct header_key
: mpl::if_<
is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag, tags::default_string>,
Expand All@@ -40,7 +40,7 @@ template <class Message>
struct header_value
: mpl::if_<
is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag, tags::default_string>,
Expand Down
4 changes: 2 additions & 2 deletionsboost/network/message/traits/source.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,12 +6,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All@@ -24,7 +24,7 @@ struct unsupported_tag;
template <class Message>
struct source
: mpl::if_<is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@
#include <boost/network/protocol/http/parser/incremental.hpp>
#include <boost/network/protocol/http/request_parser.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand DownExpand Up@@ -57,30 +58,30 @@ struct http_async_protocol_handler {
// TODO(dberris): review parameter necessity.
(void)get_body;

std::shared_future<string_type> source_future(
boost::shared_future<string_type> source_future(
source_promise.get_future());
source(response_, source_future);

std::shared_future<string_type> destination_future(
boost::shared_future<string_type> destination_future(
destination_promise.get_future());
destination(response_, destination_future);

std::shared_future<typename headers_container<Tag>::type> headers_future(
boost::shared_future<typename headers_container<Tag>::type> headers_future(
headers_promise.get_future());
headers(response_, headers_future);

std::shared_future<string_type> body_future(body_promise.get_future());
boost::shared_future<string_type> body_future(body_promise.get_future());
body(response_, body_future);

std::shared_future<string_type> version_future(
boost::shared_future<string_type> version_future(
version_promise.get_future());
version(response_, version_future);

std::shared_future<std::uint16_t> status_future(
boost::shared_future<std::uint16_t> status_future(
status_promise.get_future());
status(response_, status_future);

std::shared_future<string_type> status_message_future(
boost::shared_future<string_type> status_message_future(
status_message_promise.get_future());
status_message(response_, status_message_future);
}
Expand DownExpand Up@@ -339,13 +340,13 @@ struct http_async_protocol_handler {
typedef std::array<typename char_<Tag>::type, 1024> buffer_type;

response_parser_type response_parser_;
std::promise<string_type> version_promise;
std::promise<std::uint16_t> status_promise;
std::promise<string_type> status_message_promise;
std::promise<typename headers_container<Tag>::type> headers_promise;
std::promise<string_type> source_promise;
std::promise<string_type> destination_promise;
std::promise<string_type> body_promise;
boost::promise<string_type> version_promise;
boost::promise<std::uint16_t> status_promise;
boost::promise<string_type> status_message_promise;
boost::promise<typename headers_container<Tag>::type> headers_promise;
boost::promise<string_type> source_promise;
boost::promise<string_type> destination_promise;
boost::promise<string_type> body_promise;
buffer_type part;
typename buffer_type::const_iterator part_begin;
string_type partial_parsed;
Expand Down
24 changes: 12 additions & 12 deletionsboost/network/protocol/http/message/async_message.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,13 +9,13 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <cstdint>
#include <boost/optional.hpp>

// FIXME move this out to a trait
#include <set>
#include <boost/network/detail/wrapper_base.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand DownExpand Up@@ -56,31 +56,31 @@ struct async_message {

string_type const status_message() const { return status_message_.get(); }

void status_message(std::shared_future<string_type> const& future) const {
void status_message(boost::shared_future<string_type> const& future) const {
status_message_ = future;
}

string_type const version() const { return version_.get(); }

void version(std::shared_future<string_type> const& future) const {
void version(boost::shared_future<string_type> const& future) const {
version_ = future;
}

std::uint16_t status() const { return status_.get(); }

void status(std::shared_future<uint16_t> const& future) const {
void status(boost::shared_future<uint16_t> const& future) const {
status_ = future;
}

string_type const source() const { return source_.get(); }

void source(std::shared_future<string_type> const& future) const {
void source(boost::shared_future<string_type> const& future) const {
source_ = future;
}

string_type const destination() const { return destination_.get(); }

void destination(std::shared_future<string_type> const& future) const {
void destination(boost::shared_future<string_type> const& future) const {
destination_ = future;
}

Expand All@@ -95,7 +95,7 @@ struct async_message {
return *retrieved_headers_;
}

void headers(std::shared_future<headers_container_type> const& future)
void headers(boost::shared_future<headers_container_type> const& future)
const {
headers_ = future;
}
Expand All@@ -112,7 +112,7 @@ struct async_message {

string_type const body() const { return body_.get(); }

void body(std::shared_future<string_type> const& future) const {
void body(boost::shared_future<string_type> const& future) const {
body_ = future;
}

Expand All@@ -132,13 +132,13 @@ struct async_message {
}

private:
mutablestd::shared_future<string_type> status_message_, version_, source_,
mutableboost::shared_future<string_type> status_message_, version_, source_,
destination_;
mutablestd::shared_future<std::uint16_t> status_;
mutablestd::shared_future<headers_container_type> headers_;
mutableboost::shared_future<std::uint16_t> status_;
mutableboost::shared_future<headers_container_type> headers_;
mutable headers_container_type added_headers;
mutable std::set<string_type> removed_headers;
mutablestd::shared_future<string_type> body_;
mutableboost::shared_future<string_type> body_;
mutable boost::optional<headers_container_type> retrieved_headers_;

friend struct boost::network::http::impl::ready_wrapper<Tag>;
Expand Down
8 changes: 4 additions & 4 deletionsboost/network/protocol/http/message/directives/status.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,11 +7,11 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <cstdint>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/tags.hpp>
#include <boost/thread/future.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant.hpp>
Expand All@@ -25,18 +25,18 @@ struct basic_response;

struct status_directive {

boost::variant<std::uint16_t,std::shared_future<std::uint16_t> >
boost::variant<std::uint16_t,boost::shared_future<std::uint16_t> >
status_;

explicit status_directive(std::uint16_t status) : status_(status) {}

explicit status_directive(std::shared_future<std::uint16_t> const &status)
explicit status_directive(boost::shared_future<std::uint16_t> const &status)
: status_(status) {}

status_directive(status_directive const &other) : status_(other.status_) {}

template <class Tag>
struct value : mpl::if_<is_async<Tag>,std::shared_future<std::uint16_t>,
struct value : mpl::if_<is_async<Tag>,boost::shared_future<std::uint16_t>,
std::uint16_t> {};

template <class Tag>
Expand Down
3 changes: 2 additions & 1 deletionboost/network/protocol/http/message/traits/status.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@
#include<cstdint>
#include<boost/network/support/is_async.hpp>
#include<boost/network/tags.hpp>
#include<boost/thread/future.hpp>

namespaceboost {
namespacenetwork {
Expand All@@ -23,7 +24,7 @@ template <class Message>
structstatus
: mpl::if_<
is_async<typename Message::tag>,
std::shared_future<std::uint16_t>,
boost::shared_future<std::uint16_t>,
typename mpl::if_<is_sync<typename Message::tag>, std::uint16_t,
unsupported_tag<typename Message::tag> >::type> {};

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,11 +6,11 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand All@@ -25,7 +25,7 @@ template <class Message>
struct status_message
: mpl::if_<
is_async<typename Message::tag>,
std::shared_future<typename string<typename Message::tag>::type>,
boost::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag, boost::network::tags::default_string>,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp