-/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
namespace filter {
/* First example of thing that we can use as a filtering criteria: a simple boolean function */
-static bool filter_speed_more_than_50Mf(simgrid::s4u::Host* host)
+static bool filter_speed_more_than_50Mf(const simgrid::s4u::Host* host)
{
return host->get_speed() > 50E6;
}
*/
class SingleCore {
public:
- bool operator()(simgrid::s4u::Host* host) { return host->get_core_count() == 1; }
+ bool operator()(const simgrid::s4u::Host* host) { return host->get_core_count() == 1; }
};
/* This functor is a bit more complex, as it saves the current state when created.
/* Use a lambda function to filter hosts: We only want multicore hosts */
XBT_INFO("Hosts currently registered with this engine: %zu", e.get_host_count());
std::vector<simgrid::s4u::Host*> list =
- e.get_filtered_hosts([](simgrid::s4u::Host* host) { return host->get_core_count() > 1; });
+ e.get_filtered_hosts([](const simgrid::s4u::Host* host) { return host->get_core_count() > 1; });
for (auto& host : list)
XBT_INFO("The following hosts have more than one core: %s", host->get_cname());