Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
What ActivityImpl child should look like IMHO
[simgrid.git] / src / kernel / activity / IoImpl.hpp
1 /* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMIX_SYNCHRO_IO_HPP
7 #define SIMIX_SYNCHRO_IO_HPP
8
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include "surf/surf.hpp"
11 #include <simgrid/s4u/Io.hpp>
12
13 namespace simgrid {
14 namespace kernel {
15 namespace activity {
16
17 class XBT_PUBLIC IoImpl : public ActivityImpl {
18   resource::StorageImpl* storage_ = nullptr;
19   sg_size_t size_                 = 0;
20   s4u::Io::OpType type_           = s4u::Io::OpType::READ;
21   sg_size_t performed_ioops_      = 0;
22
23 public:
24   ~IoImpl() override;
25   IoImpl() = default;
26
27   IoImplPtr set_name(const std::string& name);
28   IoImplPtr set_size(sg_size_t size);
29   IoImplPtr set_type(s4u::Io::OpType type);
30   IoImplPtr set_storage(resource::StorageImpl* storage);
31
32   sg_size_t get_performed_ioops() { return performed_ioops_; }
33
34   IoImpl* start();
35   void post() override;
36   void finish() override;
37   void cancel();
38   double get_remaining();
39
40   static xbt::signal<void(IoImplPtr)> on_start;
41   static xbt::signal<void(IoImplPtr)> on_completion;
42 };
43 } // namespace activity
44 } // namespace kernel
45 } // namespace simgrid
46
47 #endif