Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
callbacks are actually meant for external users to use
[simgrid.git] / include / simgrid / s4u / Engine.hpp
index 94dc8d1..b9c7707 100644 (file)
@@ -56,8 +56,18 @@ public:
   /** @brief Load a deployment file and launch the actors that it contains */
   void loadDeployment(const char* deploy);
 
-  size_t hostCount();
-  void hostList(std::vector<Host*> * whereTo);
+protected:
+  friend s4u::Host;
+  void addHost(std::string name, simgrid::s4u::Host * host);
+  void delHost(std::string name);
+
+public:
+  simgrid::s4u::Host* hostByName(std::string name);
+  simgrid::s4u::Host* hostByNameOrNull(std::string name);
+  size_t getHostCount();
+  void getHostList(std::vector<Host*> * whereTo);
+  size_t getLinkCount();
+  void getLinkList(std::vector<Link*> * list);
 
   /** @brief Run the simulation */
   void run();
@@ -66,17 +76,17 @@ public:
   static double getClock();
 
   /** @brief Retrieve the engine singleton */
-  static s4u::Engine* instance();
+  static s4u::Engine* getInstance();
 
   /** @brief Retrieve the root netzone, containing all others */
-  simgrid::s4u::NetZone* netRoot();
+  simgrid::s4u::NetZone* getNetRoot();
 
   /** @brief Retrieve the netzone of the given name (or nullptr if not found) */
-  simgrid::s4u::NetZone* netzoneByNameOrNull(const char* name);
+  simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
 
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
-  simgrid::kernel::routing::NetPoint* netpointByNameOrNull(const char* name);
-  void netpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
+  simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
+  void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
   void netpointRegister(simgrid::kernel::routing::NetPoint * card);
   void netpointUnregister(simgrid::kernel::routing::NetPoint * card);
 
@@ -100,6 +110,15 @@ public:
   /** Returns whether SimGrid was initialized yet -- mostly for internal use */
   static bool isInitialized();
 
+  /** @brief set a configuration variable
+   *
+   * Do --help on any simgrid binary to see the list of currently existing configuration variables (see @ref options).
+   *
+   * Example:
+   * e->setConfig("host/model","ptask_L07");
+   */
+  void setConfig(std::string str);
+
   simgrid::kernel::EngineImpl* pimpl;
 
 private:
@@ -108,13 +127,16 @@ private:
 
 /** Callback fired when the platform is created (ie, the xml file parsed),
  * right before the actual simulation starts. */
-extern XBT_PRIVATE xbt::signal<void()> onPlatformCreated;
+extern XBT_PUBLIC(xbt::signal<void()>) onPlatformCreated;
 
 /** Callback fired when the main simulation loop ends, just before MSG_run (or similar) ends */
-extern XBT_PRIVATE xbt::signal<void()> onSimulationEnd;
+extern XBT_PUBLIC(xbt::signal<void()>) onSimulationEnd;
 
 /** Callback fired when the time jumps into the future */
-extern XBT_PRIVATE xbt::signal<void(double)> onTimeAdvance;
+extern XBT_PUBLIC(xbt::signal<void(double)>) onTimeAdvance;
+
+/** Callback fired when the time cannot jump because of inter-actors deadlock */
+extern XBT_PUBLIC(xbt::signal<void(void)>) onDeadlock;
 }
 } // namespace simgrid::s4u