Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case s4u::Mailbox
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 15 May 2018 20:46:29 +0000 (22:46 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 15 May 2018 20:46:29 +0000 (22:46 +0200)
28 files changed:
examples/s4u/actor-create/s4u-actor-create.cpp
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/app-bittorrent/s4u-peer.hpp
examples/s4u/app-bittorrent/s4u-tracker.cpp
examples/s4u/app-chainsend/s4u-app-chainsend.cpp
examples/s4u/app-masterworker/s4u-app-masterworker.cpp
examples/s4u/app-pingpong/s4u-app-pingpong.cpp
examples/s4u/app-token-ring/s4u-app-token-ring.cpp
examples/s4u/async-wait/s4u-async-wait.cpp
examples/s4u/async-waitall/s4u-async-waitall.cpp
examples/s4u/async-waitany/s4u-async-waitany.cpp
examples/s4u/cloud-simple/s4u-cloud-simple.cpp
examples/s4u/dht-chord/s4u-dht-chord-node.cpp
examples/s4u/dht-kademlia/node.cpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
examples/s4u/energy-link/s4u-energy-link.cpp
examples/s4u/replay-comm/s4u-replay-comm.cpp
include/simgrid/s4u/Mailbox.hpp
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/VmLiveMigration.hpp
src/s4u/s4u_Mailbox.cpp
src/smpi/internals/smpi_process.cpp
teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp
teshsuite/s4u/listen_async/listen_async.cpp
teshsuite/s4u/pid/pid.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index 6f18c3a..0e2c87d 100644 (file)
@@ -29,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_create, "The logging channel used in this
  */
 static void receiver(std::string mailbox_name)
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(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());
 
@@ -47,8 +47,8 @@ static void receiver(std::string mailbox_name)
 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::byName(argv[1]);
-  simgrid::s4u::MailboxPtr out = simgrid::s4u::Mailbox::byName(argv[2]);
+  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());
@@ -79,7 +79,7 @@ public:
   void operator()() /* This is the main code of the actor */
   {
     XBT_INFO("Hello s4u, I have something to send");
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(mbox);
+    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mbox);
 
     mailbox->put(new std::string(msg), msg.size());
     XBT_INFO("I'm done. See you.");
index 7affb48..21fefba 100644 (file)
@@ -33,7 +33,7 @@ Peer::Peer(std::vector<std::string> args)
   xbt_assert(args.size() == 3 || args.size() == 4, "Wrong number of arguments");
   try {
     id       = std::stoi(args[1]);
-    mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id));
+    mailbox_ = simgrid::s4u::Mailbox::by_name(std::to_string(id));
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid ID:") + args[1].c_str());
   }
