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"
15 namespace simgrid::mc {
17 class CommRecvTransition;
18 class CommSendTransition;
19 class CommTestTransition;
21 class CommWaitTransition : public Transition {
30 friend CommRecvTransition;
31 friend CommSendTransition;
32 friend CommTestTransition;
35 CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream);
36 std::string to_string(bool verbose) const override;
37 bool depends(const Transition* other) const override;
39 bool get_timeout() const { return timeout_; }
40 /** Address of the corresponding Communication object in the application */
41 uintptr_t get_comm() const { return comm_; }
43 aid_t get_sender() const { return sender_; }
45 aid_t get_receiver() const { return receiver_; }
47 unsigned get_mailbox() const { return mbox_; }
49 uintptr_t get_sbuff() const { return sbuff_; }
50 /** Receiver buffer */
51 uintptr_t get_rbuff() const { return rbuff_; }
53 size_t get_size() const { return size_; }
55 class CommTestTransition : public Transition {
63 friend CommSendTransition;
64 friend CommRecvTransition;
67 CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream);
68 std::string to_string(bool verbose) const override;
69 bool depends(const Transition* other) const override;
71 /** Address of the corresponding Communication object in the application */
72 uintptr_t get_comm() const { return comm_; }
74 aid_t get_sender() const { return sender_; }
76 aid_t get_receiver() const { return receiver_; }
78 unsigned get_mailbox() const { return mbox_; }
80 uintptr_t get_sbuff() const { return sbuff_; }
81 /** Receiver buffer */
82 uintptr_t get_rbuff() const { return rbuff_; }
84 size_t get_size() const { return size_; }
87 class CommRecvTransition : public Transition {
88 uintptr_t comm_; /* Addr of the CommImpl */
94 CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream);
95 std::string to_string(bool verbose) const override;
96 bool depends(const Transition* other) const override;
98 /** Address of the corresponding Communication object in the application */
99 uintptr_t get_comm() const { return comm_; }
101 unsigned get_mailbox() const { return mbox_; }
102 /** Receiver buffer */
103 uintptr_t get_rbuff() const { return rbuff_; }
104 /** If using SMPI, the tag */
105 int get_tag() const { return tag_; }
108 class CommSendTransition : public Transition {
109 uintptr_t comm_; /* Addr of the CommImpl */
116 CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream);
117 std::string to_string(bool verbose) const override;
118 bool depends(const Transition* other) const override;
120 /** Address of the corresponding Communication object in the application */
121 uintptr_t get_comm() const { return comm_; }
123 unsigned get_mailbox() const { return mbox_; }
125 uintptr_t get_sbuff() const { return sbuff_; }
127 size_t get_size() const { return size_; }
128 /** If using SMPI, the tag */
129 int get_tag() const { return tag_; }
132 /** Make a new transition from serialized description */
133 Transition* deserialize_transition(aid_t issuer, int times_considered, std::stringstream& stream);
135 } // namespace simgrid::mc