static double sg_host_get_available_at(const simgrid::s4u::Host* host)
{
- return static_cast<HostAttribute*>(host->get_data())->available_at;
+ return host->get_data<HostAttribute>()->available_at;
}
-static void sg_host_set_available_at(simgrid::s4u::Host* host, double time)
+static void sg_host_set_available_at(const simgrid::s4u::Host* host, double time)
{
- auto* attr = static_cast<HostAttribute*>(host->get_data());
- attr->available_at = time;
+ host->get_data<HostAttribute>()->available_at = time;
}
static simgrid::s4u::Exec* sg_host_get_last_scheduled_task(const simgrid::s4u::Host* host)
{
- return static_cast<HostAttribute*>(host->get_data())->last_scheduled_task;
+ return host->get_data<HostAttribute>()->last_scheduled_task;
}
-static void sg_host_set_last_scheduled_task(simgrid::s4u::Host* host, simgrid::s4u::ExecPtr task)
+static void sg_host_set_last_scheduled_task(const simgrid::s4u::Host* host, simgrid::s4u::ExecPtr task)
{
- auto* attr = static_cast<HostAttribute*>(host->get_data());
- attr->last_scheduled_task = task.get();
+ host->get_data<HostAttribute>()->last_scheduled_task = task.get();
}
static bool dependency_exists(const simgrid::s4u::Exec* src, simgrid::s4u::Exec* dst)
}
// We use the user data field to store the finish time of the predecessor of the comm, i.e., its potential start
// time
- data_available = *(static_cast<double*>(comm->get_data())) + redist_time;
+ data_available = *comm->get_data<double>() + redist_time;
}
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(parent.get());
auto* comm = dynamic_cast<simgrid::s4u::Comm*>(pred.get());
if (comm != nullptr) {
comm->set_destination(host);
- delete static_cast<double*>(comm->get_data());
+ delete comm->get_data<double>();
}
}
// we can also set the source of all the output comms of this exec
std::set<simgrid::s4u::Activity*> vetoed;
e.track_vetoed_activities(&vetoed);
- simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
// when an Exec completes, we need to set the potential start time of all its ouput comms
- const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
+ const auto* exec = dynamic_cast<simgrid::s4u::Exec const*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
for (const auto& succ : exec->get_successors()) {