Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add Message queue abstraction
[simgrid.git] / src / kernel / actor / CommObserver.hpp
index c8e2c8c..161e095 100644 (file)
@@ -110,7 +110,7 @@ public:
       const std::function<void(void*)>& clean_fun, // used to free the synchro in case of problem after a detached send
       const std::function<void(activity::CommImpl*, void*, size_t)>&
           copy_data_fun, // used to copy data if not default one
-      void* payload, bool detached, std::string fun_call)
+      void* payload, bool detached, std::string_view fun_call)
       : SimcallObserver(actor)
       , mbox_(mbox)
       , payload_size_(payload_size)
@@ -160,7 +160,7 @@ public:
   CommIrecvSimcall(ActorImpl* actor, activity::MailboxImpl* mbox, unsigned char* dst_buff, size_t* dst_buff_size,
                    const std::function<bool(void*, void*, activity::CommImpl*)>& match_fun,
                    const std::function<void(activity::CommImpl*, void*, size_t)>& copy_data_fun, void* payload,
-                   double rate, std::string fun_call)
+                   double rate, std::string_view fun_call)
       : SimcallObserver(actor)
       , mbox_(mbox)
       , dst_buff_(dst_buff)
@@ -186,6 +186,52 @@ public:
   auto const& get_copy_data_fun() const { return copy_data_fun_; }
 };
 
+class MessIputSimcall final : public SimcallObserver {
+  activity::MessageQueueImpl* queue_;
+  void* payload_;
+  activity::MessImpl* mess_ = {};
+
+public:
+  MessIputSimcall(
+      ActorImpl* actor, activity::MessageQueueImpl* queue, void* payload)
+      : SimcallObserver(actor)
+      , queue_(queue)
+      , payload_(payload)
+  {
+  }
+  void serialize(std::stringstream& stream) const override;
+  std::string to_string() const override;
+  activity::MessageQueueImpl* get_queue() const { return queue_; }
+  void* get_payload() const { return payload_; }
+  void set_message(activity::MessImpl* mess) { mess_ = mess; }
+};
+
+class MessIgetSimcall final : public SimcallObserver {
+  activity::MessageQueueImpl* queue_;
+  unsigned char* dst_buff_;
+  size_t* dst_buff_size_;
+  void* payload_;
+  activity::MessImpl* mess_ = {};
+
+public:
+  MessIgetSimcall(ActorImpl* actor, activity::MessageQueueImpl* queue, unsigned char* dst_buff, size_t* dst_buff_size,
+                  void* payload)
+      : SimcallObserver(actor)
+      , queue_(queue)
+      , dst_buff_(dst_buff)
+      , dst_buff_size_(dst_buff_size)
+      , payload_(payload)
+  {
+  }
+  void serialize(std::stringstream& stream) const override;
+  std::string to_string() const override;
+  activity::MessageQueueImpl* get_queue() const { return queue_; }
+  unsigned char* get_dst_buff() const { return dst_buff_; }
+  size_t* get_dst_buff_size() const { return dst_buff_size_; }
+  void* get_payload() const { return payload_; }
+  void set_message(activity::MessImpl* mess) { mess_ = mess; }
+};
+
 } // namespace simgrid::kernel::actor
 
 #endif