• 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

85.71
/examples/quickstart/component_in_executable.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
//  Copyright (c) 2012 Bryce Adelstein-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

9
#include <hpx/config.hpp>
10
#if !defined(HPX_COMPUTE_DEVICE_CODE)
11
#include <hpx/hpx_main.hpp>
12
#include <hpx/include/actions.hpp>
13
#include <hpx/include/components.hpp>
14
#include <hpx/iostream.hpp>
15

16
#include <utility>
17

18
using hpx::components::client_base;
19
using hpx::components::component;
20
using hpx::components::component_base;
21

22
using hpx::async;
23
using hpx::find_here;
24

25
using hpx::cout;
26

27
struct hello_world_server : component_base<hello_world_server>
28
{
29
    void print() const
1✔
30
    {
31
        cout << "hello world\n" << std::flush;
1✔
32
    }
1✔
33

34
    HPX_DEFINE_COMPONENT_ACTION(hello_world_server, print, print_action)
35
};
36

37
typedef component<hello_world_server> server_type;
38
HPX_REGISTER_COMPONENT(server_type, hello_world_server)
5✔
39

40
typedef hello_world_server::print_action print_action;
41
HPX_REGISTER_ACTION_DECLARATION(print_action)
42
HPX_REGISTER_ACTION(print_action)
×
43

44
struct hello_world : client_base<hello_world, hello_world_server>
1✔
45
{
46
    typedef client_base<hello_world, hello_world_server> base_type;
47

48
    hello_world() = default;
49
    explicit hello_world(hpx::id_type const& id)
50
      : base_type(id)
1✔
51
    {
52
    }
53
    hello_world(hpx::future<hpx::id_type>&& id)
54
      : base_type(std::move(id))
×
55
    {
56
    }
57

58
    void print()
1✔
59
    {
60
        async<print_action>(this->get_id()).get();
2✔
61
    }
1✔
62
};
63

64
///////////////////////////////////////////////////////////////////////////////
65
int main()
1✔
66
{
67
    hello_world hw = hpx::new_<hello_world>(find_here());
1✔
68

69
    hw.print();
1✔
70

71
    return 0;
72
}
73

74
#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