Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
S4U: Implement Storage and File
[simgrid.git] / include / simgrid / s4u / host.hpp
index 54399ec..74b826b 100644 (file)
@@ -7,15 +7,18 @@
 #define SIMGRID_S4U_HOST_HPP
 
 #include <boost/unordered_map.hpp>
+#include <vector>
 
 #include "simgrid/simix.h"
 
 namespace simgrid {
 namespace s4u {
 
-class Process;
+class Actor;
+class Storage;
+class File;
 
-/** @brief Simulated machine that can host some processes
+/** @brief Simulated machine that can host some actors
  *
  * It represents some physical resource with computing and networking capabilities.
  *
@@ -24,42 +27,55 @@ class Process;
  * You cannot create a host yourself.
  *
  * You can retrieve a particular host using @link{simgrid::s4u::Host.byName()},
- * and processes can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
+ * and actors can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
  */
 class Host {
+       friend Actor;
+       friend File;
 private:
        Host(const char *name);
+protected:
+       ~Host();
 public:
        /** Retrieves an host from its name. */
        static s4u::Host *byName(std::string name);
-       /** Retrieves the host on which the current process is running */
+       /** Retrieves the host on which the current actor is running */
        static s4u::Host *current();
 
-       const char* getName();
+       const char* name();
 
-       /** Turn sthat host on if it was previously off
+       /** Turnthat host on if it was previously off
         *
-        * All processes on that host which were marked autorestart will be restarted automatically.
+        * All actors on that host which were marked autorestart will be restarted automatically.
         * This call does nothing if the host is already on.
         */
        void turnOn();
-       /** Turns that host off. All processes are forcefully stopped. */
+       /** Turns that host off. All actors are forcefully stopped. */
        void turnOff();
        /** Returns if that host is currently up and running */
        bool isOn();
 
 
        /** Allows to store user data on that host */
-       void setData(void *data) {p_userdata = data;}
+       void set_userdata(void *data) {p_userdata = data;}
        /** Retrieves the previously stored data */
-       void* getData() {return p_userdata;}
+       void* userdata() {return p_userdata;}
+
+       /** Get an associative list [mount point]->[Storage] off all local mount points.
+        *
+        *      This is defined in the platform file, and cannot be modified programatically (yet).
+        *
+        *      Do not change the returned value in any way.
+        */
+       boost::unordered_map<std::string, Storage&> &mountedStorages();
+private:
+       boost::unordered_map<std::string, Storage&> *mounts = NULL; // caching
 
 protected:
-       friend Process;
-       sg_host_t getInferior() {return p_sghost;}
+       sg_host_t inferior() {return p_inferior;}
 private:
        void*p_userdata=NULL;
-       sg_host_t p_sghost;
+       sg_host_t p_inferior;
        static boost::unordered_map<std::string, s4u::Host *> *hosts;
 };
 
@@ -149,11 +165,6 @@ public class Host {
         */
        public native void setProperty(String name, String value);
 
-       /** This methods returns the list of mount point names on an host
-        * @return An array containing all mounted storages on the host
-        */
-       public native Storage[] getMountedStorage();
-
        /** This methods returns the list of storages attached to an host
         * @return An array containing all storages (name) attached to the host
         */