Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement CommTestTransition
[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 <string>
14
15 namespace simgrid {
16 namespace mc {
17
18 class CommRecvTransition;
19 class CommSendTransition;
20 class CommTestTransition;
21
22 class CommWaitTransition : public Transition {
23   bool timeout_;
24   void* comm_;
25   aid_t sender_;
26   aid_t receiver_;
27   unsigned mbox_;
28   void* src_buff_;
29   void* dst_buff_;
30   size_t size_;
31   friend CommRecvTransition;
32   friend CommSendTransition;
33   friend CommTestTransition;
34
35 public:
36   CommWaitTransition(aid_t issuer, int times_considered, char* buffer);
37   std::string to_string(bool verbose) const override;
38   bool depends(const Transition* other) const override;
39 };
40 class CommTestTransition : public Transition {
41   void* comm_;
42   aid_t sender_;
43   aid_t receiver_;
44   unsigned mbox_;
45   void* src_buff_;
46   void* dst_buff_;
47   size_t size_;
48   friend CommSendTransition;
49   friend CommRecvTransition;
50
51 public:
52   CommTestTransition(aid_t issuer, int times_considered, char* buffer);
53   std::string to_string(bool verbose) const override;
54   bool depends(const Transition* other) const override;
55 };
56
57 class CommRecvTransition : public Transition {
58   unsigned mbox_;
59   void* dst_buff_;
60
61 public:
62   CommRecvTransition(aid_t issuer, int times_considered, char* buffer);
63   std::string to_string(bool verbose) const override;
64   bool depends(const Transition* other) const override;
65 };
66
67 class CommSendTransition : public Transition {
68   unsigned mbox_;
69   void* src_buff_;
70   size_t size_;
71
72 public:
73   CommSendTransition(aid_t issuer, int times_considered, char* buffer);
74   std::string to_string(bool verbose) const override;
75   bool depends(const Transition* other) const override;
76 };
77
78 /** Make a new transition from serialized description */
79 Transition* recv_transition(aid_t issuer, int times_considered, Transition::Type simcall, char* buffer);
80
81 } // namespace mc
82 } // namespace simgrid
83
84 #endif