• 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

66.67
/libs/core/serialization/src/detail/polymorphic_intrusive_factory.cpp
1
//  Copyright (c) 2014 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.
6
//  See accompanying file LICENSE_1_0.txt or copy at
7
//  http://www.boost.org/LICENSE_1_0.txt)
8

9
#include <hpx/serialization/detail/polymorphic_intrusive_factory.hpp>
10

11
#include <hpx/config.hpp>
12
#include <hpx/modules/errors.hpp>
13
#include <hpx/modules/type_support.hpp>
14

15
#include <string>
16

17
namespace hpx::serialization::detail {
18

19
    polymorphic_intrusive_factory& polymorphic_intrusive_factory::instance()
132✔
20
    {
21
        static polymorphic_intrusive_factory factory;
22
        return factory;
132✔
23
    }
24

25
    void polymorphic_intrusive_factory::register_class(
132✔
26
        std::string const& name, ctor_type fun)
27
    {
28
        if (name.empty())
132✔
29
        {
30
            HPX_THROW_EXCEPTION(hpx::error::serialization_error,
×
31
                "polymorphic_intrusive_factory::register_class",
32
                "Cannot register a factory with an empty name");
33
        }
34

35
        if (auto const it = map_.find(name); it == map_.end())
36
        {
132✔
37
            map_.emplace(name, fun);
38
        }
39
    }
40

132✔
41
    void* polymorphic_intrusive_factory::create(std::string const& name) const
42
    {
×
43
        return map_.at(name)();
44
    }
×
45
}    // namespace hpx::serialization::detail
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

© 2026 Coveralls, Inc