1 //  Copyright (c) 2007-2015 Hartmut Kaiser
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #if !defined(HPX_LCOS_ASYNC_COLOCATED_FWD_FEB_01_2014_0107PM)
7 #define HPX_LCOS_ASYNC_COLOCATED_FWD_FEB_01_2014_0107PM
8 
9 #include <hpx/config.hpp>
10 #include <hpx/lcos/async_fwd.hpp>
11 #include <hpx/lcos/future.hpp>
12 #include <hpx/runtime/actions/basic_action_fwd.hpp>
13 #include <hpx/runtime/naming/name.hpp>
14 #include <hpx/traits/extract_action.hpp>
15 #include <hpx/traits/is_continuation.hpp>
16 #include <hpx/traits/promise_local_result.hpp>
17 
18 #include <type_traits>
19 
20 namespace hpx { namespace detail
21 {
22     ///////////////////////////////////////////////////////////////////////////
23     template <typename Action, typename ...Ts>
24     lcos::future<
25         typename traits::promise_local_result<
26             typename hpx::traits::extract_action<Action>::remote_result_type
27         >::type>
28     async_colocated(naming::id_type const& id, Ts&&... vs);
29 
30     template <
31         typename Component, typename Signature, typename Derived,
32         typename ...Ts>
33     lcos::future<
34         typename traits::promise_local_result<
35             typename hpx::traits::extract_action<Derived>::remote_result_type
36         >::type>
37     async_colocated(
38         hpx::actions::basic_action<Component, Signature, Derived> /*act*/
39       , naming::id_type const& id, Ts&&... vs);
40 
41     ///////////////////////////////////////////////////////////////////////////
42     // MSVC complains about ambiguities if it sees this forward declaration
43 #if !defined(HPX_MSVC)
44     template <typename Action, typename Continuation, typename ...Ts>
45     typename std::enable_if<
46         traits::is_continuation<Continuation>::value,
47         lcos::future<
48             typename traits::promise_local_result<
49                 typename hpx::traits::extract_action<Action>::remote_result_type
50             >::type
51         >
52     >::type
53     async_colocated(Continuation && cont,
54         naming::id_type const& id, Ts&&... vs);
55 
56     template <
57         typename Continuation,
58         typename Component, typename Signature, typename Derived,
59         typename ...Ts>
60     typename std::enable_if<
61         traits::is_continuation<Continuation>::value,
62         lcos::future<
63             typename traits::promise_local_result<
64                 typename hpx::traits::extract_action<Derived>::remote_result_type
65             >::type
66         >
67     >::type
68     async_colocated(
69         Continuation && cont
70       , hpx::actions::basic_action<Component, Signature, Derived> /*act*/
71       , naming::id_type const& id, Ts&&... vs);
72 #endif
73 }}
74 
75 #if defined(HPX_HAVE_COLOCATED_BACKWARDS_COMPATIBILITY)
76 namespace hpx
77 {
78     using hpx::detail::async_colocated;
79 }
80 #endif
81 
82 #endif
83