Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
docs: start writing the S4U part
[simgrid.git] / include / simgrid / s4u / Io.hpp
index 6e3df22..b47c7e7 100644 (file)
 #include <simgrid/s4u/Activity.hpp>
 
 #include <atomic>
+#include <string>
 
 namespace simgrid {
 namespace s4u {
 
+/** I/O Activity, representing the asynchronous disk access.
+ *
+ * They are generated from simgrid::s4u::Storage::read() and simgrid::s4u::Storage::write().
+ */
+
 class XBT_PUBLIC Io : public Activity {
-  Io() : Activity() {}
+public:
+  enum class OpType { READ, WRITE };
+
+private:
+  explicit Io(sg_size_t size, OpType type) : Activity(), size_(size), type_(type) {}
 public:
   friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Io* i);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Io* i);
-  friend Storage; // Factory of IOs
+  friend simgrid::s4u::Storage; // Factory of IOs
 
   ~Io() = default;
 
@@ -29,10 +39,13 @@ public:
   Activity* cancel() override;
 
   double get_remaining() override;
+  sg_size_t get_performed_ioops();
 
 private:
   sg_size_t size_       = 0;
   sg_storage_t storage_ = nullptr;
+  std::string name_     = "";
+  OpType type_          = OpType::READ;
   std::atomic_int_fast32_t refcount_{0};
 }; // class
 }