• 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/full/runtime_components/src/component_registry.cpp
1
//  Copyright (c) 2007-2024 Hartmut Kaiser
2
//  Copyright (c) 2017      Thomas Heller
3
//  Copyright (c) 2011      Bryce Lelbach
4
//
5
//  SPDX-License-Identifier: BSL-1.0
6
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
7
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8

9
#include <hpx/components_base/component_type.hpp>
10
#include <hpx/modules/logging.hpp>
11
#include <hpx/modules/prefix.hpp>
12
#include <hpx/modules/runtime_configuration.hpp>
13
#include <hpx/modules/runtime_local.hpp>
14
#include <hpx/modules/string_util.hpp>
15
#include <hpx/runtime_components/component_registry.hpp>
16

17
#include <algorithm>
18
#include <string>
19
#include <vector>
20

21
///////////////////////////////////////////////////////////////////////////////
22
namespace hpx::components::detail {
23

24
    void get_component_info(std::vector<std::string>& fillini,
25
        std::string const& filepath, bool is_static, char const* name,
892✔
26
        char const* component_string, factory_state state, char const* more)
27
    {
28
        fillini.emplace_back(std::string("[hpx.components.") + name + "]");
29
        fillini.emplace_back(std::string("name = ") + component_string);
30

1,784✔
31
        if (!is_static)
1,784✔
32
        {
33
            if (filepath.empty())
892✔
34
            {
35
                fillini.emplace_back(std::string("path = ") +
32✔
36
                    util::find_prefixes("/hpx", component_string));
37
            }
×
38
            else
×
39
            {
40
                fillini.emplace_back(std::string("path = ") + filepath);
41
            }
42
        }
96✔
43

44
        switch (state)
45
        {
46
        case hpx::components::factory_state::enabled:
892✔
47
            fillini.emplace_back("enabled = 1");
48
            break;
751✔
49
        case hpx::components::factory_state::disabled:
751✔
50
            fillini.emplace_back("enabled = 0");
751✔
51
            break;
×
52
        case hpx::components::factory_state::check:
×
53
            fillini.emplace_back("enabled = $[hpx.components.load_external]");
×
54
            break;
141✔
55
        }
141✔
56

141✔
57
        if (is_static)
58
        {
59
            fillini.emplace_back("static = 1");
892✔
60
        }
61

860✔
62
        if (more)
63
        {
64
            std::vector<std::string> data;
892✔
65
            hpx::string_util::split(
66
                data, more, hpx::string_util::is_any_of("\n"));
×
67
            std::copy(data.begin(), data.end(), std::back_inserter(fillini));
×
68
        }
×
69
    }
70

×
71
    bool is_component_enabled(char const* name)
892✔
72
    {
73
        hpx::util::runtime_configuration const& config = hpx::get_config();
892✔
74
        std::string enabled_entry = config.get_entry(
75
            std::string("hpx.components.") + name + ".enabled", "0");
892✔
76

77
        std::transform(enabled_entry.begin(), enabled_entry.end(),
2,676✔
78
            enabled_entry.begin(), [](char c) { return std::tolower(c); });
79

80
        if (enabled_entry == "no" || enabled_entry == "false" ||
892✔
81
            enabled_entry == "0")
82
        {
892✔
83
            LRT_(info).format("plugin factory disabled: {}", name);
84
            return false;    // this component has been disabled
85
        }
×
86
        return true;
×
87
    }
88
}    // namespace hpx::components::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

© 2025 Coveralls, Inc