1 /* Copyright (c) 2006-2015. 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. */
7 #ifndef SIMGRID_S4U_MAILBOX_HPP
8 #define SIMGRID_S4U_MAILBOX_HPP
10 #include <boost/unordered_map.hpp>
13 #include <simgrid/s4u/forward.hpp>
14 #include <simgrid/s4u/actor.hpp>
21 * Rendez-vous point for network communications, similar to URLs on which you could post and retrieve data.
22 * They are not network locations: you can post and retrieve on a given mailbox from anywhere on the network.
23 * You can access any mailbox without any latency. The network delay are only related to the location of the
24 * sender and receiver.
26 XBT_PUBLIC_CLASS Mailbox {
30 Mailbox(const char*name, smx_mailbox_t inferior);
35 smx_mailbox_t getInferior() { return inferior_; }
38 /** Get the name of that mailbox */
39 const char *getName();
40 /** Retrieve the mailbox associated to the given string */
41 static Mailbox *byName(const char *name);
42 /** Returns whether the mailbox contains queued communications */
47 smx_mailbox_t inferior_;
48 static boost::unordered_map<std::string, Mailbox *> *mailboxes;
50 }} // namespace simgrid::s4u
54 XBT_PUBLIC(sg_mbox_t) sg_mbox_by_name(const char*name);
55 XBT_PUBLIC(int) sg_mbox_is_empty(sg_mbox_t mbox);
57 #endif /* SIMGRID_S4U_MAILBOX_HPP */