-/* Copyright (c) 2017-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* - Attach some user data to disk1 */
XBT_INFO("*** Get/set data for storage element: Disk1 ***");
- const auto* data = disk->get_data<std::string>();
+ auto data = disk->get_unique_data<std::string>();
XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
disk->set_data(new std::string("Some user data"));
- data = disk->get_data<std::string>();
+ data = disk->get_unique_data<std::string>();
XBT_INFO("Set and get data: '%s'", data->c_str());
- delete data;
}
int main(int argc, char** argv)
e.load_platform(argv[1]);
/* - Display Host properties */
- for (auto h : e.get_all_hosts()) {
+ for (auto const* h : e.get_all_hosts()) {
XBT_INFO("*** %s properties ****", h->get_cname());
- for (auto const& kv : *h->get_properties())
- XBT_INFO(" %s -> %s", kv.first.c_str(), kv.second.c_str());
+ for (auto const& [key, value] : *h->get_properties())
+ XBT_INFO(" %s -> %s", key.c_str(), value.c_str());
}
sg4::Actor::create("", e.host_by_name("bob"), host);