1 /* Copyright (c) 2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_KERNEL_ACTIVITY_MESS_HPP
7 #define SIMGRID_KERNEL_ACTIVITY_MESS_HPP
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include "src/kernel/actor/ActorImpl.hpp"
11 #include "src/kernel/actor/CommObserver.hpp"
13 namespace simgrid::kernel::activity {
15 enum class MessImplType { PUT, GET };
17 class XBT_PUBLIC MessImpl : public ActivityImpl_T<MessImpl> {
20 MessageQueueImpl* queue_ = nullptr;
21 void* payload_ = nullptr;
22 MessImplType type_ = MessImplType::PUT;
23 unsigned char* dst_buff_ = nullptr;
24 size_t* dst_buff_size_ = nullptr;
27 MessImpl& set_type(MessImplType type);
28 MessImplType get_type() const { return type_; }
29 MessImpl& set_payload(void* payload);
30 void* get_payload() { return payload_; }
32 MessImpl& set_queue(MessageQueueImpl* queue);
33 MessageQueueImpl* get_queue() const { return queue_; }
34 MessImpl& set_dst_buff(unsigned char* buff, size_t* size);
36 static ActivityImplPtr iput(actor::MessIputSimcall* observer);
37 static ActivityImplPtr iget(actor::MessIgetSimcall* observer);
39 void wait_for(actor::ActorImpl* issuer, double timeout) override;
42 void set_exception(actor::ActorImpl* issuer) override {};
43 void finish() override;
45 actor::ActorImplPtr src_actor_ = nullptr;
46 actor::ActorImplPtr dst_actor_ = nullptr;
48 } // namespace simgrid::kernel::activity