Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implem? I meant Impl, as in pimpl. Sorry for the noise
[simgrid.git] / src / surf / HostImpl.cpp
similarity index 87%
rename from src/surf/HostImplem.cpp
rename to src/surf/HostImpl.cpp
index f549c9b..df99dc0 100644 (file)
@@ -4,12 +4,11 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "HostImplem.hpp"
-
 #include <simgrid/s4u/host.hpp>
 
 #include "src/simix/smx_private.h"
 #include "cpu_cas01.hpp"
+#include "src/surf/HostImpl.hpp"
 #include "simgrid/sg_config.h"
 
 #include "network_interface.hpp"
@@ -27,15 +26,15 @@ simgrid::surf::HostModel *surf_host_model = NULL;
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::Extension<simgrid::s4u::Host, HostImplem> HostImplem::EXTENSION_ID;
+simgrid::xbt::Extension<simgrid::s4u::Host, HostImpl> HostImpl::EXTENSION_ID;
 
 /*********
  * Model *
  *********/
-HostImplem *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
+HostImpl *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
   xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
 
-  HostImplem *host = new simgrid::surf::HostImplem(surf_host_model, name, props, storageList, cpu);
+  HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, props, storageList, cpu);
   XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
   return host;
 }
@@ -117,14 +116,14 @@ Action *HostModel::executeParallelTask(int host_nb,
  ************/
 
 
-void HostImplem::classInit()
+void HostImpl::classInit()
 {
   if (!EXTENSION_ID.valid()) {
-    EXTENSION_ID = simgrid::s4u::Host::extension_create<simgrid::surf::HostImplem>();
+    EXTENSION_ID = simgrid::s4u::Host::extension_create<simgrid::surf::HostImpl>();
   }
 }
 
-HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
                      xbt_dynar_t storage, Cpu *cpu)
  : Resource(model, name)
  , PropertyHolder(props)
@@ -133,7 +132,7 @@ HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_di
   p_params.ramsize = 0;
 }
 
-HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
                  xbt_dynar_t storage, Cpu *cpu)
  : Resource(model, name, constraint)
  , PropertyHolder(props)
@@ -143,11 +142,11 @@ HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_di
 }
 
 /** @brief use destroy() instead of this destructor */
-HostImplem::~HostImplem()
+HostImpl::~HostImpl()
 {
 }
 
-void HostImplem::attach(simgrid::s4u::Host* host)
+void HostImpl::attach(simgrid::s4u::Host* host)
 {
   if (p_host != nullptr)
     xbt_die("Already attached to host %s", host->name().c_str());
@@ -155,26 +154,26 @@ void HostImplem::attach(simgrid::s4u::Host* host)
   p_host = host;
 }
 
