]> AND Public Git Repository - simgrid.git/blobdiff - include/simgrid/s4u/Storage.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Const etc. (round #3).
[simgrid.git] / include / simgrid / s4u / Storage.hpp
index 1b5107b88a6cc38065a9094c2a448e23db32dae7..9d4c46d893f9fe5df58b3c2e683d240d4c66a7b7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2020. 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. */
@@ -17,6 +17,9 @@
 #include <unordered_map>
 
 namespace simgrid {
+
+extern template class XBT_PUBLIC xbt::Extendable<s4u::Storage>;
+
 namespace s4u {
 
 /** Storage represent the disk resources, usually associated to a given host
@@ -35,6 +38,7 @@ public:
 
 protected:
   virtual ~Storage() = default;
+
 public:
   /** @brief Callback signal fired when a new Storage is created */
   static xbt::signal<void(Storage&)> on_creation;
@@ -52,17 +56,14 @@ public:
   /** @brief Retrieves the name of that storage as a C string */
   const char* get_cname() const { return name_.c_str(); }
 
-  const char* get_type();
-  Host* get_host() { return attached_to_; };
+  const char* get_type() const;
+  Host* get_host() const { return attached_to_; };
   void set_host(Host* host) { attached_to_ = host; }
 
-  std::unordered_map<std::string, std::string>* get_properties();
-  const char* get_property(const std::string& key);
+  const std::unordered_map<std::string, std::string>* get_properties() const;
+  const char* get_property(const std::string& key) const;
   void set_property(const std::string&, const std::string& value);
 
-  void set_data(void* data) { userdata_ = data; }
-  void* get_data() { return userdata_; }
-
   IoPtr io_init(sg_size_t size, s4u::Io::OpType type);
 
   IoPtr read_async(sg_size_t size);
@@ -70,54 +71,12 @@ public:
 
   IoPtr write_async(sg_size_t size);
   sg_size_t write(sg_size_t size);
-  kernel::resource::StorageImpl* get_impl() { return pimpl_; }
-
-  // Deprecated functions
-#ifndef DOXYGEN
-  /** @deprecated Storage::by_name() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::by_name()") Storage* byName(const std::string& name)
-  {
-    return by_name(name);
-  }
-  /** @deprecated Storage::get_name() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_name()") std::string const& getName() const { return get_name(); }
-  /** @deprecated Storage::get_cname() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_cname()") const char* getCname() const { return get_cname(); }
-  /** @deprecated Storage::get_type() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_type()") const char* getType() { return get_type(); }
-  /** @deprecated Storage::get_host() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_host()") Host* getHost() { return get_host(); }
-  /** @deprecated Storage::get_properties() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_properties()") std::map<std::string, std::string>* getProperties()
-  {
-    std::map<std::string, std::string>* res             = new std::map<std::string, std::string>();
-    std::unordered_map<std::string, std::string>* props = get_properties();
-    for (auto const& kv : *props)
-      res->insert(kv);
-    return res;
-  }
-  /** @deprecated Storage::get_property() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_property()") const char* getProperty(const char* key)
-  {
-    return get_property(key);
-  }
-  /** @deprecated Storage::set_property() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::set_property()") void setProperty(const std::string& key,
-                                                                                    const std::string& value)
-  {
-    set_property(key, value);
-  }
-  /** @deprecated Storage::set_data() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::set_data()") void setUserdata(void* data) { set_data(data); }
-  /** @deprecated Storage::get_data() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_data()") void* getUserdata() { return get_data(); }
-#endif
+  kernel::resource::StorageImpl* get_impl() const { return pimpl_; }
 
 private:
   Host* attached_to_ = nullptr;
   kernel::resource::StorageImpl* const pimpl_;
   std::string name_;
-  void* userdata_ = nullptr;
 };
 
 } // namespace s4u