• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #853

19 Dec 2022 01:01AM UTC coverage: 86.287% (+0.4%) from 85.912%
#853

push

StellarBot
Merge #6109

6109: Modernize serialization module r=hkaiser a=hkaiser

- flyby separate serialization of Boost types

working towards https://github.com/STEllAR-GROUP/hpx/issues/5497

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

53 of 53 new or added lines in 6 files covered. (100.0%)

173939 of 201582 relevant lines covered (86.29%)

1931657.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.58
/libs/full/async_distributed/src/continuation.cpp
1
//  Copyright (c) 2007-2020 Hartmut Kaiser
2
//  Copyright (c) 2016 Thomas Heller
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/config.hpp>
9
#include <hpx/actions/transfer_action.hpp>
10
#include <hpx/actions_base/traits/action_priority.hpp>
11
#include <hpx/actions_base/traits/extract_action.hpp>
12
#include <hpx/async_distributed/continuation.hpp>
13
#include <hpx/async_distributed/transfer_continuation_action.hpp>
14
#include <hpx/async_distributed/trigger_lco.hpp>
15
#include <hpx/modules/errors.hpp>
16
#include <hpx/naming/credit_handling.hpp>
17

18
#include <exception>
19
#include <utility>
20

21
///////////////////////////////////////////////////////////////////////////////
22
namespace hpx { namespace actions {
23

24
    continuation::continuation() = default;
478,141✔
25

26
    continuation::continuation(hpx::id_type const& id)
12,087✔
27
      : id_(id)
12,087✔
28
    {
29
        // Try to resolve the address locally ...
30
        if (id_ && !agas::is_local_address_cached(id_, addr_))
12,087✔
31
        {
32
            addr_ = naming::address();
1,750✔
33
        }
1,750✔
34
    }
12,087✔
35

36
    continuation::continuation(hpx::id_type&& id)
11,192✔
37
      : id_(HPX_MOVE(id))
11,192✔
38
    {
39
        // Try to resolve the address locally ...
40
        if (id_ && !agas::is_local_address_cached(id_, addr_))
11,192✔
41
        {
42
            addr_ = naming::address();
×
43
        }
×
44
    }
11,192✔
45

46
    continuation::continuation(hpx::id_type const& id, naming::address&& addr)
×
47
      : id_(id)
×
48
      , addr_(HPX_MOVE(addr))
×
49
    {
50
    }
×
51

52
    continuation::continuation(
588,905✔
53
        hpx::id_type&& id, naming::address&& addr) noexcept
54
      : id_(HPX_MOVE(id))
588,905✔
55
      , addr_(HPX_MOVE(addr))
588,905✔
56
    {
57
    }
588,905✔
58

59
    continuation::continuation(continuation&& o) noexcept = default;
1,440,599✔
60

61
    continuation& continuation::operator=(continuation&& o) noexcept = default;
400✔
62

63
    ///////////////////////////////////////////////////////////////////////////
64
    void continuation::trigger_error(std::exception_ptr const& e)
×
65
    {
66
        if (!id_)
×
67
        {
68
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
69
                "continuation::trigger_error",
70
                "attempt to trigger invalid LCO (the id is invalid)");
71
            return;
72
        }
73

74
        LLCO_(info).format("continuation::trigger_error({})", id_);
×
75
        set_lco_error(id_, this->get_addr(), e);
×
76
    }
×
77

78
    void continuation::trigger_error(std::exception_ptr&& e)    //-V659
7,147✔
79
    {
80
        if (!id_)
7,147✔
81
        {
82
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
83
                "continuation::trigger_error",
84
                "attempt to trigger invalid LCO (the id is invalid)");
85
            return;
86
        }
87

88
        LLCO_(info).format("continuation::trigger_error({})", id_);
7,147✔
89
        set_lco_error(id_, this->get_addr(), HPX_MOVE(e));
7,147✔
90
    }
7,147✔
91

92
    void continuation::serialize(
220,749✔
93
        hpx::serialization::input_archive& ar, unsigned)
94
    {
95
        // clang-format off
96
        ar & id_ & addr_;
220,749✔
97
        // clang-format on
98
    }
220,749✔
99

100
    void continuation::serialize(
442,044✔
101
        hpx::serialization::output_archive& ar, unsigned)
102
    {
103
        // clang-format off
104
        ar & id_ & addr_;
442,044✔
105
        // clang-format on
106
    }
442,044✔
107

108
    ///////////////////////////////////////////////////////////////////////////
109
    void typed_continuation<void, util::unused_type>::serialize(
24,071✔
110
        hpx::serialization::input_archive& ar, unsigned)
111
    {
112
        // clang-format off
113
        // serialize base class
114
        ar & hpx::serialization::base_object<continuation>(*this);
24,071✔
115
        ar & f_;
24,071✔
116
        // clang-format on
117
    }
24,071✔
118

119
    void typed_continuation<void, util::unused_type>::serialize(
48,220✔
120
        hpx::serialization::output_archive& ar, unsigned)
121
    {
122
        // clang-format off
123
        // serialize base class
124
        ar & hpx::serialization::base_object<continuation>(*this);
48,220✔
125
        ar & f_;
48,220✔
126
        // clang-format on
127
    }
48,220✔
128

129
    void typed_continuation<void, util::unused_type>::trigger()
78,877✔
130
    {
131
        LLCO_(info).format(
78,877✔
132
            "typed_continuation<void>::trigger({})", this->get_id());
78,825✔
133

134
        if (f_.empty())
78,877✔
135
        {
136
            if (!this->get_id())
78,877✔
137
            {
138
                HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
139
                    "typed_continuation<void>::trigger",
140
                    "attempt to trigger invalid LCO (the id is invalid)");
141
                return;
142
            }
143
            trigger_lco_event(this->get_id(), this->get_addr());
78,877✔
144
        }
78,877✔
145
        else
146
        {
147
            f_(this->get_id());
×
148
        }
149
    }
78,877✔
150
}}    // namespace hpx::actions
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc