Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert S4U to my current coding convention
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 24 Feb 2016 20:41:24 +0000 (21:41 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 24 Feb 2016 20:41:24 +0000 (21:41 +0100)
23 files changed:
examples/s4u/io/s4u_io_test.cpp
include/simgrid/s4u/comm.hpp
include/simgrid/s4u/engine.hpp
include/simgrid/s4u/file.hpp
include/simgrid/s4u/host.hpp
include/simgrid/s4u/mailbox.hpp
include/simgrid/s4u/storage.hpp
src/msg/msg_host.cpp
src/msg/msg_io.cpp
src/msg/msg_vm.cpp
src/s4u/s4u_comm.cpp
src/s4u/s4u_engine.cpp
src/s4u/s4u_file.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_mailbox.cpp
src/s4u/s4u_storage.cpp
src/simgrid/host.cpp
src/simix/libsmx.cpp
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/smx_process.cpp
src/surf/plugins/energy.cpp

index 789a8f4..20a3db2 100644 (file)
@@ -25,8 +25,8 @@ public:
       simgrid::s4u::Storage &storage = *kv.second;
 
       // Retrieve disk's information
-      sg_size_t free_size = storage.size_free();
-      sg_size_t used_size = storage.size_used();
+      sg_size_t free_size = storage.sizeFree();
+      sg_size_t used_size = storage.sizeUsed();
       sg_size_t size = storage.size();
 
       XBT_INFO("    %s (%s) Used: %llu; Free: %llu; Total: %llu.",
@@ -36,7 +36,7 @@ public:
 
   int main(int argc, char **argv) {
     boost::unordered_map <std::string, simgrid::s4u::Storage *> const& mounts =
-      simgrid::s4u::Host::current()->mounted_storages();
+      simgrid::s4u::Host::current()->mountedStorages();
 
     show_info(mounts);
 
@@ -69,7 +69,7 @@ public:
     file->move(newpath);
 
     // Test attaching some user data to the file
-    file->set_userdata(xbt_strdup("777"));
+    file->setUserdata(xbt_strdup("777"));
     XBT_INFO("User data attached to the file: %s", (char*)file->userdata());
 
     // Close the file
@@ -79,7 +79,7 @@ public:
     XBT_INFO("Get/set data for storage element: %s",storage.name());
     XBT_INFO("    Uninitialized storage data: '%s'", (char*)storage.userdata());
 
-    storage.set_userdata(xbt_strdup("Some user data"));
+    storage.setUserdata(xbt_strdup("Some user data"));
     XBT_INFO("    Set and get data: '%s'", (char*)storage.userdata());
 
     /*
index ded1496..b56e272 100644 (file)
@@ -39,16 +39,16 @@ public:
   void wait(double timeout) override;
 
 private:
-  double p_rate=-1;
+  double rate_=-1;
 public:
   /** Sets the maximal communication rate (in byte/sec). Must be done before start */
   void setRate(double rate);
 
 private:
-  void *p_dstBuff = NULL;
-  size_t p_dstBuffSize = 0;
-  void *p_srcBuff = NULL;
-  size_t p_srcBuffSize = sizeof(void*);
+  void *dstBuff_ = NULL;
+  size_t dstBuffSize_ = 0;
+  void *srcBuff_ = NULL;
+  size_t srcBuffSize_ = sizeof(void*);
 public:
   /** Specify the data to send */
   void setSrcData(void * buff);
@@ -66,15 +66,15 @@ public:
 
 
 private: /* FIXME: expose these elements in the API */
-  int p_detached = 0;
-    int (*p_matchFunction)(void *, void *, smx_synchro_t) = NULL;
-    void (*p_cleanFunction)(void *) = NULL;
-    void (*p_copyDataFunction)(smx_synchro_t, void*, size_t) = NULL;
+  int detached_ = 0;
+  int (*matchFunction_)(void *, void *, smx_synchro_t) = NULL;
+  void (*cleanFunction_)(void *) = NULL;
+  void (*copyDataFunction_)(smx_synchro_t, void*, size_t) = NULL;
 
 private:
-  Actor *p_sender = NULL;
-  Actor *p_receiver = NULL;
-  Mailbox *p_mailbox = NULL;
+  Actor *sender_ = NULL;
+  Actor *receiver_ = NULL;
+  Mailbox *mailbox_ = NULL;
 };
 
 }} // namespace simgrid::s4u
