X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0e8603d2d56c545fae09fad07d2312450e305470..6e0d0f6c1580aceb13c060bbf95cbe9000cf6bbd:/src/kernel/actor/CommObserver.hpp diff --git a/src/kernel/actor/CommObserver.hpp b/src/kernel/actor/CommObserver.hpp index 6647d430cb..161e095e05 100644 --- a/src/kernel/actor/CommObserver.hpp +++ b/src/kernel/actor/CommObserver.hpp @@ -12,6 +12,7 @@ #include "xbt/asserts.h" #include +#include namespace simgrid::kernel::actor { @@ -20,7 +21,7 @@ class ActivityTestSimcall final : public ResultingSimcall { std::string fun_call_; public: - ActivityTestSimcall(ActorImpl* actor, activity::ActivityImpl* activity, std::string fun_call = "") + ActivityTestSimcall(ActorImpl* actor, activity::ActivityImpl* activity, std::string_view fun_call) : ResultingSimcall(actor, true), activity_(activity), fun_call_(fun_call) { } @@ -37,7 +38,7 @@ class ActivityTestanySimcall final : public ResultingSimcall { public: ActivityTestanySimcall(ActorImpl* actor, const std::vector& activities, - std::string fun_call = "none"); + std::string_view fun_call); bool is_enabled() override { return true; /* can return -1 if no activity is ready */ } void serialize(std::stringstream& stream) const override; std::string to_string() const override; @@ -53,7 +54,7 @@ class ActivityWaitSimcall final : public ResultingSimcall { std::string fun_call_; public: - ActivityWaitSimcall(ActorImpl* actor, activity::ActivityImpl* activity, double timeout, std::string fun_call = "none") + ActivityWaitSimcall(ActorImpl* actor, activity::ActivityImpl* activity, double timeout, std::string_view fun_call) : ResultingSimcall(actor, false), activity_(activity), timeout_(timeout), fun_call_(fun_call) { } @@ -74,7 +75,7 @@ class ActivityWaitanySimcall final : public ResultingSimcall { public: ActivityWaitanySimcall(ActorImpl* actor, const std::vector& activities, double timeout, - std::string fun_call = "none"); + std::string_view fun_call); bool is_enabled() override; void serialize(std::stringstream& stream) const override; std::string to_string() const override; @@ -95,12 +96,13 @@ class CommIsendSimcall final : public SimcallObserver { bool detached_; activity::CommImpl* comm_ = {}; int tag_ = {}; - std::string fun_call_; std::function match_fun_; std::function clean_fun_; // used to free the synchro in case of problem after a detached send std::function copy_data_fun_; // used to copy data if not default one + std::string fun_call_; + public: CommIsendSimcall( ActorImpl* actor, activity::MailboxImpl* mbox, double payload_size, double rate, unsigned char* src_buff, @@ -108,7 +110,7 @@ public: const std::function& clean_fun, // used to free the synchro in case of problem after a detached send const std::function& copy_data_fun, // used to copy data if not default one - void* payload, bool detached, std::string fun_call = "none") + void* payload, bool detached, std::string_view fun_call) : SimcallObserver(actor) , mbox_(mbox) , payload_size_(payload_size) @@ -148,16 +150,17 @@ class CommIrecvSimcall final : public SimcallObserver { double rate_; activity::CommImpl* comm_ = {}; int tag_ = {}; - std::string fun_call_; std::function match_fun_; std::function copy_data_fun_; // used to copy data if not default one + std::string fun_call_; + public: CommIrecvSimcall(ActorImpl* actor, activity::MailboxImpl* mbox, unsigned char* dst_buff, size_t* dst_buff_size, const std::function& match_fun, const std::function& copy_data_fun, void* payload, - double rate, std::string fun_call = "none") + double rate, std::string_view fun_call) : SimcallObserver(actor) , mbox_(mbox) , dst_buff_(dst_buff) @@ -183,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