1 /* Copyright (c) 2015. 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 PropertyHolder::~PropertyHolder() {
15 /** @brief Return the property associated to the provided key (or nullptr if not existing) */
16 const char *PropertyHolder::getProperty(const char*key) {
17 if (properties_ == nullptr)
20 return properties_->at(key).c_str();
21 } catch (std::out_of_range& unfound) {
26 /** @brief Change the value of a given key in the property set */
27 void PropertyHolder::setProperty(std::string key, std::string value)
30 properties_ = new std::map<std::string, std::string>;
31 (*properties_)[key] = value;
34 /** @brief Return the whole set of properties. Don't mess with it, dude! */
35 std::map<std::string, std::string>* PropertyHolder::getProperties()
38 properties_ = new std::map<std::string, std::string>;
42 } /* namespace surf */
43 } /* namespace simgrid */