Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let base class dtor deal with surf action
[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   IoImplPtr set_name(const std::string& name);
25   IoImplPtr set_size(sg_size_t size);
26   IoImplPtr set_type(s4u::Io::OpType type);
27   IoImplPtr set_storage(resource::StorageImpl* storage);
28
29   sg_size_t get_performed_ioops() { return performed_ioops_; }
30
31   IoImpl* start();
32   void post() override;
33   void finish() override;
34   void cancel();
35   double get_remaining();
36
37   static xbt::signal<void(IoImplPtr)> on_start;
38   static xbt::signal<void(IoImplPtr)> on_completion;
39 };
40 } // namespace activity
41 } // namespace kernel
42 } // namespace simgrid
43
44 #endif