Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement Activity::destroy when you want to clean up things
[simgrid.git] / include / simgrid / s4u / Engine.hpp
index fdffcc1..e57c3b6 100644 (file)
@@ -13,6 +13,7 @@
 #include <simgrid/kernel/resource/Model.hpp>
 #include <simgrid/s4u/NetZone.hpp>
 
+#include <set>
 #include <string>
 #include <utility>
 #include <vector>
@@ -41,26 +42,23 @@ public:
 #endif
 
   /** Finalize the default engine and all its dependencies */
-  static void shutdown();
+  void shutdown();
 
-  /** Run the simulation after initialization */
+  /** Run the simulation until its end */
   void run() const;
 
+  /** Run the simulation until the specified date */
+  void run_until(double max_date) const;
+
   /** @brief Retrieve the simulation time (in seconds) */
   static double get_clock();
   /** @brief Retrieve the engine singleton */
   static s4u::Engine* get_instance();
   static s4u::Engine* get_instance(int* argc, char** argv);
+  static bool has_instance() { return instance_ != nullptr; }
 
   void load_platform(const std::string& platf) const;
 
-#ifndef DOXYGEN
-  XBT_ATTRIB_DEPRECATED_v330("Please change the return code of your actors to void") void register_function(
-      const std::string& name, int (*code)(int, char**));
-  XBT_ATTRIB_DEPRECATED_v330("Please change the return code of your actors to void") void register_default(
-      int (*code)(int, char**));
-#endif
-
   void register_function(const std::string& name, const std::function<void(int, char**)>& code);
   void register_function(const std::string& name, const std::function<void(std::vector<std::string>)>& code);
   void register_function(const std::string& name, const kernel::actor::ActorCodeFactory& factory);
@@ -86,16 +84,19 @@ public:
     register_function(name, code_factory);
   }
 
+  /** If non-null, the provided set will be filled with all activities that fail to start because of a veto */
+  void track_vetoed_activities(std::set<Activity*>* vetoed_activities) const;
+
   void load_deployment(const std::string& deploy) const;
 
 protected:
 #ifndef DOXYGEN
-  friend surf::HostImpl;
   friend Host;
   friend Link;
   friend Disk;
   friend kernel::routing::NetPoint;
   friend kernel::routing::NetZoneImpl;
+  friend kernel::resource::HostImpl;
   friend kernel::resource::LinkImpl;
   void host_register(const std::string& name, Host* host);
   void host_unregister(const std::string& name);
@@ -172,6 +173,8 @@ public:
     return res;
   }
 
+  kernel::EngineImpl* get_impl() const { return pimpl; }
+
   /** Returns whether SimGrid was initialized yet -- mostly for internal use */
   static bool is_initialized();
   /** @brief set a configuration variable
@@ -215,6 +218,8 @@ private:
   void initialize(int* argc, char** argv);
 };
 
+std::vector<ActivityPtr> create_DAG_from_dot(const std::string& filename);
+
 #ifndef DOXYGEN /* Internal use only, no need to expose it */
 template <class T>
 XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, std::vector<T*>* whereto)