@@ -70,7 +70,7 @@ void Peer::operator()()
   if (getPeersFromTracker()) {
     XBT_DEBUG("Got %zu peers from the tracker. Current status is: %s", connected_peers.size(), getStatus().c_str());
     begin_receive_time = simgrid::s4u::Engine::get_clock();
-    mailbox_->setReceiver(simgrid::s4u::Actor::self());
+    mailbox_->set_receiver(simgrid::s4u::Actor::self());
     if (hasFinished()) {
       sendHandshakeToAllPeers();
     } else {
@@ -86,7 +86,7 @@ void Peer::operator()()
 
 bool Peer::getPeersFromTracker()
 {
-  simgrid::s4u::MailboxPtr tracker_mailbox = simgrid::s4u::Mailbox::byName(TRACKER_MAILBOX);
+  simgrid::s4u::MailboxPtr tracker_mailbox = simgrid::s4u::Mailbox::by_name(TRACKER_MAILBOX);
   // Build the task to send to the tracker
   TrackerQuery* peer_request = new TrackerQuery(id, mailbox_);
   try {
index 1f4fe9a..c099e9c 100644 (file)
@@ -24,7 +24,7 @@ public:
   bool choked_upload   = true;  // Indicates if the peer is choked for the current peer
   bool choked_download = true;  // Indicates if the peer has choked the current peer
 
-  explicit Connection(int id) : id(id), mailbox_(simgrid::s4u::Mailbox::byName(std::to_string(id))){};
+  explicit Connection(int id) : id(id), mailbox_(simgrid::s4u::Mailbox::by_name(std::to_string(id))){};
   ~Connection() = default;
   void addSpeedValue(double speed) { peer_speed = peer_speed * 0.6 + speed * 0.4; }
   bool hasPiece(unsigned int piece) { return bitfield & 1U << piece; }
index 0c14622..90dac0a 100644 (file)
@@ -24,7 +24,7 @@ Tracker::Tracker(std::vector<std::string> args)
 
   stream = simgrid::s4u::this_actor::get_host()->extension<HostBittorrent>()->getStream();
 
-  mailbox = simgrid::s4u::Mailbox::byName(TRACKER_MAILBOX);
+  mailbox = simgrid::s4u::Mailbox::by_name(TRACKER_MAILBOX);
 
   XBT_INFO("Tracker launched.");
 }
index d4d3d72..79785f5 100644 (file)
@@ -42,7 +42,7 @@ public:
   unsigned int received_pieces      = 0;
   unsigned int total_pieces         = 0;
 
-  Peer() { me = simgrid::s4u::Mailbox::byName(simgrid::s4u::Host::current()->get_cname()); }
+  Peer() { me = simgrid::s4u::Mailbox::by_name(simgrid::s4u::Host::current()->get_cname()); }
   ~Peer()     = default;
 
   void joinChain()
@@ -146,7 +146,7 @@ public:
     for (int i = 1; i <= hostcount; i++) {
       std::string name = std::string("node-") + std::to_string(i) + ".acme.org";
       XBT_DEBUG("%s", name.c_str());
-      mailboxes.push_back(simgrid::s4u::Mailbox::byName(name));
+      mailboxes.push_back(simgrid::s4u::Mailbox::by_name(name));
     }
   }
 
index e35991f..852b18a 100644 (file)
@@ -33,7 +33,7 @@ public:
   {
     for (int i = 0; i < number_of_tasks; i++) { /* For each task to be executed: */
       /* - Select a @ref worker in a round-robin way */
-      mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count));
+      mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(i % workers_count));
 
       if (number_of_tasks < 10000 || i % 10000 == 0)
         XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", (std::string("Task_") + std::to_string(i)).c_str(),
@@ -46,7 +46,7 @@ public:
     XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
     for (int i = 0; i < workers_count; i++) {
       /* - Eventually tell all the workers to stop by sending a "finalize" task */
-      mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count));
+      mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(i % workers_count));
       mailbox->put(new double(-1.0), 0);
     }
   }
@@ -62,7 +62,7 @@ public:
     xbt_assert(args.size() == 2, "The worker expects a single argument from the XML deployment file: "
                                  "its worker ID (its numerical rank)");
     id      = std::stol(args[1]);
-    mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(id));
+    mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
   }
 
   void operator()()
index 542b1b4..3d7d79e 100644 (file)
@@ -18,10 +18,10 @@ static void pinger(std::vector<std::string> args)
   double* payload = new double();
   *payload        = simgrid::s4u::Engine::get_clock();
 
-  simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1);
+  simgrid::s4u::Mailbox::by_name(args[0])->put(payload, 1);
   /* - ... then wait for the (large) pong */
   double* sender_time =
-      static_cast<double*>(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_name())->get());
+      static_cast<double*>(simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name())->get());
 
   double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time;
   XBT_INFO("Task received : large communication (bandwidth bound)");
@@ -38,7 +38,7 @@ static void ponger(std::vector<std::string> args)
 
   /* - Receive the (small) ping first ....*/
   double* sender_time =
-      static_cast<double*>(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_name())->get());
+      static_cast<double*>(simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name())->get());
   double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time;
   XBT_INFO("Task received : small communication (latency bound)");
   XBT_INFO(" Ping time (latency bound) %f", communication_time);
@@ -49,7 +49,7 @@ static void ponger(std::vector<std::string> args)
   *payload        = simgrid::s4u::Engine::get_clock();
   XBT_INFO("task_bw->data = %.3f", *payload);
 
