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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

42.39
/libs/full/parcelset_base/src/parcel_interface.cpp
1
//  Copyright (c) 2007-2025 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach
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

10
#if defined(HPX_HAVE_NETWORKING)
11
#include <hpx/modules/format.hpp>
12
#include <hpx/modules/serialization.hpp>
13
#include <hpx/modules/thread_support.hpp>
14
#include <hpx/modules/threading_base.hpp>
15

16
#include <hpx/naming_base/address.hpp>
17
#include <hpx/naming_base/gid_type.hpp>
18
#include <hpx/naming_base/id_type.hpp>
19
#include <hpx/parcelset_base/locality.hpp>
20
#include <hpx/parcelset_base/locality_interface.hpp>
21
#include <hpx/parcelset_base/parcel_interface.hpp>
22
#include <hpx/parcelset_base/parcelset_base_fwd.hpp>
23

24
#include <cstddef>
25
#include <cstdint>
26
#include <map>
27
#include <memory>
28
#include <string>
29

30
namespace hpx::parcelset {
31

32
    parcel empty_parcel;
33

34
    bool parcel::is_valid() const
35
    {
×
36
        return data_ && data_->is_valid();
37
    }
×
38

39
    parcel::parcel() = default;
40

478✔
41
    parcel::parcel(detail::parcel_base* p)
42
      : data_(p)
828✔
43
    {
44
    }
45

828✔
46
    parcel::~parcel() = default;
47

3,173✔
48
    parcel::parcel(parcel const&) = default;
49
    parcel::parcel(parcel&&) noexcept = default;
×
50
    parcel& parcel::operator=(parcel const&) = default;
1,867✔
51
    parcel& parcel::operator=(parcel&&) noexcept = default;
×
52

414✔
53
    void parcel::reset() const
54
    {
×
55
        data_->reset();
56
    }
×
57

×
58
    char const* parcel::get_action_name() const
59
    {
×
60
        return data_->get_action_name();
61
    }
×
62

63
    int parcel::get_component_type() const
64
    {
×
65
        return data_->get_component_type();
66
    }
×
67

68
    int parcel::get_action_type() const
69
    {
×
70
        return data_->get_action_type();
71
    }
×
72

73
    hpx::id_type parcel::source_id() const
74
    {
408✔
75
        return data_->source_id();
76
    }
408✔
77

78
    void parcel::set_source_id(hpx::id_type const& source_id) const
79
    {
408✔
80
        data_->set_source_id(source_id);
81
    }
408✔
82

408✔
83
    void parcel::set_destination_id(naming::gid_type&& dest) const
84
    {
×
85
        data_->set_destination_id(HPX_MOVE(dest));
86
    }
×
87

×
88
    naming::address const& parcel::addr() const
89
    {
×
90
        return data_->addr();
91
    }
×
92

93
    naming::address& parcel::addr()
94
    {
408✔
95
        return data_->addr();
96
    }
408✔
97

98
    std::uint32_t parcel::destination_locality_id() const
99
    {
×
100
        return data_->destination_locality_id();
101
    }
×
102

103
    naming::gid_type const& parcel::destination() const
104
    {
408✔
105
        return data_->destination();
106
    }
408✔
107

108
    naming::gid_type const& parcel::destination_locality() const
109
    {
414✔
110
        return data_->destination_locality();
111
    }
414✔
112

113
    double parcel::start_time() const
114
    {
×
115
        return data_->start_time();
116
    }
×
117

118
    void parcel::set_start_time(double time) const
119
    {
×
120
        data_->set_start_time(time);
121
    }
×
122

×
123
    double parcel::creation_time() const
124
    {
×
125
        return data_->creation_time();
126
    }
×
127

128
    threads::thread_priority parcel::get_thread_priority() const
129
    {
×
130
        return data_->get_thread_priority();
131
    }
×
132

133
    threads::thread_stacksize parcel::get_thread_stacksize() const
134
    {
×
135
        return data_->get_thread_stacksize();
136
    }
×
137

138
    std::uint32_t parcel::get_parent_locality_id() const
139
    {
×
140
        return data_->get_parent_locality_id();
141
    }
×
142

143
    threads::thread_id_type parcel::get_parent_thread_id() const
144
    {
×
145
        return data_->get_parent_thread_id();
146
    }
×
147

148
    std::uint64_t parcel::get_parent_thread_phase() const
149
    {
×
150
        return data_->get_parent_thread_phase();
151
    }
×
152

153
#if defined(HPX_HAVE_NETWORKING)
154
    serialization::binary_filter* parcel::get_serialization_filter() const
155
    {
414✔
156
        return data_ ? data_->get_serialization_filter() : nullptr;
157
    }
414✔
158

159
    policies::message_handler* parcel::get_message_handler(
160
        locality const& loc) const
375✔
161
    {
162
        return data_ ? data_->get_message_handler(loc) : nullptr;
163
    }
375✔
164
#endif
165

166
    bool parcel::does_termination_detection() const
167
    {
816✔
168
        return data_ ? data_->does_termination_detection() : false;
169
    }
816✔
170

171
    parcel::split_gids_type parcel::move_split_gids() const
172
    {
414✔
173
        return data_->move_split_gids();
174
    }
414✔
175

176
    void parcel::set_split_gids(split_gids_type&& split_gids) const
177
    {
×
178
        data_->set_split_gids(HPX_MOVE(split_gids));
179
    }
×
180

×
181
    std::size_t parcel::num_chunks() const
182
    {
414✔
183
        return data_->num_chunks();
184
    }
414✔
185

186
    std::size_t& parcel::num_chunks()
187
    {
423✔
188
        return data_->num_chunks();
189
    }
423✔
190

191
    std::size_t parcel::size() const
192
    {
414✔
193
        return data_->size();
194
    }
414✔
195

196
    std::size_t& parcel::size()
197
    {
423✔
198
        return data_->size();
199
    }
423✔
200

201
    bool parcel::schedule_action(std::size_t num_thread) const
202
    {
×
203
        return data_->schedule_action(num_thread);
204
    }
×
205

206
    // returns true if parcel was migrated, false if scheduled locally
207
    bool parcel::load_schedule(serialization::input_archive& ar,
208
        std::size_t num_thread, bool& deferred_schedule)
414✔
209
    {
210
        *this = parcelset::create_parcel();
211
        return data_->load_schedule(ar, num_thread, deferred_schedule);
414✔
212
    }
414✔
213

214
#if defined(HPX_HAVE_PARCEL_PROFILING)
215
    naming::gid_type const& parcel::parcel_id() const
216
    {
217
        return data_->parcel_id();
218
    }
219

220
    naming::gid_type& parcel::parcel_id()
221
    {
222
        return data_->parcel_id();
223
    }
224

225
    // generate unique parcel id
226
    naming::gid_type parcel::generate_unique_id(std::uint32_t locality_id)
227
    {
228
        static hpx::util::atomic_count id(0);
229

230
        naming::gid_type result = naming::get_gid_from_locality_id(locality_id);
231
        result.set_lsb(++id);
232
        return result;
233
    }
234
#else
235
    naming::gid_type const& parcel::parcel_id() const
236
    {
×
237
        return naming::invalid_gid;
238
    }
×
239
#endif
240

241
    ///////////////////////////////////////////////////////////////////////////
242
    void parcel::serialize(serialization::input_archive& ar, unsigned)
243
    {
×
244
        *this = parcelset::create_parcel();
245
        data_->load(ar, 0);
×
246
    }
×
247

×
248
    void parcel::serialize(serialization::output_archive& ar, unsigned) const
249
    {
837✔
250
        data_->save(ar, 0);
251
    }
837✔
252

837✔
253
    ///////////////////////////////////////////////////////////////////////////
254
    std::ostream& operator<<(std::ostream& os, parcel const& p)
255
    {
×
256
        return hpx::util::format_to(
257
            os, "({}:{}:{})", p.destination(), p.addr(), p.get_action_name());
×
258
    }
×
259

260
    std::string dump_parcel(parcel const& p)
261
    {
×
262
        return hpx::util::to_string(p);
263
    }
×
264
}    // namespace hpx::parcelset
265

266
#endif
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