Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix: default rate (bound) for comms is -1 not 0
[simgrid.git] / src / kernel / activity / CommImpl.hpp
index 2d9a902..71f44a7 100644 (file)
@@ -22,7 +22,7 @@ class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
 
   static void (*copy_data_callback_)(CommImpl*, void*, size_t);
 
-  double rate_       = 0.0;
+  double rate_       = -1.0;
   double size_       = 0.0;
   bool detached_     = false;   /* If detached or not */
   bool copied_       = false;   /* whether the data were already copied */
@@ -34,13 +34,16 @@ class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
   CommImplType type_ = CommImplType::SEND; /* Type of the communication (SEND or RECEIVE) */
 
 public:
-  static void set_copy_data_callback(void (*callback)(CommImpl*, void*, size_t));
-
   CommImpl() = default;
-  CommImpl(s4u::Host* from, s4u::Host* to, double bytes);
+
+  static void set_copy_data_callback(void (*callback)(CommImpl*, void*, size_t));
 
   CommImpl& set_type(CommImplType type);
   CommImplType get_type() const { return type_; }
+  CommImpl& set_source(s4u::Host* from);
+  s4u::Host* get_source() const { return from_; }
+  CommImpl& set_destination(s4u::Host* to);
+  s4u::Host* get_destination() const { return to_; }
   CommImpl& set_size(double size);
   CommImpl& set_src_buff(unsigned char* buff, size_t size);
   CommImpl& set_dst_buff(unsigned char* buff, size_t* size);
@@ -51,7 +54,8 @@ public:
   double get_rate() const { return rate_; }
   MailboxImpl* get_mailbox() const { return mbox_; }
   long get_mailbox_id() const { return mbox_id_; }
-  bool detached() const { return detached_; }
+  bool is_detached() const { return detached_; }
+  bool is_assigned() const { return (to_ != nullptr && from_ != nullptr); }
 
   std::vector<s4u::Link*> get_traversed_links() const;
   void copy_data();
@@ -71,13 +75,6 @@ public:
   void set_exception(actor::ActorImpl* issuer) override;
   void finish() override;
 
-
-#if SIMGRID_HAVE_MC
-  MailboxImpl* mbox_cpy = nullptr; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR
-                                     (comm.mbox set to nullptr when the communication is removed from the mailbox
-                                     (used as garbage collector)) */
-#endif
-
   void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
   bool (*match_fun)(void*, void*, CommImpl*) = nullptr; /* Filter function used by the other side. It is used when
 looking if a given communication matches my needs. For that, myself must match the