Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2ba786589c75482476c35824dd2d64c2fcdb1623
[simgrid.git] / src / surf / callbacks.cpp
1 /* Copyright (c) 2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include <xbt/asserts.h>
8
9 #include "src/surf/callbacks.h"
10
11 #include "src/surf/HostImplem.hpp"
12 #include "src/surf/surf_interface.hpp"
13
14 void surf_on_storage_created(void (*callback)(sg_storage_t))
15 {
16   simgrid::surf::storageCreatedCallbacks.connect([callback](simgrid::surf::Storage* storage) {
17     const char* id = storage->getName();
18     // TODO, create sg_storage_by_name
19     sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, id);
20     xbt_assert(s != NULL, "Storage not found for name %s", id);
21     callback(s);
22   });
23 }