Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
29ebf679f082f119b45800de7cb369db8a15da1e
[simgrid.git] / src / mc / api / TransitionComm.hpp
1 /* Copyright (c) 2015-2022. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SIMGRID_MC_TRANSITION_COMM_HPP
8 #define SIMGRID_MC_TRANSITION_COMM_HPP
9
10 #include "src/kernel/actor/SimcallObserver.hpp"
11 #include "src/mc/api/Transition.hpp"
12
13 #include <sstream>
14 #include <string>
15
16 namespace simgrid {
17 namespace mc {
18
19 class CommRecvTransition;
20 class CommSendTransition;
21 class CommTestTransition;
22
23 class CommWaitTransition : public Transition {
24   bool timeout_;
25   void* comm_;
26   aid_t sender_;
27   aid_t receiver_;
28   unsigned mbox_;
29   void* src_buff_;
30   void* dst_buff_;
31   size_t size_;
32   friend CommRecvTransition;
33   friend CommSendTransition;
34   friend CommTestTransition;
35
36 public:
37   CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream);
38   std::string to_string(bool verbose) const override;
39   bool depends(const Transition* other) const override;
40 };
41 class CommTestTransition : public Transition {
42   void* comm_;
43   aid_t sender_;
44   aid_t receiver_;
45   unsigned mbox_;
46   void* src_buff_;
47   void* dst_buff_;
48   size_t size_;
49   friend CommSendTransition;
50   friend CommRecvTransition;
51
52 public:
53   CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream);
54   std::string to_string(bool verbose) const override;
55   bool depends(const Transition* other) const override;
56 };
57
58 class CommRecvTransition : public Transition {
59   unsigned mbox_;
60   void* dst_buff_;
61
62 public:
63   CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream);
64   std::string to_string(bool verbose) const override;
65   bool depends(const Transition* other) const override;
66 };
67
68 class CommSendTransition : public Transition {
69   unsigned mbox_;
70   void* src_buff_;
71   size_t size_;
72
73 public:
74   CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream);
75   std::string to_string(bool verbose) const override;
76   bool depends(const Transition* other) const override;
77 };
78
79 /** Make a new transition from serialized description */
80 Transition* recv_transition(aid_t issuer, int times_considered, char* buffer);
81
82 } // namespace mc
83 } // namespace simgrid
84
85 #endif