+ void parse(xbt::ReplayAction& action, const std::string& name) override;
+};
+
+/**
+ * Base class for all ReplayActions.
+ * Note that this class actually implements the behavior of each action
+ * while the parsing of the replay arguments is done in the @ref ActionArgParser class.
+ * In other words: The logic goes here, the setup is done by the ActionArgParser.
+ */
+template <class T> class ReplayAction {
+protected:
+ const std::string name;
+ const aid_t my_proc_id = s4u::this_actor::get_pid();
+ T args;
+
+public:
+ explicit ReplayAction(const std::string& name) : name(name) {}
+ virtual ~ReplayAction() = default;
+
+ void execute(xbt::ReplayAction& action)
+ {
+ // Needs to be re-initialized for every action, hence here
+ double start_time = smpi_process()->simulated_elapsed();
+ args.parse(action, name);
+ kernel(action);
+ if (name != "Init")
+ log_timed_action(action, start_time);
+ }
+
+ virtual void kernel(simgrid::xbt::ReplayAction& action) = 0;
+ unsigned char* send_buffer(int size) { return smpi_get_tmp_sendbuffer(size); }
+ unsigned char* recv_buffer(int size) { return smpi_get_tmp_recvbuffer(size); }
+};
+
+class WaitAction : public ReplayAction<WaitTestParser> {
+ RequestStorage& req_storage;
+
+public:
+ explicit WaitAction(RequestStorage& storage) : ReplayAction("Wait"), req_storage(storage) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class SendAction : public ReplayAction<SendRecvParser> {
+ RequestStorage& req_storage;
+
+public:
+ explicit SendAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class RecvAction : public ReplayAction<SendRecvParser> {
+ RequestStorage& req_storage;
+
+public:
+ explicit RecvAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class ComputeAction : public ReplayAction<ComputeParser> {
+public:
+ explicit ComputeAction() : ReplayAction("compute") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class SleepAction : public ReplayAction<SleepParser> {
+public:
+ explicit SleepAction() : ReplayAction("sleep") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class LocationAction : public ReplayAction<LocationParser> {
+public:
+ explicit LocationAction() : ReplayAction("location") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class TestAction : public ReplayAction<WaitTestParser> {
+private:
+ RequestStorage& req_storage;
+
+public:
+ explicit TestAction(RequestStorage& storage) : ReplayAction("Test"), req_storage(storage) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class InitAction : public ReplayAction<ActionArgParser> {
+public:
+ explicit InitAction() : ReplayAction("Init") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class CommunicatorAction : public ReplayAction<ActionArgParser> {
+public:
+ explicit CommunicatorAction() : ReplayAction("Comm") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class WaitAllAction : public ReplayAction<ActionArgParser> {
+ RequestStorage& req_storage;
+
+public:
+ explicit WaitAllAction(RequestStorage& storage) : ReplayAction("waitall"), req_storage(storage) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class BarrierAction : public ReplayAction<ActionArgParser> {
+public:
+ explicit BarrierAction() : ReplayAction("barrier") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class BcastAction : public ReplayAction<BcastArgParser> {
+public:
+ explicit BcastAction() : ReplayAction("bcast") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class ReduceAction : public ReplayAction<ReduceArgParser> {
+public:
+ explicit ReduceAction() : ReplayAction("reduce") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class AllReduceAction : public ReplayAction<AllReduceArgParser> {
+public:
+ explicit AllReduceAction() : ReplayAction("allreduce") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class AllToAllAction : public ReplayAction<AllToAllArgParser> {
+public:
+ explicit AllToAllAction() : ReplayAction("alltoall") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class GatherAction : public ReplayAction<GatherArgParser> {
+public:
+ explicit GatherAction(const std::string& name) : ReplayAction(name) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class GatherVAction : public ReplayAction<GatherVArgParser> {
+public:
+ explicit GatherVAction(const std::string& name) : ReplayAction(name) {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class ScatterAction : public ReplayAction<ScatterArgParser> {
+public:
+ explicit ScatterAction() : ReplayAction("scatter") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class ScatterVAction : public ReplayAction<ScatterVArgParser> {
+public:
+ explicit ScatterVAction() : ReplayAction("scatterv") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class ReduceScatterAction : public ReplayAction<ReduceScatterArgParser> {
+public:
+ explicit ReduceScatterAction() : ReplayAction("reducescatter") {}
+ void kernel(xbt::ReplayAction& action) override;
+};
+
+class AllToAllVAction : public ReplayAction<AllToAllVArgParser> {
+public:
+ explicit AllToAllVAction() : ReplayAction("alltoallv") {}
+ void kernel(xbt::ReplayAction& action) override;