1 /* Copyright (c) 2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include <xbt/asserts.h>
9 #include "src/surf/callbacks.h"
10 #include "src/surf/surf_interface.hpp"
11 #include "src/surf/host_interface.hpp"
13 void surf_on_host_created(void (*callback)(sg_host_t))
15 simgrid::surf::Host::onCreation.connect([callback](simgrid::surf::Host* host) {
16 callback(host->p_host);
20 void surf_on_storage_created(void (*callback)(sg_storage_t))
22 simgrid::surf::storageCreatedCallbacks.connect([callback](simgrid::surf::Storage* storage) {
23 const char* id = storage->getName();
24 // TODO, create sg_storage_by_name
25 sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, id);
26 xbt_assert(s != NULL, "Storage not found for name %s", id);