1 /* Copyright (c) 2015-2022. 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_MC_TRANSITION_COMM_HPP
7 #define SIMGRID_MC_TRANSITION_COMM_HPP
9 #include "src/kernel/actor/SimcallObserver.hpp"
10 #include "src/mc/transition/Transition.hpp"
16 namespace simgrid::mc {
18 class CommRecvTransition;
19 class CommSendTransition;
20 class CommTestTransition;
22 class CommWaitTransition : public Transition {
31 friend CommRecvTransition;
32 friend CommSendTransition;
33 friend CommTestTransition;
36 CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream);
37 std::string to_string(bool verbose) const override;
38 bool depends(const Transition* other) const override;
40 bool get_timeout() const { return timeout_; }
41 /** Address of the corresponding Communication object in the application */
42 uintptr_t get_comm() const { return comm_; }
44 aid_t get_sender() const { return sender_; }
46 aid_t get_receiver() const { return receiver_; }
48 unsigned get_mailbox() const { return mbox_; }
50 uintptr_t get_sbuff() const { return sbuff_; }
51 /** Receiver buffer */
52 uintptr_t get_rbuff() const { return rbuff_; }
54 size_t get_size() const { return size_; }
56 class CommTestTransition : public Transition {
64 friend CommSendTransition;
65 friend CommRecvTransition;
68 CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream);
69 std::string to_string(bool verbose) const override;
70 bool depends(const Transition* other) const override;
72 /** Address of the corresponding Communication object in the application */
73 uintptr_t get_comm() const { return comm_; }
75 aid_t get_sender() const { return sender_; }
77 aid_t get_receiver() const { return receiver_; }
79 unsigned get_mailbox() const { return mbox_; }
81 uintptr_t get_sbuff() const { return sbuff_; }
82 /** Receiver buffer */
83 uintptr_t get_rbuff() const { return rbuff_; }
85 size_t get_size() const { return size_; }
88 class CommRecvTransition : public Transition {
89 uintptr_t comm_; /* Addr of the CommImpl */
95 CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream);
96 std::string to_string(bool verbose) const override;
97 bool depends(const Transition* other) const override;
99 /** Address of the corresponding Communication object in the application */
100 uintptr_t get_comm() const { return comm_; }
102 unsigned get_mailbox() const { return mbox_; }
103 /** Receiver buffer */
104 uintptr_t get_rbuff() const { return rbuff_; }
105 /** If using SMPI, the tag */
106 int get_tag() const { return tag_; }
109 class CommSendTransition : public Transition {
110 uintptr_t comm_; /* Addr of the CommImpl */
117 CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream);
118 std::string to_string(bool verbose) const override;
119 bool depends(const Transition* other) const override;
121 /** Address of the corresponding Communication object in the application */
122 uintptr_t get_comm() const { return comm_; }
124 unsigned get_mailbox() const { return mbox_; }
126 uintptr_t get_sbuff() const { return sbuff_; }
128 size_t get_size() const { return size_; }
129 /** If using SMPI, the tag */
130 int get_tag() const { return tag_; }
133 /** Make a new transition from serialized description */
134 Transition* deserialize_transition(aid_t issuer, int times_considered, std::stringstream& stream);
136 } // namespace simgrid::mc