Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
improve doxygen comments in s4u
[simgrid.git] / include / simgrid / s4u / Exec.hpp
1 /* Copyright (c) 2017-2018. 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 SIMGRID_S4U_EXEC_HPP
7 #define SIMGRID_S4U_EXEC_HPP
8
9 #include <simgrid/forward.h>
10 #include <simgrid/s4u/Activity.hpp>
11
12 #include <atomic>
13
14 namespace simgrid {
15 namespace s4u {
16
17 /** Computation #Activity, representing the asynchronous disk access.
18  *
19  * They are generated from simgrid::s4u::this_actor::exec_init() or simgrid::s4u::Host::execute().
20  */
21
22 class XBT_PUBLIC Exec : public Activity {
23   Exec() : Activity() {}
24 public:
25   friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Exec * e);
26   friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Exec * e);
27   friend XBT_PUBLIC ExecPtr this_actor::exec_init(double flops_amount);
28
29   ~Exec() = default;
30
31   Activity* start() override;
32   Activity* wait() override;
33   Activity* wait(double timeout) override;
34   Activity* cancel() override;
35   bool test();
36
37   ExecPtr set_priority(double priority);
38   ExecPtr set_bound(double bound);
39   ExecPtr set_host(Host* host);
40   ExecPtr set_name(std::string name);
41   ExecPtr set_tracing_category(std::string category);
42   Host* get_host();
43
44   double get_remaining() override;
45   double get_remaining_ratio();
46
47   //////////////// Deprecated functions
48   /** @deprecated See Exec::set_priority() */
49   XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
50   {
51     return set_priority(priority);
52   }
53   /** @deprecated See Exec::set_bound() */
54   XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
55   /** @deprecated See Exec::set_host() */
56   XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_host()") ExecPtr setHost(Host* host) { return set_host(host); }
57   /** @deprecated See Exec::get_host() */
58   XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_host()") Host* getHost() { return get_host(); }
59   /** @deprecated See Exec::get_remaining_ratio() */
60   XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_remaining_ratio()") double getRemainingRatio()
61   {
62     return get_remaining_ratio();
63   }
64
65 private:
66   Host* host_                   = nullptr;
67   double flops_amount_          = 0.0;
68   double priority_              = 1.0;
69   double bound_                 = 0.0;
70   std::string name_             = "";
71   std::string tracing_category_ = "";
72   std::atomic_int_fast32_t refcount_{0};
73 }; // class
74 }
75 }; // Namespace simgrid::s4u
76
77 #endif /* SIMGRID_S4U_EXEC_HPP */