1 /* Copyright (c) 2015-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "PropertyHolder.hpp"
11 /** @brief Return the property associated to the provided key (or nullptr if not existing) */
12 const char* PropertyHolder::get_property(const std::string& key) const
16 auto prop = properties_->find(key);
17 return prop == properties_->end() ? nullptr : prop->second.c_str();
20 /** @brief Change the value of a given key in the property set */
21 void PropertyHolder::set_property(const std::string& key, const std::string& value)
24 properties_.reset(new std::unordered_map<std::string, std::string>);
25 (*properties_)[key] = value;
28 /** @brief Return the whole set of properties. Don't mess with it, dude! */
29 std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
32 properties_.reset(new std::unordered_map<std::string, std::string>);
33 return properties_.get();
36 } /* namespace surf */
37 } /* namespace simgrid */