• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #867

15 Jan 2023 08:00PM UTC coverage: 86.487% (+0.5%) from 85.951%
#867

push

StellarBot
Merge #6135

6135: Fixing warnings reported by MSVC analysis r=hkaiser a=hkaiser

- adding MSVC specific #pragma's to suppress the benign warnings


Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

120 of 120 new or added lines in 33 files covered. (100.0%)

174599 of 201880 relevant lines covered (86.49%)

1945607.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/examples/accumulators/accumulator_client.cpp
1
//  Copyright (c) 2007-2012 Hartmut Kaiser
2
//  Copyright (c) 2011 Bryce Adelstein-Lelbach
3
//  Copyright (c) 2008 Richard D Guidry Jr.
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
// hpxinspect:noinclude:hpx::util::from_string
10

11
#include <hpx/config.hpp>
12
#if !defined(HPX_COMPUTE_DEVICE_CODE)
13
#include <hpx/hpx_init.hpp>
14
#include <hpx/include/runtime.hpp>
15
#include <hpx/include/util.hpp>
16

17
#include "accumulator.hpp"
18

19
#include <iostream>
20
#include <string>
21
#include <vector>
22

23
char const* const help = "commands: reset, add [amount], query, help, quit";
24

25
///////////////////////////////////////////////////////////////////////////////
26
int hpx_main()
×
27
{
28
    {
29
        typedef examples::server::accumulator accumulator_type;
30
        typedef accumulator_type::argument_type argument_type;
31

32
        // Find the localities connected to this application.
33
        std::vector<hpx::id_type> localities = hpx::find_all_localities();
×
34

35
        // Create an accumulator component either on this locality (if the
36
        // example is executed on one locality only) or on any of the remote
37
        // localities (otherwise).
38
        examples::accumulator accu =
39
            hpx::new_<accumulator_type>(localities.back());
×
40

41
        // Print out the available commands.
42
        std::cout << help << std::endl << "> ";
×
43

44
        // Enter the interpreter loop.
45
        std::string line;
×
46
        while (std::getline(std::cin, line))
×
47
        {
48
            hpx::string_util::trim(line);
×
49

50
            std::vector<std::string> cmd;
×
51
            hpx::string_util::split(cmd, line,
×
52
                hpx::string_util::is_any_of(" \t\n"),
×
53
                hpx::string_util::token_compress_mode::on);
54

55
            if (!cmd.empty() && !cmd[0].empty())
×
56
            {
57
                // try to interpret the entered command
58
                if (cmd[0] == "reset")
×
59
                {
60
                    accu.reset();
×
61
                }
×
62
                else if (cmd[0] == "add")
×
63
                {
64
                    if (cmd.size() == 2)
×
65
                    {
66
                        accu.add(hpx::util::from_string<argument_type>(cmd[1]));
×
67
                    }
×
68
                    else
69
                    {
70
                        std::cout << "error: invalid command '" << line << "'"
×
71
                                  << std::endl
×
72
                                  << help << std::endl;
×
73
                    }
74
                }
×
75
                else if (cmd[0] == "query")
×
76
                {
77
                    std::cout << accu.query() << std::endl;
×
78
                }
×
79
                else if (cmd[0] == "help")
×
80
                {
81
                    std::cout << help << std::endl;
×
82
                }
×
83
                else if (cmd[0] == "quit")
×
84
                {
85
                    break;
×
86
                }
87
                else
88
                {
89
                    std::cout << "error: invalid command '" << line << "'"
×
90
                              << std::endl
×
91
                              << help << std::endl;
×
92
                }
93
            }
×
94

95
            std::cout << "> ";
×
96
        }
×
97
    }
×
98

99
    // Initiate shutdown of the runtime systems on all localities.
100
    return hpx::finalize();
×
101
}
×
102

103
///////////////////////////////////////////////////////////////////////////////
104
int main(int argc, char* argv[])
×
105
{
106
    // We force this example to use 2 threads by default as one of the threads
107
    // will be sitting most of the time in the kernel waiting for user input.
108
    std::vector<std::string> const cfg = {"hpx.os_threads=2"};
×
109

110
    // Initialize and run HPX.
111
    hpx::init_params init_args;
×
112
    init_args.cfg = cfg;
×
113

114
    return hpx::init(argc, argv, init_args);
×
115
}
×
116

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

© 2026 Coveralls, Inc