-  simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1e9);
+  simgrid::s4u::Mailbox::by_name(args[0])->put(payload, 1e9);
 }
 
 int main(int argc, char* argv[])
index 8e76889..fd0d126 100644 (file)
@@ -28,13 +28,13 @@ public:
       throw std::invalid_argument(std::string("Processes of this example must have a numerical name, not ") +
                                   ia.what());
     }
-    my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank));
+    my_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(rank));
     if (rank + 1 == simgrid::s4u::Engine::get_instance()->get_host_count())
       /* The last process, which sends the token back to rank 0 */
-      neighbor_mailbox = simgrid::s4u::Mailbox::byName("0");
+      neighbor_mailbox = simgrid::s4u::Mailbox::by_name("0");
     else
       /* The others processes send to their right neighbor (rank+1) */
-      neighbor_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank + 1));
+      neighbor_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(rank + 1));
 
     if (rank == 0) {
       /* The root process (rank 0) first sends the token then waits to receive it back */
index b2f5a11..91e9224 100644 (file)
@@ -31,7 +31,7 @@ static int sender(int argc, char** argv)
   for (int i = 0; i < messages_count; i++) {
 
     std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
     std::string msgName           = std::string("Message ") + std::to_string(i);
     std::string* payload          = new std::string(msgName); // copy the data we send:
     // 'msgName' is not a stable storage location
@@ -45,7 +45,7 @@ static int sender(int argc, char** argv)
   /* Start sending messages to let the workers know that they should stop */
   for (int i = 0; i < receivers_count; i++) {
     std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
     std::string* payload          = new std::string("finalize"); // Make a copy of the data we will send
 
     simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0);
@@ -69,7 +69,7 @@ static int sender(int argc, char** argv)
 static int receiver(int argc, char** argv)
 {
   xbt_assert(argc == 2, "Expecting one parameter from the XML deployment file but got %d", argc);
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(std::string("receiver-") + argv[1]);
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(std::string("receiver-") + argv[1]);
 
   XBT_INFO("Wait for my first message");
   for (bool cont = true; cont;) {
index a6762bc..6ac940d 100644 (file)
@@ -40,7 +40,7 @@ public:
     for (int i = 0; i < messages_count; i++) {
 
       std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
       std::string msgName           = std::string("Message ") + std::to_string(i);
       std::string* payload          = new std::string(msgName); // copy the data we send:
                                                                 // 'msgName' is not a stable storage location
@@ -54,7 +54,7 @@ public:
     /* Start sending messages to let the workers know that they should stop */
     for (int i = 0; i < receivers_count; i++) {
       std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
       std::string* payload          = new std::string("finalize"); // Make a copy of the data we will send
 
       simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0);
@@ -79,7 +79,7 @@ public:
   {
     xbt_assert(args.size() == 2, "Expecting one parameter from the XML deployment file but got %zu", args.size());
     std::string mboxName = std::string("receiver-") + args[1];
-    mbox                 = simgrid::s4u::Mailbox::byName(mboxName);
+    mbox                 = simgrid::s4u::Mailbox::by_name(mboxName);
   }
   void operator()()
   {
index 32b53e3..afcbc90 100644 (file)
@@ -45,7 +45,7 @@ public:
     for (int i = 0; i < messages_count; i++) {
 
       std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
       std::string msgName           = std::string("Message ") + std::to_string(i);
       std::string* payload          = new std::string(msgName); // copy the data we send:
                                                                 // 'msgName' is not a stable storage location
@@ -59,7 +59,7 @@ public:
     /* Start sending messages to let the workers know that they should stop */
     for (int i = 0; i < receivers_count; i++) {
       std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
-      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName);
+      simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
       std::string* payload          = new std::string("finalize"); // Make a copy of the data we will send
 
       simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0);
@@ -95,7 +95,7 @@ public:
   {
     xbt_assert(args.size() == 2, "Expecting one parameter from the XML deployment file but got %zu", args.size());
     std::string mboxName = std::string("receiver-") + args[1];
-    mbox                 = simgrid::s4u::Mailbox::byName(mboxName);
+    mbox                 = simgrid::s4u::Mailbox::by_name(mboxName);
   }
   void operator()()
   {
index 6487b32..e8cd04a 100644 (file)
@@ -32,7 +32,7 @@ struct s_payload {
 
 static void communication_tx_fun(std::vector<std::string> args)
 {
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0));
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(args.at(0));
   s_payload* payload            = new s_payload;
   payload->tx_actor_name        = simgrid::s4u::Actor::self()->get_cname();
   payload->tx_host              = simgrid::s4u::this_actor::get_host();
@@ -45,7 +45,7 @@ static void communication_rx_fun(std::vector<std::string> args)
 {
   const char* actor_name        = simgrid::s4u::Actor::self()->get_cname();
   const char* host_name         = simgrid::s4u::this_actor::get_host()->get_cname();
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0));
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(args.at(0));
 
   struct s_payload* payload = static_cast<struct s_payload*>(mbox->get());
   double clock_end          = simgrid::s4u::Engine::get_clock();
index d7ab98a..e618a38 100644 (file)
@@ -53,7 +53,7 @@ Node::Node(std::vector<std::string> args)
   // initialize my node
   id_                = std::stoi(args[1]);
   stream             = simgrid::s4u::this_actor::get_host()->extension<HostChord>()->getStream();
-  mailbox_           = simgrid::s4u::Mailbox::byName(std::to_string(id_));
+  mailbox_           = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
   next_finger_to_fix = 0;
   fingers_           = new int[nb_bits];
 
@@ -117,7 +117,7 @@ void Node::notifyAndQuit()
 
   XBT_DEBUG("Sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
   try {
-    simgrid::s4u::Mailbox::byName(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout);
+    simgrid::s4u::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout);
   } catch (xbt_ex& e) {
     if (e.category == timeout_error) {
       XBT_DEBUG("Timeout expired when sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
@@ -133,7 +133,7 @@ void Node::notifyAndQuit()
     XBT_DEBUG("Sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
 
     try {
-      simgrid::s4u::Mailbox::byName(std::to_string(pred_id_))->put(succ_msg, 10, timeout);
+      simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout);
     } catch (xbt_ex& e) {
       if (e.category == timeout_error) {
         XBT_DEBUG("Timeout expired when sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
@@ -216,8 +216,8 @@ void Node::checkPredecessor()
   if (pred_id_ == -1)
     return;
 
-  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::byName(std::to_string(pred_id_));
-  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_is_alive");
+  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_));
+  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_is_alive");
 
   ChordMessage* message = new ChordMessage(PREDECESSOR_ALIVE);
   message->request_id   = pred_id_;
@@ -259,8 +259,8 @@ int Node::remoteGetPredecessor(int ask_to)
 {
   int predecessor_id                      = -1;
   void* data                              = nullptr;
-  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::byName(std::to_string(ask_to));
-  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_pred");
+  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
+  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_pred");
 
   ChordMessage* message = new ChordMessage(GET_PREDECESSOR);
   message->request_id   = id_;
@@ -335,8 +335,8 @@ int Node::remoteFindSuccessor(int ask_to, int id)
 {
   int successor                           = -1;
   void* data                              = nullptr;
-  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::byName(std::to_string(ask_to));
-  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_succ");
+  simgrid::s4u::MailboxPtr mailbox        = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
+  simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_succ");
 
   ChordMessage* message = new ChordMessage(FIND_SUCCESSOR);
   message->request_id   = id_;
@@ -393,7 +393,7 @@ void Node::remoteNotify(int notify_id, int predecessor_candidate_id)
 
   // send a "Notify" request to notify_id
   XBT_DEBUG("Sending a 'Notify' request to %d", notify_id);
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(notify_id));
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(notify_id));
   mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
 }
 
@@ -440,7 +440,7 @@ void Node::handleMessage(ChordMessage* message)
       int closest = closestPrecedingFinger(message->request_id);
       XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
           message->request_id, closest);
-      simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(closest));
+      simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(closest));
       mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
     }
     break;
index 2e3208c..7e41353 100644 (file)
@@ -33,7 +33,7 @@ bool Node::join(unsigned int known_id)
   /* First step: Send a "FIND_NODE" request to the node we know */
   sendFindNode(known_id, id_);
 
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_));
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
   do {
     if (receive_comm == nullptr)
       receive_comm = mailbox->get_async(&received_msg);
@@ -79,9 +79,9 @@ bool Node::join(unsigned int known_id)
 void Node::sendFindNode(unsigned int id, unsigned int destination)
 {
   /* Gets the mailbox to send to */
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id));
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id));
   /* Build the task */
-  Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::byName(std::to_string(id_)),
+  Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::by_name(std::to_string(id_)),
                              simgrid::s4u::Host::current()->get_cname());
 
   /* Send the task */
