Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I think I just killed a simcall
[simgrid.git] / src / surf / storage_interface.hpp
index 46cbf19..f52d57b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2015. The SimGrid Team.
+/* Copyright (c) 2004-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -7,8 +7,9 @@
 #include <xbt/base.h>
 #include <xbt/signal.hpp>
 
-#include "surf_interface.hpp"
 #include "src/surf/PropertyHolder.hpp"
+#include "surf_interface.hpp"
+#include <map>
 
 #ifndef STORAGE_INTERFACE_HPP_
 #define STORAGE_INTERFACE_HPP_
@@ -64,11 +65,8 @@ public:
   StorageModel();
   ~StorageModel();
 
-  virtual Storage *createStorage(const char* id, const char* type_id,
-                                 const char* content_name, const char* content_type,
-                                 xbt_dict_t properties, const char *attach) = 0;
-
-  bool next_occuring_event_isIdempotent() {return true;}
+  virtual Storage* createStorage(const char* id, const char* type_id, const char* content_name,
+                                 const char* content_type, const char* attach) = 0;
 
   std::vector<Storage*> p_storageList;
 };
@@ -83,20 +81,6 @@ public:
 class Storage : public simgrid::surf::Resource,
         public simgrid::surf::PropertyHolder {
 public:
-  /**
-   * @brief Storage constructor
-   *
-   * @param model StorageModel associated to this Storage
-   * @param name The name of the Storage
-   * @param props Dictionary of properties associated to this Storage
-   * @param type_id [description]
-   * @param content_name [description]
-   * @param content_type [description]
-   * @param size [description]
-   */
-  Storage(Model *model, const char *name, xbt_dict_t props,
-          const char* type_id, const char *content_name, const char *content_type,
-          sg_size_t size);
 
   /**
    * @brief Storage constructor
@@ -105,11 +89,8 @@ public:
    * @param name The name of the Storage
    * @param props Dictionary of properties associated to this Storage
    */
-  Storage(Model *model, const char *name, xbt_dict_t props,
-          lmm_system_t maxminSystem, double bread, double bwrite,
-          double bconnection,
-          const char* type_id, const char *content_name, const char *content_type,
-          sg_size_t size, const char *attach);
+  Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
+          const char* type_id, const char* content_name, const char* content_type, sg_size_t size, const char* attach);
 
   ~Storage();
 
@@ -121,7 +102,7 @@ public:
   void turnOn() override;
   void turnOff() override;
 
-  xbt_dict_t content_;
+  std::map<std::string, sg_size_t*>* content_;
   char* contentType_;
   sg_size_t size_;
   sg_size_t usedSize_;
@@ -169,14 +150,7 @@ public:
    *
    * @return A xbt_dict_t with path as keys and size in bytes as values
    */
-  virtual xbt_dict_t getContent();
-
-  /**
-   * @brief Get the size in bytes of the current Storage
-   *
-   * @return The size in bytes of the current Storage
-   */
-  virtual sg_size_t getSize();
+  virtual std::map<std::string, sg_size_t*>* getContent();
 
   /**
    * @brief Get the available size in bytes of the current Storage
@@ -192,8 +166,7 @@ public:
    */
   virtual sg_size_t getUsedSize();
 
-
-  xbt_dict_t parseContent(const char *filename);
+  std::map<std::string, sg_size_t*>* parseContent(const char* filename);
 
   std::vector<StorageAction*> writeActions_;
 
@@ -248,10 +221,10 @@ public:
 
   void setState(simgrid::surf::Action::State state) override;
 
-  e_surf_action_storage_type_t m_type;
-  Storage *p_storage;
-  surf_file_t p_file;
-  double progress;
+  e_surf_action_storage_type_t type_;
+  Storage* storage_;
+  surf_file_t file_;
+  double progress_;
 };
 
 }
@@ -263,14 +236,16 @@ typedef struct s_storage_type {
   char *content_type;
   char *type_id;
   xbt_dict_t properties;
-  xbt_dict_t model_properties;
+  std::map<std::string, std::string>* model_properties;
   sg_size_t size;
-} s_storage_type_t, *storage_type_t;
+} s_storage_type_t;
+typedef s_storage_type_t* storage_type_t;
 
 typedef struct s_mount {
   void *storage;
   char *name;
-} s_mount_t, *mount_t;
+} s_mount_t;
+typedef s_mount_t* mount_t;
 
 typedef struct surf_file {
   char *name;