Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to chain calls to activity::Comm functions
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 26 Sep 2018 23:05:15 +0000 (01:05 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 26 Sep 2018 23:13:30 +0000 (01:13 +0200)
commit7685128879fd2a88a5b9226114c223c65517668c
treebae43954f83d1ec596f171ba3c8b513802b8f23c
parent9f159d9330c05815626203388772dc0cfa5a1575
Allow to chain calls to activity::Comm functions

(and the same for Exec and Io activities)

We want to write something like:

  CommPtr comm = mailbox->put_async(data, 8)->set_rate(0);

Before, all these functions were returning an Activity* in the hope of
allowing such chaining, but it was failing, as most of these functions
only exist in Comm, not in Activity. This commit improves this.

It also opens a Pandora box. The method
   Activity* Activity::start()
is now overriden by the method
   Comm* Comm::start()
. (Comm is a subclass of Activity)

I believe that changing the return type to a subclass is OK when
overriding a method, but I'm not 100% sure. At least, both GCC and
clang seem OK with that code.
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Io.hpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Exec.cpp
src/s4u/s4u_Io.cpp