This method takes any callable object (lambda, function, functor = function object)
that returns a boolean value (true = use this host, false = don't use it)
and that takes a Host* as parameter.
This allows to filter within the Engine rather than returning
a list with all hosts
+# THIS IS ONLY FOR THE FILES. To add your test (tesh) as well, make sure you add
+# the same at the bottom of the file as well.
foreach (example actor-create actor-daemon actor-join actor-kill
actor-lifetime actor-migration actor-suspend actor-yield
app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitany async-waitall
cloud-capping cloud-migration cloud-simple
energy-exec energy-boot energy-link energy-vm
foreach (example actor-create actor-daemon actor-join actor-kill
actor-lifetime actor-migration actor-suspend actor-yield
app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitany async-waitall
cloud-capping cloud-migration cloud-simple
energy-exec energy-boot energy-link energy-vm
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
io-file-system io-file-remote io-storage-raw
mutex
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
io-file-system io-file-remote io-storage-raw
mutex
cloud-capping cloud-migration cloud-simple
dht-chord dht-kademlia
energy-exec energy-boot energy-link energy-vm
cloud-capping cloud-migration cloud-simple
dht-chord dht-kademlia
energy-exec energy-boot energy-link energy-vm
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
platform-properties plugin-hostload mutex
io-file-system io-file-remote io-storage-raw
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
platform-properties plugin-hostload mutex
io-file-system io-file-remote io-storage-raw
public:
size_t get_host_count();
std::vector<Host*> get_all_hosts();
public:
size_t get_host_count();
std::vector<Host*> get_all_hosts();
+ std::vector<Host*> get_filtered_hosts(std::function<bool(Host*)> filter);
simgrid::s4u::Host* host_by_name(std::string name);
simgrid::s4u::Host* host_by_name_or_null(std::string name);
simgrid::s4u::Host* host_by_name(std::string name);
simgrid::s4u::Host* host_by_name_or_null(std::string name);
+std::vector<Host*> Engine::get_filtered_hosts(std::function<bool(Host*)> filter)
+{
+ std::vector<Host*> hosts;
+ for (auto const& kv : pimpl->hosts_) {
+ if (filter(kv.second))
+ hosts.push_back(kv.second);
+ }
+
+ return hosts;
+}
+
void Engine::host_register(std::string name, simgrid::s4u::Host* host)
{
pimpl->hosts_[name] = host;
void Engine::host_register(std::string name, simgrid::s4u::Host* host)
{
pimpl->hosts_[name] = host;