S4U_Mailbox.h
1 
11 #ifndef WRENCH_S4U_MAILBOX_H
12 #define WRENCH_S4U_MAILBOX_H
13 
14 
15 #include <string>
16 #include <map>
17 #include <set>
18 
19 #include <simgrid/s4u.hpp>
20 
21 namespace wrench {
22 
23  /***********************/
25  /***********************/
26 
27  class SimulationMessage;
28  class S4U_PendingCommunication;
29 
33  class S4U_Mailbox {
34 
35  public:
36  static std::unique_ptr<SimulationMessage> getMessage(std::string mailbox);
37  static std::unique_ptr<SimulationMessage> getMessage(std::string mailbox, double timeout);
38  static void putMessage(std::string mailbox, SimulationMessage *m);
39  static void dputMessage(std::string mailbox_name, SimulationMessage *msg);
40  static std::shared_ptr<S4U_PendingCommunication> iputMessage(std::string mailbox_name, SimulationMessage *msg);
41  static std::shared_ptr<S4U_PendingCommunication> igetMessage(std::string mailbox_name);
42 // static void clear_dputs();
43 
44  static std::string generateUniqueMailboxName(std::string);
45  static unsigned long generateUniqueSequenceNumber();
46 
47  private:
48 
49 // static std::map<simgrid::s4u::ActorPtr , std::set<simgrid::s4u::CommPtr>> dputs;
50 
51  };
52 
53  /***********************/
55  /***********************/
56 
57 };
58 
59 
60 #endif //WRENCH_S4U_MAILBOX_H
static std::string generateUniqueMailboxName(std::string)
Generate a unique mailbox name given a prefix (this method simply appends an increasing sequence numb...
Definition: S4U_Mailbox.cpp:252
static void dputMessage(std::string mailbox_name, SimulationMessage *msg)
Asynchronously send a message to a mailbox in a "fire and forget" fashion.
Definition: S4U_Mailbox.cpp:142
Wrappers around S4U's communication methods.
Definition: S4U_Mailbox.h:33
static std::shared_ptr< S4U_PendingCommunication > igetMessage(std::string mailbox_name)
Asynchronously receive a message from a mailbox.
Definition: S4U_Mailbox.cpp:212
Top-level class to describe a message communicated by processes in the simulation.
Definition: SimulationMessage.h:27
static std::unique_ptr< SimulationMessage > getMessage(std::string mailbox)
Synchronously receive a message from a mailbox.
Definition: S4U_Mailbox.cpp:44
static void putMessage(std::string mailbox, SimulationMessage *m)
Synchronously send a message to a mailbox.
Definition: S4U_Mailbox.cpp:115
static std::shared_ptr< S4U_PendingCommunication > iputMessage(std::string mailbox_name, SimulationMessage *msg)
Asynchronously send a message to a mailbox.
Definition: S4U_Mailbox.cpp:177
Definition: Alarm.cpp:20
static unsigned long generateUniqueSequenceNumber()
Generate a unique sequence number.
Definition: S4U_Mailbox.cpp:239