Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rework the OO design of S4U comms
[simgrid.git] / include / simgrid / s4u / Comm.hpp
index f577980..2032de7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <simgrid/forward.h>
 #include <simgrid/s4u/Activity.hpp>
+#include <simgrid/s4u/Mailbox.hpp> // DEPRECATED 3.17
 #include <simgrid/s4u/forward.hpp>
 
 #include <vector>
@@ -26,6 +27,7 @@ XBT_PUBLIC_CLASS Comm : public Activity
 public:
   friend void intrusive_ptr_release(simgrid::s4u::Comm * c);
   friend void intrusive_ptr_add_ref(simgrid::s4u::Comm * c);
+  friend Mailbox; // Factory of comms
 
   virtual ~Comm();
 
@@ -53,21 +55,43 @@ public:
     return idx;
   }
   /** Creates (but don't start) an async send to the mailbox @p dest */
-  static CommPtr send_init(MailboxPtr dest);
+  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::send_init") // 3.17
+      send_init(MailboxPtr dest)
+  {
+    return dest->send_init();
+  }
+  /** Creates (but don't start) an async send to the mailbox @p dest */
+  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::send_init") // 3.17
+      send_init(MailboxPtr dest, void* data, int simulatedByteAmount)
+  {
+    return dest->send_init(data, simulatedByteAmount);
+  }
   /** Creates and start an async send to the mailbox @p dest */
-  static CommPtr send_async(MailboxPtr dest, void* data, int simulatedByteAmount);
+  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::send_async") // 3.17
+      send_async(MailboxPtr dest, void* data, int simulatedByteAmount)
+  {
+    return dest->send_async(data, simulatedByteAmount);
+  }
   /** Creates (but don't start) an async recv onto the mailbox @p from */
-  static CommPtr recv_init(MailboxPtr from);
+  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::recv_init") // 3.17
+      recv_init(MailboxPtr from)
+  {
+    return from->recv_init();
+  }
   /** Creates and start an async recv to the mailbox @p from */
-  static CommPtr recv_async(MailboxPtr from, void** data);
-  /** Creates and start a detached send to the mailbox @p dest
-   *  TODO: make it possible to detach an already created comm */
-  static void send_detached(MailboxPtr dest, void* data, int simulatedSize);
+  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::recv_async") // 3.17
+      recv_async(MailboxPtr from, void** data)
+  {
+    return from->recv_async(data);
+  }
 
   void start() override;
   void wait() override;
   void wait(double timeout) override;
 
+  /** Start the comm, and ignore its result. It can be completely forgotten after that. */
+  void detach();
+
   /** Sets the maximal communication rate (in byte/sec). Must be done before start */
   void setRate(double rate);