index e5bc4d2..b81a57f 100644 (file)
@@ -29,14 +29,14 @@ public:
   void loadPlatform(const char *platf);
 
   /** Registers the main function of an actor that will be launched from the deployment file */
-  void register_function(const char*name, int (*code)(int,char**));
+  void registerFunction(const char*name, int (*code)(int,char**));
 
   /** Registers a function as the default main function of actors
    *
    * It will be used as fallback when the function requested from the deployment file was not registered.
    * It is used for trace-based simulations (see examples/msg/actions).
    */
-  void register_default(int (*code)(int,char**));
+  void registerDefault(int (*code)(int,char**));
 
   /** @brief Load a deployment file and launch the actors that it contains */
   void loadDeployment(const char *deploy);
index f2182a3..90d0915 100644 (file)
@@ -30,30 +30,32 @@ public:
   File(const char *fullpath, void* userdata);
   ~File();
 private:
-  smx_file_t p_inferior;
-  const char *p_path;
+  smx_file_t inferior_;
+  const char *path_;
 
 public:
   /** Retrieves the path to the file */
-  const char *path() { return p_path;}
+  const char *path() { return path_;}
 public:
   /** Simulates a read action. Returns the size of data actually read
    *
-   *  FIXME: reading from a remotely mounted disk is not implemented yet. Any storage is considered as local, and no network communication ever occur.
+   *  FIXME: reading from a remotely mounted disk is not implemented yet.
+   *  Any storage is considered as local, and no network communication ever occur.
    */
   sg_size_t read(sg_size_t size);
   /** Simulates a write action. Returns the size of data actually written.
    *
-   *  FIXME: reading from a remotely mounted disk is not implemented yet. Any storage is considered as local, and no network communication ever occur.
+   *  FIXME: reading from a remotely mounted disk is not implemented yet.
+   *  Any storage is considered as local, and no network communication ever occur.
    */
   sg_size_t write(sg_size_t size);
 
   /** Allows to store user data on that host */
-  void set_userdata(void *data) {p_userdata = data;}
+  void setUserdata(void *data) {userdata_ = data;}
   /** Retrieves the previously stored data */
-  void* userdata() {return p_userdata;}
+  void* userdata() {return userdata_;}
 private:
-  void *p_userdata=NULL;
+  void *userdata_=NULL;
 
 public:
   /** Retrieve the datasize */
index 20e5e7d..d51eda4 100644 (file)
@@ -60,32 +60,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 turn_on();
+  void turnOn();
   /** Turns that host off. All actors are forcefully stopped. */
-  void turn_off();
+  void turnOff();
   /** Returns if that host is currently up and running */
-  bool is_on();
-  bool is_off() { return !is_on(); }
+  bool isOn();
+  bool isOff() { return !isOn(); }
 
   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;
+  double currentPowerPeak();
+  double powerPeakAt(int pstate_index);
+  int pstatesCount() const;
+  void setPstate(int pstate_index);
   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();
+  void parameters(vm_params_t params);
+  void setParameters(vm_params_t params);
+  xbt_dict_t mountedStoragesAsDict(); // HACK
+  xbt_dynar_t attachedStorages();
 
   /** 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).
    */
-  boost::unordered_map<std::string, Storage*> const &mounted_storages();
+  boost::unordered_map<std::string, Storage*> const &mountedStorages();
 
 private:
   simgrid::xbt::string name_ = "noname";
index a2311c7..98e968f 100644 (file)
@@ -31,7 +31,7 @@ public:
   ~Mailbox();
   
 protected:
-  smx_rdv_t getInferior() { return p_inferior; }
+  smx_rdv_t getInferior() { return inferior_; }
 
 public:
   /** Get the name of that mailbox */
@@ -40,8 +40,8 @@ public:
   static Mailbox *byName(const char *name);
 
 private:
-  std::string p_name;
-  smx_rdv_t p_inferior;
+  std::string name_;
+  smx_rdv_t inferior_;
   static boost::unordered_map<std::string, Mailbox *> *mailboxes;
 };
 }} // namespace simgrid::s4u
index 193a6d2..4b4d98a 100644 (file)
@@ -23,8 +23,8 @@ public:
   /** Retrieve a Storage by its name. It must exist in the platform file */
   static Storage &byName(const char* name);
   const char *name();
-  sg_size_t size_free();
-  sg_size_t size_used();
+  sg_size_t sizeFree();
+  sg_size_t sizeUsed();
   /** Retrieve the total amount of space of this storage element */
   sg_size_t size();
 
