Skip to content

Commit

Permalink
add some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weilewei committed Mar 21, 2019
1 parent a6ce119 commit 99914ba
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
20 changes: 18 additions & 2 deletions src/dist_objects_4/src/server/template_dist_object.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 Weile Wei
// Copyright (c) Maxwell Resser
// Copyright (c) 2019 Maxwell Resser
// Copyright (c) 2019 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -43,7 +43,17 @@ namespace dist_object {
return &data_;
}

hpx::future<data_type> fetch()
{
HPX_ASSERT(this->get_id());

typedef typename server::partition<T>::fetch_action
action_type;
return hpx::async<action_type>(this->get_id());
}

HPX_DEFINE_COMPONENT_ACTION(partition, size);
HPX_DEFINE_COMPONENT_ACTION(partition, fetch);

private:
data_type data_;
Expand All @@ -55,13 +65,19 @@ namespace dist_object {
HPX_REGISTER_ACTION_DECLARATION( \
\
HPX_REGISTER_ACTION_DECLARATION( \
dist_object::server::partition<type>::size_action, \
dist_object::server::partition<type>::size_action, \
HPX_PP_CAT(__partition_size_action_, type)); \
HPX_REGISTER_ACTION_DECLARATION( \
dist_object::server::partition<type>::fetch_action, \
HPX_PP_CAT(__partition_fetch_action_, type)); \
/**/

#define REGISTER_PARTITION(type) \
HPX_REGISTER_ACTION(dist_object::server::partition<type>::size_action, \
HPX_PP_CAT(__partition_size_action_, type)); \
HPX_REGISTER_ACTION( \
dist_object::server::partition<type>::fetch_action, \
HPX_PP_CAT(__partition_fetch_action_, type)); \
typedef ::hpx::components::component<dist_object::server::partition<type>> \
HPX_PP_CAT(__partition_, type); \
HPX_REGISTER_COMPONENT(HPX_PP_CAT(__partition_, type)) \
Expand Down
2 changes: 1 addition & 1 deletion src/dist_objects_4/src/template_dist_object.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 Weile Wei
// Copyright (c) Maxwell Resser
// Copyright (c) 2019 Maxwell Resser
// Copyright (c) 2019 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down
15 changes: 11 additions & 4 deletions src/dist_objects_4/src/template_dist_object.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 Weile Wei
// Copyright (c) Maxwell Resser
// Copyright (c) 2019 Maxwell Resser
// Copyright (c) 2019 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -42,9 +42,7 @@ namespace dist_object {

dist_object(hpx::future<hpx::id_type> &&id) : base_type(std::move(id)) {}

dist_object(hpx::id_type &&id) : base_type(std::move(id)) {}

~dist_object();
dist_object(hpx::id_type &&id) : base_type(std::move(id)) {}
size_t size() {
HPX_ASSERT(this->get_id());
ensure_ptr();
Expand Down Expand Up @@ -77,6 +75,15 @@ namespace dist_object {
return &**ptr;
}

hpx::future<data_type> fetch()
{
HPX_ASSERT(this->get_id());

typedef typename server::partition<T>::fetch_action
action_type;
return hpx::async<action_type>(this->get_id());
}

private:
mutable std::shared_ptr<server::partition<T>> ptr;
void ensure_ptr() const {
Expand Down
2 changes: 1 addition & 1 deletion src/dist_objects_4/src/template_dist_object_client.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 Weile Wei
// Copyright (c) Maxwell Resser
// Copyright (c) 2019 Maxwell Resser
// Copyright (c) 2019 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down

0 comments on commit 99914ba

Please sign in to comment.