+/* Our first class of actors is simply implemented with a function, that takes a single string as parameter.
+ *
+ * Later, this actor class is instantiated within the simulation.
+ */
+static void receiver(const std::string& mailbox_name)
+{
+ simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+
+ XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->get_cname());
+
+ std::string* msg1 = static_cast<std::string*>(mailbox->get());
+ std::string* msg2 = static_cast<std::string*>(mailbox->get());
+ std::string* msg3 = static_cast<std::string*>(mailbox->get());
+ XBT_INFO("I received '%s', '%s' and '%s'", msg1->c_str(), msg2->c_str(), msg3->c_str());
+ delete msg1;
+ delete msg2;
+ delete msg3;
+ XBT_INFO("I'm done. See you.");
+}
+
+/* Our second class of actors is also a function */
+static int forwarder(int argc, char** argv)
+{
+ xbt_assert(argc >= 3, "Actor forwarder requires 2 parameters, but got only %d", argc - 1);
+ simgrid::s4u::MailboxPtr in = simgrid::s4u::Mailbox::by_name(argv[1]);
+ simgrid::s4u::MailboxPtr out = simgrid::s4u::Mailbox::by_name(argv[2]);
+ std::string* msg = static_cast<std::string*>(in->get());
+ XBT_INFO("Forward '%s'.", msg->c_str());
+ out->put(msg, msg->size());
+ return 0;
+}
+
+/* Declares a third class of actors which sends a message to the mailbox 'mb42'.