/* This constructor is used when we pass parameters to the actor */
/* as with argc/argv, args[0] is the actor's name, so the first parameter is args[1] */
if (args.size() > 1)
- mailbox = simgrid::s4u::Mailbox::byName(args[1].c_str());
+ mailbox = simgrid::s4u::Mailbox::byName(args[1]);
}
void operator()() {
XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->getName());
Mailbox(smx_mailbox_t mbox): pimpl_(mbox) {}
-public:
- smx_mailbox_t getImpl() { return pimpl_; } // FIXME: make me protected
-
// We don't have to manage the lifetime of mailboxes:
friend void intrusive_ptr_add_ref(Mailbox*) {}
friend void intrusive_ptr_release(Mailbox*) {}
+public:
+ smx_mailbox_t getImpl() { return pimpl_; } // FIXME: make me protected
+
/** Get the name of that mailbox */
const char *getName();
- /** Retrieve the mailbox associated to the given string */
+ /** Retrieve the mailbox associated to the given string (as a C string) */
static MailboxPtr byName(const char *name);
+ /** Retrieve the mailbox associated to the given string (as a C++ string) */
+ static MailboxPtr byName(std::string name);
+
/** Returns whether the mailbox contains queued communications */
bool empty();
/** Declare that the specified process is a permanent receiver on that mailbox
*
- * It means that the communications sent to this mailbox will start flowing to its host even before he does a recv().
- * This models the real behavior of TCP and MPI communications, amongst other.
+ * It means that the communications sent to this mailbox will start flowing to
+ * its host even before he does a recv(). This models the real behavior of TCP
+ * and MPI communications, amongst other.
*/
void setReceiver(ActorPtr process);
return MailboxPtr(&mbox->piface_, true);
}
+MailboxPtr Mailbox::byName(std::string name)
+{
+ return byName(name.c_str());
+}
+
bool Mailbox::empty()
{
return pimpl_->comm_queue.empty();