surf_host_model_t surf_host_get_model(sg_host_t host)
{
simgrid::surf::Host* surf_host =
- (simgrid::surf::Host*) host->facet(SURF_HOST_LEVEL);
+ (simgrid::surf::Host*) host->facet<simgrid::surf::Host>();
return (surf_host_model_t) surf_host->getModel();
}
return resource->getName();
}
-xbt_dict_t surf_resource_get_properties(surf_cpp_resource_t resource){
- return resource->getProperties();
-}
-
e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource){
return resource->getState();
}
return get_casted_host(host)->sleep(duration);
}
+xbt_dict_t sg_host_get_properties(sg_host_t host) {
+ return get_casted_host(host)->getProperties();
+}
+
double surf_host_get_speed(sg_host_t host, double load){
return sg_host_surfcpu(host)->getSpeed(load);
}
}
void surf_vm_destroy(sg_host_t resource){
- /* Before clearing the entries in host_lib, we have to pick up resources. */
- const char* name = resource->id().c_str();
/* We deregister objects from host_lib, without invoking the freeing callback
* of each level.
*
*/
sg_host_surfcpu_destroy(resource);
sg_host_edge_destroy(resource,1);
- // TODO, use backlink from simgrid::surf::Host to simgrid::Host
- simgrid::Host::by_name_or_null(name)->set_facet(SURF_HOST_LEVEL, nullptr);
+ resource->set_facet<simgrid::surf::Host>(nullptr);
/* TODO: comment out when VM storage is implemented. */
// host->set_facet(SURF_STORAGE_LEVEL, nullptr);
return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getUsedSize();
}
+xbt_dict_t surf_storage_get_properties(surf_resource_t resource){
+ return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getProperties();
+}
+
const char* surf_storage_get_host(surf_resource_t resource){
return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->p_attach;
}