1 /* Copyright (c) 2015-2023. 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 #ifndef XBT_PROPERTYHOLDER_HPP
7 #define XBT_PROPERTYHOLDER_HPP
11 #include <unordered_map>
13 namespace simgrid::xbt {
15 /** @brief a PropertyHolder can be given a set of textual properties
17 * Common PropertyHolders are elements of the platform file, such as Host, Link, or Disk.
19 class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance mayhem will get you
20 std::unique_ptr<std::unordered_map<std::string, std::string>> properties_ = nullptr;
23 PropertyHolder() = default;
24 PropertyHolder(const PropertyHolder&) = delete;
25 PropertyHolder& operator=(const PropertyHolder&) = delete;
27 const char* get_property(const std::string& key) const;
28 void set_property(const std::string& id, const std::string& value);
30 const std::unordered_map<std::string, std::string>* get_properties();
31 template <class Assoc> void set_properties(const Assoc& properties);
34 } // namespace simgrid::xbt