@@ -200,7 +200,7 @@ bool Node::findNode(unsigned int id_to_find, bool count_in_stats)
     steps++;
     double time_beginreceive = simgrid::s4u::Engine::get_clock();
 
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_));
+    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
     do {
       if (receive_comm == nullptr)
         receive_comm = mailbox->get_async(&received_msg);
@@ -276,7 +276,7 @@ void Node::handleFindNode(Message* msg)
   // Building the answer to the request
   Message* answer =
       new Message(id_, msg->destination_id_, findClosest(msg->destination_id_),
-                  simgrid::s4u::Mailbox::byName(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname());
+                  simgrid::s4u::Mailbox::by_name(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname());
   // Sending the answer
   msg->answer_to_->put_init(answer, 1)->detach(kademlia::destroy);
 }
index 89edd85..172292a 100644 (file)
@@ -44,7 +44,7 @@ static int node(int argc, char* argv[])
 
     XBT_VERB("Main loop start");
 
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(node->getId()));
+    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(node->getId()));
 
     while (simgrid::s4u::Engine::get_clock() < deadline) {
       if (node->receive_comm == nullptr)
index 6de157c..a927e1f 100644 (file)
@@ -22,7 +22,7 @@ static void sender(std::vector<std::string> args)
   double comm_size = std::stod(args.at(1));
   XBT_INFO("Send %.0f bytes, in %d flows", comm_size, flow_amount);
 
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::string("message"));
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("message"));
 
   /* Sleep a while before starting the example */
   simgrid::s4u::this_actor::sleep_for(10);
