Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Delete the CPU (fix a mem leak)
[simgrid.git] / include / simgrid / s4u / host.hpp
index 5d5df15..2f5ef50 100644 (file)
 
 #include <simgrid/simix.h>
 #include <simgrid/datatypes.h>
+#include <simgrid/s4u/forward.hpp>
 
 namespace simgrid {
 namespace s4u {
 
-class Actor;
-class Storage;
-class File;
-
 /** @brief Simulated machine that can host some actors
  *
  * It represents some physical resource with computing and networking capabilities.
@@ -45,13 +42,13 @@ private:
 public: // TODO, make me private
        ~Host();
 public:
-       /** Retrieves an host from its name. */
-       static s4u::Host *byName(std::string name);
-       /** Retrieves the host on which the current actor is running */
-       static s4u::Host *current();
 
   static Host* by_name_or_null(const char* name);
   static Host* by_name_or_create(const char* name);
+       /** Retrieves an host from its name. */
+       static s4u::Host *by_name(std::string name);
+       /** Retrieves the host on which the current actor is running */
+       static s4u::Host *current();
 
        simgrid::xbt::string const& name() const { return name_; }
 
@@ -60,34 +57,32 @@ public:
         * 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();
+       void turn_on();
        /** Turns that host off. All actors are forcefully stopped. */
-       void turnOff();
+       void turn_off();
        /** Returns if that host is currently up and running */
-       bool isOn();
-       bool isOff() { return !isOn(); }
-
-       double getSpeed();
-       int getCoreAmount();
-  xbt_dict_t getProperties();
-  xbt_swag_t getProcessList();
-  double getCurrentPowerPeak();
-  double getPowerPeakAt(int pstate_index);
-  void setPState(int pstate_index);
-       int getNbPStates() const;
-  int getPState();
-  void getParams(vm_params_t params);
-  void setParams(vm_params_t params);
-  xbt_dict_t getMountedStorageList();
-  xbt_dynar_t getAttachedStorageList();
+       bool is_on();
+       bool is_off() { return !is_on(); }
+
+       double speed();
+       int core_count();
+       xbt_dict_t properties();
+       xbt_swag_t processes();
+       double current_power_peak();
+       double power_peak_at(int pstate_index);
+       void set_pstate(int pstate_index);
+       int pstates_count() const;
+       int pstate();
+       void get_parameters(vm_params_t params);
+       void set_parameters(vm_params_t params);
+       xbt_dict_t mounted_storages_as_dict(); // HACK
+       xbt_dynar_t attached_storages();
 
        /** 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();
+       boost::unordered_map<std::string, Storage*> const &mounted_storages();
 
 private:
        simgrid::xbt::string name_ = "noname";
@@ -96,6 +91,7 @@ private:
 public:
        // FIXME: these should be protected, but it leads to many errors
        // Use the extensions stuff for this? Go through simgrid::surf::Host?
+  // TODO, this could be a unique_ptr
        surf::Cpu     *pimpl_cpu = nullptr;
        surf::NetCard *pimpl_netcard = nullptr;