@@ -40,16 +40,16 @@ XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
 protected:
   smx_storage_t inferior();
 private:
-  static boost::unordered_map<std::string, Storage *> *storages;
-  std::string p_name;
-  smx_storage_t p_inferior;
+  static boost::unordered_map<std::string, Storage *> *storages_;
+  std::string name_;
+  smx_storage_t inferior_;
 
 
 public:
-  void set_userdata(void *data) {p_userdata = data;}
-  void *userdata() {return p_userdata;}
+  void setUserdata(void *data) {userdata_ = data;}
+  void *userdata() {return userdata_;}
 private:
-  void *p_userdata = NULL;
+  void *userdata_ = NULL;
 
 };
 
index 15a78c1..dde553a 100644 (file)
@@ -100,7 +100,7 @@ msg_host_t MSG_host_self(void)
  */
 void MSG_host_on(msg_host_t host)
 {
-  host->turn_on();
+  host->turnOn();
 }
 
 /** \ingroup m_host_management
@@ -111,7 +111,7 @@ void MSG_host_on(msg_host_t host)
  */
 void MSG_host_off(msg_host_t host)
 {
-  host->turn_off();
+  host->turnOff();
 }
 
 /*
@@ -252,7 +252,7 @@ int MSG_host_is_off(msg_host_t host)
  */
 void MSG_host_set_params(msg_host_t host, vm_params_t params)
 {
-  host->set_parameters(params);
+  host->setParameters(params);
 }
 
 /** \ingroup m_host_management
@@ -263,7 +263,7 @@ void MSG_host_set_params(msg_host_t host, vm_params_t params)
  */
 void MSG_host_get_params(msg_host_t host, vm_params_t params)
 {
-  host->get_parameters(params);
+  host->parameters(params);
 }
 
 /** \ingroup m_host_management
@@ -275,7 +275,7 @@ void MSG_host_get_params(msg_host_t host, vm_params_t params)
  */
 double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
     xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-    return host->power_peak_at(pstate_index);
