Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Give the comm to {Send,Recv}Transition, as CommDet needs it
[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   void* comm_; /* Addr of the CommImpl */
60   unsigned mbox_;
61   void* dst_buff_;
62
63 public:
64   CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream);
65   std::string to_string(bool verbose) const override;
66   bool depends(const Transition* other) const override;
67 };
68
69 class CommSendTransition : public Transition {
70   void* comm_; /* Addr of the CommImpl */
71   unsigned mbox_;
72   void* src_buff_;
73   size_t size_;
74
75 public:
76   CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream);
77   std::string to_string(bool verbose) const override;
78   bool depends(const Transition* other) const override;
79 };
80
81 class TestAnyTransition : public Transition {
82   std::vector<Transition*> transitions_;
83
84 public:
85   TestAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream);
86   std::string to_string(bool verbose) const override;
87   bool depends(const Transition* other) const override;
88 };
89
90 class WaitAnyTransition : public Transition {
91   std::vector<Transition*> transitions_;
92
93 public:
94   WaitAnyTransition(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;
97 };
98
99 /** Make a new transition from serialized description */
100 Transition* deserialize_transition(aid_t issuer, int times_considered, std::stringstream& stream);
101
102 } // namespace mc
103 } // namespace simgrid
104
105 #endif