• 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

68.75
/libs/core/serialization/src/detail/pointer.cpp
1
//  Copyright (c) 2015 Anton Bikineev
2
//  Copyright (c) 2014 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/assert.hpp>
10
#include <hpx/modules/type_support.hpp>
11
#include <hpx/serialization/detail/pointer.hpp>
12
#include <hpx/serialization/input_archive.hpp>
13
#include <hpx/serialization/output_archive.hpp>
14

15
#include <cstdint>
16
#include <map>
17
#include <utility>
18

19
namespace hpx::util {
20

21
    // This is explicitly instantiated to ensure that the id is stable
22
    // across shared libraries.
23
    extra_data_id_type extra_data_helper<
573✔
24
        serialization::detail::input_pointer_tracker>::id() noexcept
25
    {
26
        static std::uint8_t id = 0;
27
        return &id;
573✔
28
    }
29

30
    extra_data_id_type extra_data_helper<
1,146✔
31
        serialization::detail::output_pointer_tracker>::id() noexcept
32
    {
33
        static std::uint8_t id = 0;
34
        return &id;
1,146✔
35
    }
36

37
    void
38
    extra_data_helper<serialization::detail::output_pointer_tracker>::reset(
×
39
        serialization::detail::output_pointer_tracker* data)
40
    {
41
        data->clear();
42
    }
×
43
}    // namespace hpx::util
44

45
namespace hpx::serialization {
46

47
    void register_pointer(
195✔
48
        input_archive& ar, std::uint64_t pos, detail::ptr_helper_ptr helper)
49
    {
50
        auto& tracker = ar.get_extra_data<detail::input_pointer_tracker>();
51
        HPX_ASSERT(tracker.find(pos) == tracker.end());
52

53
        tracker.emplace(std::make_pair(pos, HPX_MOVE(helper)));
195✔
54
    }
195✔
55

56
    detail::ptr_helper& tracked_pointer(input_archive& ar, std::uint64_t pos)
×
57
    {
58
        auto& tracker = ar.get_extra_data<detail::input_pointer_tracker>();
59

60
        auto const it = tracker.find(pos);
61
        HPX_ASSERT(it != tracker.end());
62

63
        return *it->second;
×
64
    }
65

66
    std::uint64_t track_pointer(output_archive& ar, void const* pos)
390✔
67
    {
68
        auto& tracker = ar.get_extra_data<detail::output_pointer_tracker>();
69

70
        auto const it = tracker.find(pos);
71
        if (it == tracker.end())
390✔
72
        {
73
            tracker.emplace(std::make_pair(pos, ar.bytes_written()));
390✔
74
            return static_cast<std::uint64_t>(-1);
390✔
75
        }
76
        return it->second;
×
77
    }
78
}    // namespace hpx::serialization
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