+    return host->powerPeakAt(pstate_index);
 }
 
 /** \ingroup m_host_management
@@ -286,7 +286,7 @@ double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
  */
 double MSG_host_get_current_power_peak(msg_host_t host) {
     xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-    return host->current_power_peak();
+    return host->currentPowerPeak();
 }
 
 /** \ingroup m_host_management
@@ -306,7 +306,7 @@ int MSG_host_get_nb_pstates(msg_host_t host) {
 xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
-  return host->mounted_storages_as_dict();
+  return host->mountedStoragesAsDict();
 }
 
 /** \ingroup m_host_management
@@ -317,7 +317,7 @@ xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host)
 xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
-  return host->attached_storages();
+  return host->attachedStorages();
 }
 
 /** \ingroup m_host_management
@@ -334,7 +334,7 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
   char* mount_name;
   xbt_dict_cursor_t cursor = NULL;
 
-  xbt_dict_t storage_list = host->mounted_storages_as_dict();
+  xbt_dict_t storage_list = host->mountedStoragesAsDict();
 
   xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
     storage = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib,storage_name);
index 227031e..8fd8713 100644 (file)
@@ -343,7 +343,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
   msg_host_t host_dest;
   size_t longest_prefix_length = 0;
 
-  xbt_dict_t storage_list = host->mounted_storages_as_dict();
+  xbt_dict_t storage_list = host->mountedStoragesAsDict();
   xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
     file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1));
     strncpy(file_mount_name,fullpath,strlen(mount_name)+1);
index 4b360b7..1d0c78e 100644 (file)
@@ -196,7 +196,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char *name,
   params.mig_speed = (double)mig_netspeed * 1024 * 1024; // mig_speed
 
   //XBT_INFO("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f",params.dp_rate, params.mig_speed, dp_intensity, update_speed, host_speed);
-  vm->set_parameters(&params);
+  vm->setParameters(&params);
 
   return vm;
 }
@@ -359,7 +359,7 @@ static int migration_rx_fun(int argc, char *argv[])
   struct migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self());
 
   s_vm_params_t params;
-  ms->vm->get_parameters(&params);
+  ms->vm->parameters(&params);
 
   int need_exit = 0;
 
@@ -688,7 +688,7 @@ static int migration_tx_fun(int argc, char *argv[])
     (migration_session *) MSG_process_get_data(MSG_process_self());
 
   s_vm_params_t params;
-  ms->vm->get_parameters(&params);
+  ms->vm->parameters(&params);
   const sg_size_t ramsize   = params.ramsize;
   const sg_size_t devsize   = params.devsize;
   const int skip_stage1     = params.skip_stage1;
index 564ae9c..6cd9f12 100644 (file)
@@ -19,69 +19,69 @@ s4u::Comm::~Comm() {
 
 s4u::Comm &s4u::Comm::send_init(s4u::Actor *sender, s4u::Mailbox &chan) {
   s4u::Comm *res = new s4u::Comm();
-  res->p_sender = sender;
-  res->p_mailbox = &chan;
+  res->sender_ = sender;
+  res->mailbox_ = &chan;
 
   return *res;
 }
 s4u::Comm &s4u::Comm::recv_init(s4u::Actor *receiver, s4u::Mailbox &chan) {
   s4u::Comm *res = new s4u::Comm();
-  res->p_receiver = receiver;
-  res->p_mailbox = &chan;
+  res->receiver_ = receiver;
+  res->mailbox_ = &chan;
 
   return *res;
 }
 
 void s4u::Comm::setRate(double rate) {
   xbt_assert(p_state==inited);
-  p_rate = rate;
+  rate_ = rate;
 }
 
 void s4u::Comm::setSrcData(void * buff) {
   xbt_assert(p_state==inited);
-  xbt_assert(p_dstBuff == NULL, "Cannot set the src and dst buffers at the same time");
-  p_srcBuff = buff;
+  xbt_assert(dstBuff_ == NULL, "Cannot set the src and dst buffers at the same time");
+  srcBuff_ = buff;
 }
 void s4u::Comm::setSrcDataSize(size_t size){
   xbt_assert(p_state==inited);
-  p_srcBuffSize = size;
+  srcBuffSize_ = size;
 }
 void s4u::Comm::setSrcData(void * buff, size_t size) {
   xbt_assert(p_state==inited);
 
-  xbt_assert(p_dstBuff == NULL, "Cannot set the src and dst buffers at the same time");
-  p_srcBuff = buff;
-  p_srcBuffSize = size;
+  xbt_assert(dstBuff_ == NULL, "Cannot set the src and dst buffers at the same time");
+  srcBuff_ = buff;
+  srcBuffSize_ = size;
 }
 void s4u::Comm::setDstData(void ** buff) {
   xbt_assert(p_state==inited);
-  xbt_assert(p_srcBuff == NULL, "Cannot set the src and dst buffers at the same time");
-  p_dstBuff = buff;
+  xbt_assert(srcBuff_ == NULL, "Cannot set the src and dst buffers at the same time");
+  dstBuff_ = buff;
 }
 size_t s4u::Comm::getDstDataSize(){
   xbt_assert(p_state==finished);
-  return p_dstBuffSize;
+  return dstBuffSize_;
 }
 void s4u::Comm::setDstData(void ** buff, size_t size) {
   xbt_assert(p_state==inited);
 
-  xbt_assert(p_srcBuff == NULL, "Cannot set the src and dst buffers at the same time");
-  p_dstBuff = buff;
-  p_dstBuffSize = size;
+  xbt_assert(srcBuff_ == NULL, "Cannot set the src and dst buffers at the same time");
+  dstBuff_ = buff;
+  dstBuffSize_ = size;
 }
 
 void s4u::Comm::start() {
   xbt_assert(p_state == inited);
 
-  if (p_srcBuff != NULL) { // Sender side
-    p_inferior = simcall_comm_isend(p_sender->getInferior(), p_mailbox->getInferior(), p_remains, p_rate,
-        p_srcBuff, p_srcBuffSize,
-        p_matchFunction, p_cleanFunction, p_copyDataFunction,
-        p_userData, p_detached);
-  } else if (p_dstBuff != NULL) { // Receiver side
-    p_inferior = simcall_comm_irecv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
-        p_matchFunction, p_copyDataFunction,
-        p_userData, p_rate);
+  if (srcBuff_ != NULL) { // Sender side
+    p_inferior = simcall_comm_isend(sender_->getInferior(), mailbox_->getInferior(), p_remains, rate_,
+        srcBuff_, srcBuffSize_,
+        matchFunction_, cleanFunction_, copyDataFunction_,
+        p_userData, detached_);
+  } else if (dstBuff_ != NULL) { // Receiver side
+    p_inferior = simcall_comm_irecv(receiver_->getInferior(), mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
+        matchFunction_, copyDataFunction_,
+        p_userData, rate_);
 
   } else {
     xbt_die("Cannot start a communication before specifying whether we are the sender or the receiver");
@@ -94,15 +94,15 @@ void s4u::Comm::wait() {
   if (p_state == started)
     simcall_comm_wait(p_inferior, -1/*timeout*/);
   else {// p_state == inited. Save a simcall and do directly a blocking send/recv
-    if (p_srcBuff != NULL) {
-      simcall_comm_send(p_sender->getInferior(), p_mailbox->getInferior(), p_remains, p_rate,
-          p_srcBuff, p_srcBuffSize,
-          p_matchFunction, p_copyDataFunction,
+    if (srcBuff_ != NULL) {
+      simcall_comm_send(sender_->getInferior(), mailbox_->getInferior(), p_remains, rate_,
+          srcBuff_, srcBuffSize_,
+          matchFunction_, copyDataFunction_,
           p_userData, -1 /*timeout*/);
     } else {
-      simcall_comm_recv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
-          p_matchFunction, p_copyDataFunction,
-          p_userData, -1/*timeout*/, p_rate);
+      simcall_comm_recv(receiver_->getInferior(), mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
+          matchFunction_, copyDataFunction_,
+          p_userData, -1/*timeout*/, rate_);
     }
   }
   p_state = finished;
@@ -117,15 +117,15 @@ void s4u::Comm::wait(double timeout) {
   }
 
   // It's not started yet. Do it in one simcall
-  if (p_srcBuff != NULL) {
-    simcall_comm_send(p_sender->getInferior(), p_mailbox->getInferior(), p_remains, p_rate,
-        p_srcBuff, p_srcBuffSize,
-        p_matchFunction, p_copyDataFunction,
+  if (srcBuff_ != NULL) {
+    simcall_comm_send(sender_->getInferior(), mailbox_->getInferior(), p_remains, rate_,
+        srcBuff_, srcBuffSize_,
+        matchFunction_, copyDataFunction_,
         p_userData, timeout);
   } else { // Receiver
-    simcall_comm_recv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
-        p_matchFunction, p_copyDataFunction,
-        p_userData, timeout, p_rate);
+    simcall_comm_recv(receiver_->getInferior(), mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
+        matchFunction_, copyDataFunction_,
+        p_userData, timeout, rate_);
   }
   p_state = finished;
 }
@@ -134,8 +134,8 @@ s4u::Comm &s4u::Comm::send_async(s4u::Actor *sender, Mailbox &dest, void *data,
   s4u::Comm &res = s4u::Comm::send_init(sender, dest);
 
   res.setRemains(simulatedSize);
-  res.p_srcBuff = data;
-  res.p_srcBuffSize = sizeof(void*);
+  res.srcBuff_ = data;
+  res.srcBuffSize_ = sizeof(void*);
 
   res.start();
   return res;
index 3e2e284..ca3415a 100644 (file)
@@ -24,10 +24,10 @@ void s4u::Engine::loadPlatform(const char *platf) {
   SIMIX_create_environment(platf);
 }
 
-void s4u::Engine::register_function(const char*name, int (*code)(int,char**)) {
+void s4u::Engine::registerFunction(const char*name, int (*code)(int,char**)) {
   SIMIX_function_register(name,code);
 }
-void s4u::Engine::register_default(int (*code)(int,char**)) {
+void s4u::Engine::registerDefault(int (*code)(int,char**)) {
   SIMIX_function_register_default(code);
 }
 void s4u::Engine::loadDeployment(const char *deploy) {
index 23a6360..5da4b49 100644 (file)
@@ -23,36 +23,36 @@ namespace s4u {
 
 File::File(const char*fullpath, void *userdata) {
   // this cannot fail because we get a xbt_die if the mountpoint does not exist
-  p_inferior = simcall_file_open(fullpath, Host::current());
-  p_path = fullpath;
+  inferior_ = simcall_file_open(fullpath, Host::current());
+  path_ = fullpath;
 }
 
 File::~File() {
-  simcall_file_close(p_inferior, Host::current());
+  simcall_file_close(inferior_, Host::current());
 }
 
 sg_size_t File::read(sg_size_t size) {
-  return simcall_file_read(p_inferior, size, Host::current());
+  return simcall_file_read(inferior_, size, Host::current());
 }
 sg_size_t File::write(sg_size_t size) {
-  return simcall_file_write(p_inferior,size, Host::current());
+  return simcall_file_write(inferior_,size, Host::current());
 }
 sg_size_t File::size() {
-  return simcall_file_get_size(p_inferior);
+  return simcall_file_get_size(inferior_);
 }
 
 void File::seek(sg_size_t pos) {
-  simcall_file_seek(p_inferior,pos,SEEK_SET);
+  simcall_file_seek(inferior_,pos,SEEK_SET);
 }
 sg_size_t File::tell() {
-  return simcall_file_tell(p_inferior);
+  return simcall_file_tell(inferior_);
 }
 void File::move(const char*fullpath) {
-  simcall_file_move(p_inferior,fullpath);
+  simcall_file_move(inferior_,fullpath);
 }
 void File::unlink() {
   sg_host_t attached = Host::current(); // FIXME: we should check where this file is attached
-  simcall_file_unlink(p_inferior,attached);
+  simcall_file_unlink(inferior_,attached);
 }
 
 }} // namespace simgrid::s4u
index 7aaf021..6dc1000 100644 (file)
@@ -78,27 +78,27 @@ Host *Host::current(){
   return SIMIX_process_get_host(smx_proc);
 }
 
-void Host::turn_on() {
+void Host::turnOn() {
   simgrid::simix::kernel(std::bind(SIMIX_host_on, this));
 }
 
-void Host::turn_off() {
+void Host::turnOff() {
   simgrid::simix::kernel(std::bind(SIMIX_host_off, this, SIMIX_process_self()));
 }
 
-bool Host::is_on() {
+bool Host::isOn() {
   return this->pimpl_cpu->isOn();
 }
 
-int Host::pstates_count() const {
+int Host::pstatesCount() const {
   return this->pimpl_cpu->getNbPStates();
 }
 
-boost::unordered_map<std::string, Storage*> const& Host::mounted_storages() {
+boost::unordered_map<std::string, Storage*> const& Host::mountedStorages() {
   if (mounts == NULL) {
     mounts = new boost::unordered_map<std::string, Storage*> ();
 
-    xbt_dict_t dict = this->mounted_storages_as_dict();
+    xbt_dict_t dict = this->mountedStoragesAsDict();
 
     xbt_dict_cursor_t cursor;
     char *mountname;
@@ -129,7 +129,7 @@ xbt_swag_t Host::processes()
 }
 
 /** Get the peak power of a host */
-double Host::current_power_peak()
+double Host::currentPowerPeak()
 {
   return simgrid::simix::kernel([&] {
     return this->pimpl_cpu->getCurrentPowerPeak();
@@ -137,7 +137,7 @@ double Host::current_power_peak()
 }
 
 /** Get one power peak (in flops/s) of a host at a given pstate */
-double Host::power_peak_at(int pstate_index)
+double Host::powerPeakAt(int pstate_index)
 {
   return simgrid::simix::kernel([&] {
     return this->pimpl_cpu->getPowerPeakAt(pstate_index);
@@ -154,7 +154,7 @@ int Host::core_count() {
 }
 
 /** @brief Set the pstate at which the host should run */
-void Host::set_pstate(int pstate_index)
+void Host::setPstate(int pstate_index)
 {
   simgrid::simix::kernel(std::bind(
       &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index
@@ -166,14 +166,14 @@ int Host::pstate()
   return pimpl_cpu->getPState();
 }
 
-void Host::get_parameters(vm_params_t params)
+void Host::parameters(vm_params_t params)
 {
   simgrid::simix::kernel([&]() {
     this->extension<simgrid::surf::Host>()->getParams(params);
   });
 }
 
-void Host::set_parameters(vm_params_t params)
+void Host::setParameters(vm_params_t params)
 {
   simgrid::simix::kernel([&]() {
     this->extension<simgrid::surf::Host>()->setParams(params);
@@ -185,7 +185,7 @@ void Host::set_parameters(vm_params_t params)
  * \brief Returns the list of storages mounted on an host.
  * \return a dict containing all storages mounted on the host
  */
-xbt_dict_t Host::mounted_storages_as_dict()
+xbt_dict_t Host::mountedStoragesAsDict()
 {
   return simgrid::simix::kernel([&] {
     return this->extension<simgrid::surf::Host>()->getMountedStorageList();
@@ -197,7 +197,7 @@ xbt_dict_t Host::mounted_storages_as_dict()
  * \brief Returns the list of storages attached to an host.
  * \return a dict containing all storages attached to the host
  */
-xbt_dynar_t Host::attached_storages()
+xbt_dynar_t Host::attachedStorages()
 {
   return simgrid::simix::kernel([&] {
     return this->extension<simgrid::surf::Host>()->getAttachedStorageList();
index 587a72a..c5be189 100644 (file)
@@ -20,12 +20,12 @@ boost::unordered_map <std::string, s4u::Mailbox *> *s4u::Mailbox::mailboxes = ne
 
 
 s4u::Mailbox::Mailbox(const char*name, smx_rdv_t inferior) {
-  p_inferior = inferior;
-  p_name = name;
+  inferior_ = inferior;
+  name_ = name;
   mailboxes->insert({name, this});
 }
 const char *s4u::Mailbox::getName() {
-  return p_name.c_str();
+  return name_.c_str();
 }
 s4u::Mailbox *s4u::Mailbox::byName(const char*name) {
   s4u::Mailbox *res;
index 3b0841b..6b99ef8 100644 (file)
@@ -12,12 +12,12 @@ extern xbt_lib_t storage_lib;
 namespace simgrid {
 namespace s4u {
 
-boost::unordered_map <std::string, Storage *> *Storage::storages = new boost::unordered_map<std::string, Storage*> ();
+boost::unordered_map <std::string, Storage *> *Storage::storages_ = new boost::unordered_map<std::string, Storage*> ();
 Storage::Storage(std::string name, smx_storage_t inferior) {
-  p_name = name;
-  p_inferior = inferior;
+  name_ = name;
+  inferior_ = inferior;
 
-  storages->insert({name, this});
+  storages_->insert({name, this});
 }
 
 Storage::~Storage() {
@@ -25,12 +25,12 @@ Storage::~Storage() {
 }
 
 smx_storage_t Storage::inferior() {
-  return p_inferior;
+  return inferior_;
 }
 Storage &Storage::byName(const char*name) {
   s4u::Storage *res = NULL;
   try {
-    res = storages->at(name);
+    res = storages_->at(name);
   } catch (std::out_of_range& e) {
     smx_storage_t inferior = xbt_lib_get_elm_or_null(storage_lib,name);
     if (inferior == NULL)
@@ -42,17 +42,17 @@ Storage &Storage::byName(const char*name) {
 }
 
 const char*Storage::name() {
-  return p_name.c_str();
+  return name_.c_str();
 }
 
-sg_size_t Storage::size_free() {
-  return simcall_storage_get_free_size(p_inferior);
+sg_size_t Storage::sizeFree() {
+  return simcall_storage_get_free_size(inferior_);
 }
-sg_size_t Storage::size_used() {
-  return simcall_storage_get_used_size(p_inferior);
+sg_size_t Storage::sizeUsed() {
+  return simcall_storage_get_used_size(inferior_);
 }
 sg_size_t Storage::size() {
-  return SIMIX_storage_get_size(p_inferior);
+  return SIMIX_storage_get_size(inferior_);
 }
 
 } /* namespace s4u */
index cbe140a..9b7c46c 100644 (file)
@@ -157,7 +157,7 @@ int sg_host_core_count(sg_host_t host) {
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 int sg_host_is_on(sg_host_t host) {
-  return host->is_on();
+  return host->isOn();
 }
 
 /** @brief Returns the number of power states for a host.
@@ -165,7 +165,7 @@ int sg_host_is_on(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 int sg_host_get_nb_pstates(sg_host_t host) {
-  return host->pstates_count();
+  return host->pstatesCount();
 }
 
 /** @brief Gets the pstate at which that host currently runs.
@@ -180,7 +180,7 @@ int sg_host_get_pstate(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 void sg_host_set_pstate(sg_host_t host,int pstate) {
-  host->set_pstate(pstate);
+  host->setPstate(pstate);
 }
 
 /** @brief Get the properties of an host */
index e65659a..c8bb311 100644 (file)
@@ -54,40 +54,40 @@ xbt_swag_t simcall_host_get_process_list(sg_host_t host)
  * \deprecated */
 double simcall_host_get_current_power_peak(sg_host_t host)
 {
-  return host->current_power_peak();
+  return host->currentPowerPeak();
 }
 
 /** \ingroup simix_host_management
  * \deprecated */
 double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index)
 {
-  return host->power_peak_at(pstate_index);
+  return host->powerPeakAt(pstate_index);
 }
 
 /** \deprecated */
 void simcall_host_get_params(sg_host_t vm, vm_params_t params)
 {
-  vm->get_parameters(params);
+  vm->parameters(params);
 }
 
 /** \deprecated */
 void simcall_host_set_params(sg_host_t vm, vm_params_t params)
 {
-  vm->set_parameters(params);
+  vm->setParameters(params);
 }
 
 /** \ingroup simix_storage_management
  *  \deprecated */
 xbt_dict_t simcall_host_get_mounted_storage_list(sg_host_t host)
 {
-  return host->mounted_storages_as_dict();
+  return host->mountedStoragesAsDict();
 }
 
 /** \ingroup simix_storage_management
  *  \deprecated */
 xbt_dynar_t simcall_host_get_attached_storage_list(sg_host_t host)
 {
-  return host->attached_storages();
+  return host->attachedStorages();
 }
 
 // ***** Other simcalls
index 9b81242..dae6231 100644 (file)
@@ -45,7 +45,7 @@ void SIMIX_host_on(sg_host_t h)
 
   xbt_assert((host != NULL), "Invalid parameters");
 
-  if (h->is_off()) {
+  if (h->isOff()) {
     simgrid::surf::Host* surf_host = h->extension<simgrid::surf::Host>();
     surf_host->turnOn();
 
@@ -94,7 +94,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer)
 
   xbt_assert((host != NULL), "Invalid parameters");
 
-  if (h->is_on()) {
+  if (h->isOn()) {
     simgrid::surf::Host* surf_host = h->extension<simgrid::surf::Host>();
     surf_host->turnOff();
 
@@ -467,7 +467,7 @@ void SIMIX_execution_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
     /* check if the host is down */
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
     }
 
@@ -485,7 +485,7 @@ void SIMIX_post_host_execute(smx_synchro_t synchro)
 {
   if (synchro->type == SIMIX_SYNC_EXECUTE && /* FIMXE: handle resource failure
                                                * for parallel tasks too */
-      synchro->execution.host->is_off()) {
+      synchro->execution.host->isOff()) {
     /* If the host running the synchro failed, notice it so that the asking
      * process can be killed if it runs on that host itself */
     synchro->state = SIMIX_FAILED;
index dd2bb72..046ff2f 100644 (file)
@@ -62,7 +62,7 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -94,7 +94,7 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -126,7 +126,7 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -158,7 +158,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -182,7 +182,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
 int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
 {
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -376,7 +376,7 @@ void SIMIX_io_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
 
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
     }
 
index 83c7107..0832f20 100644 (file)
@@ -793,7 +793,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 
     /* Check out for errors */
 
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
       SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
     } else
@@ -871,7 +871,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
       }
     }
 
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
     }
 
index 46007fb..f61113a 100644 (file)
@@ -189,7 +189,7 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* execute the on_exit functions */
   SIMIX_process_on_exit_runall(arg);
   /* Add the process to the list of process to restart, only if the host is down */
-  if (arg->auto_restart && arg->host->is_off()) {
+  if (arg->auto_restart && arg->host->isOff()) {
     SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
                                         sg_host_get_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
@@ -268,7 +268,7 @@ smx_process_t SIMIX_process_create(
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
-  if (host->is_off()) {
+  if (host->isOff()) {
     int i;
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
           hostname);
@@ -362,7 +362,7 @@ smx_process_t SIMIX_process_attach(
   sg_host_t host = sg_host_by_name(hostname);
   XBT_DEBUG("Attach process %s on host '%s'", name, hostname);
 
-  if (host->is_off()) {
+  if (host->isOff()) {
     XBT_WARN("Cannot launch process '%s' on failed host '%s'",
       name, hostname);
     return nullptr;
@@ -898,7 +898,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration)
   sg_host_t host = process->host;
 
   /* check if the host is active */
-  if (host->is_off()) {
+  if (host->isOff()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -940,7 +940,7 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro)
         THROW_IMPOSSIBLE;
         break;
     }
-    if (simcall->issuer->host->is_off()) {
+    if (simcall->issuer->host->isOff()) {
       simcall->issuer->context->iwannadie = 1;
     }
     simcall_process_sleep__set__result(simcall, state);
index 02ffe37..ae488a5 100644 (file)
@@ -83,7 +83,7 @@ void HostEnergy::update()
   double previous_energy = this->total_energy;
 
   double instantaneous_consumption;
-  if (host->is_off())
+  if (host->isOff())
     instantaneous_consumption = this->watts_off;
   else
     instantaneous_consumption = this->getCurrentWattsValue(cpu_load);