@@ -48,7 +48,7 @@ static void receiver(std::vector<std::string> args)
 
   XBT_INFO("Receiving %d flows ...", flow_amount);
 
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::string("message"));
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("message"));
 
   if (flow_amount == 1) {
     void* res = mailbox->get();
index 8cfd309..2152cb4 100644 (file)
@@ -62,7 +62,8 @@ public:
     double size                 = std::stod(action[3]);
     std::string* payload        = new std::string(action[3]);
     double clock                = simgrid::s4u::Engine::get_clock();
-    simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_name() + "_" + action[2]);
+    simgrid::s4u::MailboxPtr to =
+        simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_name() + "_" + action[2]);
     ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME.c_str(), size,
               simgrid::s4u::this_actor::get_cname(), to->get_cname());
     to->put(payload, size);
@@ -75,7 +76,7 @@ public:
   {
     double clock = simgrid::s4u::Engine::get_clock();
     simgrid::s4u::MailboxPtr from =
-        simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::get_name());
+        simgrid::s4u::Mailbox::by_name(std::string(action[2]) + "_" + simgrid::s4u::this_actor::get_name());
 
     ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME.c_str(), simgrid::s4u::this_actor::get_cname(),
               from->get_cname());
index c7438ef..687e783 100644 (file)
@@ -117,26 +117,16 @@ public:
   /** private function, do not use. FIXME: make me protected */
   kernel::activity::MailboxImpl* get_impl() { return pimpl_; }
 
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const
-  {
-    return get_name();
-  }
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); }
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_impl()") kernel::activity::MailboxImpl* getImpl()
-  {
-    return get_impl();
-  }
-
   /** @brief Retrieves the name of that mailbox as a C++ string */
   const simgrid::xbt::string& get_name() const;
   /** @brief Retrieves the name of that mailbox as a C string */
   const char* get_cname() const;
 
   /** Retrieve the mailbox associated to the given C string */
