• 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

92.86
/examples/quickstart/component_with_executor.cpp
1
//  Copyright (c) 2014-2017 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

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

15
#include <utility>
16

17
///////////////////////////////////////////////////////////////////////////////
18
// Define a base component which exposes the required interface
19
struct hello_world_server
20
  : hpx::components::executor_component<hpx::execution::parallel_executor,
21
        hpx::components::component_base<hello_world_server>>
22
{
23
    typedef hpx::execution::parallel_executor executor_type;
24
    typedef hpx::components::executor_component<executor_type,
25
        hpx::components::component_base<hello_world_server>>
26
        base_type;
27

28
    hello_world_server()
29
      : base_type(executor_type{})
1✔
30
    {
31
    }
32

33
    void print() const
1✔
34
    {
35
        hpx::cout << "hello world\n" << std::flush;
1✔
36
    }
1✔
37

38
    HPX_DEFINE_COMPONENT_ACTION(hello_world_server, print, print_action)
39
};
40

41
typedef hpx::components::component<hello_world_server> server_type;
42
HPX_REGISTER_COMPONENT(server_type, hello_world_server)
5✔
43

44
typedef hello_world_server::print_action print_action;
45
HPX_REGISTER_ACTION_DECLARATION(print_action)
46
HPX_REGISTER_ACTION(print_action)
×
47

48
///////////////////////////////////////////////////////////////////////////////
49
struct hello_world
1✔
50
  : hpx::components::client_base<hello_world, hello_world_server>
51
{
52
    typedef hpx::components::client_base<hello_world, hello_world_server>
53
        base_type;
54

55
    hello_world(hpx::future<hpx::id_type>&& id)
56
      : base_type(std::move(id))
1✔
57
    {
58
    }
59

60
    void print()
1✔
61
    {
62
        hpx::async<print_action>(this->get_id()).get();
2✔
63
    }
1✔
64
};
65

66
///////////////////////////////////////////////////////////////////////////////
67
int main()
1✔
68
{
69
    hello_world hw = hpx::new_<hello_world_server>(hpx::find_here());
1✔
70
    hw.print();
1✔
71

72
    return 0;
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