-bool HostImplem::isOn() {
+bool HostImpl::isOn() {
   return p_cpu->isOn();
 }
-bool HostImplem::isOff() {
+bool HostImpl::isOff() {
   return p_cpu->isOff();
 }
-void HostImplem::turnOn(){
+void HostImpl::turnOn(){
   if (isOff()) {
     p_cpu->turnOn();
     simgrid::s4u::Host::onStateChange(*this->p_host);
   }
 }
-void HostImplem::turnOff(){
+void HostImpl::turnOff(){
   if (isOn()) {
     p_cpu->turnOff();
     simgrid::s4u::Host::onStateChange(*this->p_host);
   }
 }
 
-simgrid::surf::Storage *HostImplem::findStorageOnMountList(const char* mount)
+simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
 {
   simgrid::surf::Storage *st = NULL;
   s_mount_t mnt;
@@ -193,7 +192,7 @@ simgrid::surf::Storage *HostImplem::findStorageOnMountList(const char* mount)
   return st;
 }
 
-xbt_dict_t HostImplem::getMountedStorageList()
+xbt_dict_t HostImpl::getMountedStorageList()
 {
   s_mount_t mnt;
   unsigned int i;
@@ -207,7 +206,7 @@ xbt_dict_t HostImplem::getMountedStorageList()
   return storage_list;
 }
 
-xbt_dynar_t HostImplem::getAttachedStorageList()
+xbt_dynar_t HostImpl::getAttachedStorageList()
 {
   xbt_lib_cursor_t cursor;
   char *key;
@@ -224,7 +223,7 @@ xbt_dynar_t HostImplem::getAttachedStorageList()
   return result;
 }
 
-Action *HostImplem::open(const char* fullpath) {
+Action *HostImpl::open(const char* fullpath) {
 
   simgrid::surf::Storage *st = NULL;
   s_mount_t mnt;
@@ -268,25 +267,25 @@ Action *HostImplem::open(const char* fullpath) {
   return action;
 }
 
-Action *HostImplem::close(surf_file_t fd) {
+Action *HostImpl::close(surf_file_t fd) {
   simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
   return st->close(fd);
 }
 
-Action *HostImplem::read(surf_file_t fd, sg_size_t size) {
+Action *HostImpl::read(surf_file_t fd, sg_size_t size) {
   simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
   return st->read(fd, size);
 }
 
-Action *HostImplem::write(surf_file_t fd, sg_size_t size) {
+Action *HostImpl::write(surf_file_t fd, sg_size_t size) {
   simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
   return st->write(fd, size);
 }
 
-int HostImplem::unlink(surf_file_t fd) {
+int HostImpl::unlink(surf_file_t fd) {
   if (!fd){
     XBT_WARN("No such file descriptor. Impossible to unlink");
     return -1;
@@ -313,11 +312,11 @@ int HostImplem::unlink(surf_file_t fd) {
   }
 }
 
-sg_size_t HostImplem::getSize(surf_file_t fd){
+sg_size_t HostImpl::getSize(surf_file_t fd){
   return fd->size;
 }
 
-xbt_dynar_t HostImplem::getInfo( surf_file_t fd)
+xbt_dynar_t HostImpl::getInfo( surf_file_t fd)
 {
   simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
   sg_size_t *psize = xbt_new(sg_size_t, 1);
@@ -332,11 +331,11 @@ xbt_dynar_t HostImplem::getInfo( surf_file_t fd)
   return info;
 }
 
-sg_size_t HostImplem::fileTell(surf_file_t fd){
+sg_size_t HostImpl::fileTell(surf_file_t fd){
   return fd->current_position;
 }
 
-int HostImplem::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
+int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
 
   switch (origin) {
   case SEEK_SET:
@@ -353,7 +352,7 @@ int HostImplem::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
   }
 }
 
-int HostImplem::fileMove(surf_file_t fd, const char* fullpath){
+int HostImpl::fileMove(surf_file_t fd, const char* fullpath){
   /* Check if the new full path is on the same mount point */
   if(!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
     sg_size_t *psize, *new_psize;
@@ -383,7 +382,7 @@ int HostImplem::fileMove(surf_file_t fd, const char* fullpath){
   }
 }
 
-xbt_dynar_t HostImplem::getVms()
+xbt_dynar_t HostImpl::getVms()
 {
   xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), NULL);
 
@@ -393,19 +392,19 @@ xbt_dynar_t HostImplem::getVms()
        iter !=  simgrid::surf::VMModel::ws_vms.end(); ++iter) {
 
     simgrid::surf::VirtualMachine *ws_vm = &*iter;
-    if (this == ws_vm->p_hostPM->extension(simgrid::surf::HostImplem::EXTENSION_ID))
+    if (this == ws_vm->p_hostPM->extension(simgrid::surf::HostImpl::EXTENSION_ID))
       xbt_dynar_push(dyn, &ws_vm);
   }
 
   return dyn;
 }
 
-void HostImplem::getParams(vm_params_t params)
+void HostImpl::getParams(vm_params_t params)
 {
   *params = p_params;
 }
 
-void HostImplem::setParams(vm_params_t params)
+void HostImpl::setParams(vm_params_t params)
 {
   /* may check something here. */
   p_params = *params;