-  static MailboxPtr byName(const char *name);
+  static MailboxPtr by_name(const char* name);
 
   /** Retrieve the mailbox associated to the given C++ string */
-  static MailboxPtr byName(std::string name);
+  static MailboxPtr by_name(std::string name);
 
   /** Returns whether the mailbox contains queued communications */
   bool empty();
@@ -153,10 +143,10 @@ public:
    * its host even before he does a recv(). This models the real behavior of TCP
    * and MPI communications, amongst other.
    */
-  void setReceiver(ActorPtr actor);
+  void set_receiver(ActorPtr actor);
 
   /** Return the actor declared as permanent receiver, or nullptr if none **/
-  ActorPtr getReceiver();
+  ActorPtr get_receiver();
 
   /** Creates (but don't start) a data emission to that mailbox */
   CommPtr put_init();
@@ -179,6 +169,30 @@ public:
   void* get(); // FIXME: make a typed template version
   /** Blocking data reception with timeout */
   void* get(double timeout);
+
+  // Deprecated functions
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::set_receiver()") void setReceiver(ActorPtr actor)
+  {
+    set_receiver(actor);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_receiver()") ActorPtr getReceiver() { return get_receiver(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const
+  {
+    return get_name();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_impl()") kernel::activity::MailboxImpl* getImpl()
+  {
+    return get_impl();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(const char* name)
+  {
+    return by_name(name);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(std::string name)
+  {
+    return by_name(name);
+  }
 };
 
 }} // namespace simgrid::s4u
index 0769959..dfc6ca9 100644 (file)
@@ -263,7 +263,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d
                                          double rate)
 {
   XBT_DEBUG("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'", alias);
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias);
   msg_error_t ret = MSG_OK;
   /* We no longer support getting a task from a specific host */
   if (host)
@@ -313,7 +313,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al
 {
   simdata_task_t t_simdata = nullptr;
   msg_process_t myself = MSG_process_self();
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias);
   TRACE_msg_task_put_start(task);
 
   /* Prepare the task to send */
@@ -452,7 +452,7 @@ msg_comm_t MSG_task_irecv(msg_task_t *task, const char *name)
  */
 msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rate)
 {
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(name);
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(name);
 
   /* FIXME: these functions are not traceable */
   /* Sanity check */
@@ -778,7 +778,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl
   msg_error_t ret = MSG_OK;
   simdata_task_t t_simdata = nullptr;
   msg_process_t process = MSG_process_self();
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias);
 
   TRACE_msg_task_put_start(task);
 
@@ -858,7 +858,7 @@ msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alia
  */
 int MSG_task_listen(const char *alias)
 {
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias);
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias);
   return mbox->listen() ? 1 : 0;
 }
 
@@ -872,7 +872,7 @@ int MSG_task_listen(const char *alias)
  */
 int MSG_task_listen_from(const char *alias)
 {
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias);
+  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias);
   simgrid::kernel::activity::CommImplPtr comm =
       boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(mbox->front());
 
index 0446eb9..12bb632 100644 (file)
@@ -20,6 +20,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mail
  * \param alias The name of the mailbox
  */
 void MSG_mailbox_set_async(const char *alias){
-  simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self());
+  simgrid::s4u::Mailbox::by_name(alias)->set_receiver(simgrid::s4u::Actor::self());
   XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
 }
index a6cfe1f..55a01a9 100644 (file)
@@ -359,7 +359,7 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
 
   /* wait until the migration have finished or on error has occurred */
   XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed");
