Containers are not allowes to hold references.
myHost(const char*procname, simgrid::s4u::Host *host,int argc, char **argv)
: simgrid::s4u::Actor(procname,host,argc,argv){}
myHost(const char*procname, simgrid::s4u::Host *host,int argc, char **argv)
: simgrid::s4u::Actor(procname,host,argc,argv){}
- void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts) {
+ void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage*> &mounts) {
XBT_INFO("Storage info on %s:",
simgrid::s4u::Host::current()->name().c_str());
for (const auto&kv : mounts) {
const char* mountpoint = kv.first.c_str();
XBT_INFO("Storage info on %s:",
simgrid::s4u::Host::current()->name().c_str());
for (const auto&kv : mounts) {
const char* mountpoint = kv.first.c_str();
- simgrid::s4u::Storage &storage = kv.second;
+ simgrid::s4u::Storage &storage = *kv.second;
// Retrieve disk's information
sg_size_t free_size = storage.size_free();
// Retrieve disk's information
sg_size_t free_size = storage.size_free();
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
- boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts =
+ boost::unordered_map <std::string, simgrid::s4u::Storage *>& mounts =
simgrid::s4u::Host::current()->mountedStorages();
show_info(mounts);
simgrid::s4u::Host::current()->mountedStorages();
show_info(mounts);
* Do not change the returned value in any way.
*/
// TODO, do not use Storage&, this looks dangerous!
* Do not change the returned value in any way.
*/
// TODO, do not use Storage&, this looks dangerous!
- boost::unordered_map<std::string, Storage&> &mountedStorages();
+ boost::unordered_map<std::string, Storage*> &mountedStorages();
private:
simgrid::xbt::string name_ = "noname";
private:
simgrid::xbt::string name_ = "noname";
- boost::unordered_map<std::string, Storage&> *mounts = NULL; // caching
+ boost::unordered_map<std::string, Storage*> *mounts = NULL; // caching
void* p_userdata = NULL;
public:
void* p_userdata = NULL;
public:
return this->pimpl_cpu->getNbPStates();
}
return this->pimpl_cpu->getNbPStates();
}
-boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
+boost::unordered_map<std::string, Storage*> &Host::mountedStorages() {
- mounts = new boost::unordered_map<std::string, Storage&> ();
+ mounts = new boost::unordered_map<std::string, Storage*> ();
xbt_dict_t dict = this->getMountedStorageList();
xbt_dict_t dict = this->getMountedStorageList();
char *mountname;
char *storagename;
xbt_dict_foreach(dict, cursor, mountname, storagename) {
char *mountname;
char *storagename;
xbt_dict_foreach(dict, cursor, mountname, storagename) {
- mounts->insert({mountname, Storage::byName(storagename)});
+ mounts->insert({mountname, &Storage::byName(storagename)});
}
xbt_dict_free(&dict);
}
}
xbt_dict_free(&dict);
}