-  simgrid::s4u::MailboxPtr mbox_ctl = simgrid::s4u::Mailbox::byName(
+  simgrid::s4u::MailboxPtr mbox_ctl = simgrid::s4u::Mailbox::by_name(
       std::string("__mbox_mig_ctl:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")");
   delete static_cast<std::string*>(mbox_ctl->get());
   tx->join();
index 257faeb..f942710 100644 (file)
@@ -40,10 +40,10 @@ public:
   {
     src_pm_ = vm_->getPm();
 
-    mbox_ctl = s4u::Mailbox::byName(std::string("__mbox_mig_ctl:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
-                                    "-" + dst_pm_->get_cname() + ")");
-    mbox     = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
-                                "-" + dst_pm_->get_cname() + ")");
+    mbox_ctl = s4u::Mailbox::by_name(std::string("__mbox_mig_ctl:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
+                                     "-" + dst_pm_->get_cname() + ")");
+    mbox = s4u::Mailbox::by_name(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
+                                 "-" + dst_pm_->get_cname() + ")");
   }
   void operator()();
 };
@@ -59,8 +59,8 @@ public:
   explicit MigrationTx(s4u::VirtualMachine* vm, s4u::Host* dst_pm) : vm_(vm), dst_pm_(dst_pm)
   {
     src_pm_ = vm_->getPm();
-    mbox    = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
-                                "-" + dst_pm_->get_cname() + ")");
+    mbox    = s4u::Mailbox::by_name(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() +
+                                 "-" + dst_pm_->get_cname() + ")");
   }
   void operator()();
   sg_size_t sendMigrationData(sg_size_t size, int stage, int stage2_round, double mig_speed, double timeout);
index f57874e..421486f 100644 (file)
@@ -26,7 +26,7 @@ const char* Mailbox::get_cname() const
   return pimpl_->get_cname();
 }
 
-MailboxPtr Mailbox::byName(const char* name)
+MailboxPtr Mailbox::by_name(const char* name)
 {
   kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::byNameOrNull(name);
   if (mbox == nullptr) {
@@ -35,9 +35,9 @@ MailboxPtr Mailbox::byName(const char* name)
   return MailboxPtr(&mbox->piface_, true);
 }
 
-MailboxPtr Mailbox::byName(std::string name)
+MailboxPtr Mailbox::by_name(std::string name)
 {
-  return byName(name.c_str());
+  return by_name(name.c_str());
 }
 
 bool Mailbox::empty()
@@ -55,13 +55,13 @@ smx_activity_t Mailbox::front()
   return pimpl_->comm_queue.empty() ? nullptr : pimpl_->comm_queue.front();
 }
 
-void Mailbox::setReceiver(ActorPtr actor)
+void Mailbox::set_receiver(ActorPtr actor)
 {
   simix::simcall([this, actor]() { this->pimpl_->setReceiver(actor); });
 }
 
 /** @brief get the receiver (process associated to the mailbox) */
-ActorPtr Mailbox::getReceiver()
+ActorPtr Mailbox::get_receiver()
 {
   if (pimpl_->permanent_receiver == nullptr)
     return ActorPtr();
index 15a6c1d..603c39e 100644 (file)
@@ -21,8 +21,8 @@ using simgrid::s4u::ActorPtr;
 Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
     : finalization_barrier_(finalization_barrier), actor_(actor)
 {
-  mailbox_         = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(actor_->get_pid()));
-  mailbox_small_   = simgrid::s4u::Mailbox::byName("small-" + std::to_string(actor_->get_pid()));
+  mailbox_         = simgrid::s4u::Mailbox::by_name("SMPI-" + std::to_string(actor_->get_pid()));
+  mailbox_small_   = simgrid::s4u::Mailbox::by_name("small-" + std::to_string(actor_->get_pid()));
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
   state_           = SMPI_UNINITIALIZED;
@@ -77,7 +77,7 @@ void Process::set_data(int* argc, char*** argv)
   argc_ = argc;
   argv_ = argv;
   // set the process attached to the mailbox
-  mailbox_small_->setReceiver(actor_);
+  mailbox_small_->set_receiver(actor_);
   XBT_DEBUG("<%ld> SMPI process has been initialized: %p", actor_->get_pid(), actor_.get());
 }
 
index f160b23..648e9a2 100644 (file)
@@ -51,7 +51,7 @@ static void sender(std::vector<std::string> args)
   for (unsigned int test = 1; test <= args[0].size(); test++) {
     this_actor::sleep_until(test * 5 - 5);
     std::string* mboxName         = new std::string("Test #" + std::to_string(test));
-    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName->c_str());
+    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName->c_str());
 
     switch (args[0][test - 1]) {
       case 'r':
@@ -98,7 +98,7 @@ static void receiver(std::vector<std::string> args)
   for (unsigned int test = 1; test <= args[0].size(); test++) {
     this_actor::sleep_until(test * 5 - 5);
     std::string mboxName          = "Test #" + std::to_string(test);
-    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName.c_str());
+    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName.c_str());
     void* received                = nullptr;
 
     switch (args[0][test - 1]) {
@@ -123,24 +123,24 @@ static void receiver(std::vector<std::string> args)
         break;
       case 'p':
         XBT_INFO("Test %u: p (regular receive on permanent mailbox)", test);
-        mbox->setReceiver(Actor::self());
+        mbox->set_receiver(Actor::self());
         received = mbox->get();
         break;
       case 'P':
         XBT_INFO("Test %u: P (sleep + regular receive on permanent mailbox)", test);
         simgrid::s4u::this_actor::sleep_for(0.5);
-        mbox->setReceiver(Actor::self());
+        mbox->set_receiver(Actor::self());
         received = mbox->get();
         break;
       case 'j':
         XBT_INFO("Test %u: j (irecv on permanent mailbox)", test);
-        mbox->setReceiver(Actor::self());
+        mbox->set_receiver(Actor::self());
         mbox->get_async(&received)->wait();
         break;
       case 'J':
         XBT_INFO("Test %u: J (sleep + irecv on permanent mailbox)", test);
         simgrid::s4u::this_actor::sleep_for(0.5);
-        mbox->setReceiver(Actor::self());
+        mbox->set_receiver(Actor::self());
         mbox->get_async(&received)->wait();
         break;
       default:
index c9ca453..bd4dece 100644 (file)
@@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example")
 
 static void server()
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox");
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
 
   simgrid::s4u::CommPtr sendComm = mailbox->put_async(new std::string("Some data"), 0);
 
@@ -28,8 +28,8 @@ static void server()
   delete res;
   sendComm->wait();
 
-  simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::byName("mailbox2");
-  mailbox2->setReceiver(simgrid::s4u::Actor::self());
+  simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::by_name("mailbox2");
+  mailbox2->set_receiver(simgrid::s4u::Actor::self());
 
   mailbox2->put_init(new std::string("More data"), 0)->detach();
 
index b50bdbc..7ae2222 100644 (file)
@@ -15,7 +15,7 @@ static int my_onexit(smx_process_exit_status_t /*status*/, int* pid)
 
 static void sendpid()
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox");
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
   int pid                          = simgrid::s4u::this_actor::get_pid();
   double comm_size                 = 100000;
   simgrid::s4u::this_actor::on_exit((int_f_pvoid_pvoid_t)my_onexit, &pid);
@@ -29,7 +29,7 @@ static void sendpid()
 
 static void killall()
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox");
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
   for (int i = 0; i < 3; i++) {
     int* pid = static_cast<int*>(mailbox->get());
     XBT_INFO("Killing process \"%d\".", *pid);
index 2cdf4b7..813b037 100644 (file)
@@ -52,7 +52,7 @@ static void hsm_put(const std::string& remote_host, const std::string& src, cons
   // Send file
   XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::get_cname(), read_size, remote_host.c_str());
   std::string* payload             = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size));
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host);
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(remote_host);
   mailbox->put(payload, static_cast<double>(read_size));
   simgrid::s4u::this_actor::sleep_for(.4);
 }
@@ -122,7 +122,7 @@ static void client()
   hsm_put("alice", "/home/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml", "c:\\Windows\\titi.xml");
   hsm_put("alice", "/home/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c", "c:\\Windows\\tata.c");
 
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("alice");
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("alice");
   mailbox->put(new std::string("finalize"), 0);
 
   get_set_storage_data("Disk1");
@@ -131,7 +131,7 @@ static void client()
 static void server()
 {
   storage_info(simgrid::s4u::this_actor::get_host());
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_cname());
+  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
 
   XBT_INFO("Server waiting for transfers ...");
   while (1) {