Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give Link a proper public interface
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 18 Jul 2015 16:13:30 +0000 (18:13 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 18 Jul 2015 18:07:03 +0000 (20:07 +0200)
buildtools/Cmake/DefinePackages.cmake
src/include/surf/surf.h
src/simdag/sd_link.c
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/surf_c_bindings.cpp

index 68c40d3..f238940 100644 (file)
@@ -687,6 +687,7 @@ set(headers_to_install
   include/simgrid/plugins.h
   include/simgrid/simix.h
   include/simgrid/host.h
+  include/simgrid/link.h
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/smpi/smpi_cocci.h
index edeb281..8d22b4b 100644 (file)
@@ -707,31 +707,6 @@ XBT_PUBLIC(int) surf_host_file_seek(surf_resource_t host,
                                            surf_file_t fd, sg_offset_t offset,
                                            int origin);
 
-/**
- * @brief [brief description]
- * @details [long description]
- *
- * @param link [description]
- * @return [description]
- */
-XBT_PUBLIC(int) surf_network_link_is_shared(surf_cpp_resource_t link);
-
-/**
- * @brief Get the bandwidth of a link in bytes per second
- *
- * @param link The surf link
- * @return The bandwidth in bytes per second
- */
-XBT_PUBLIC(double) surf_network_link_get_bandwidth(surf_cpp_resource_t link);
-
-/**
- * @brief Get the latency of a link in seconds
- *
- * @param link The surf link
- * @return The latency in seconds
- */
-XBT_PUBLIC(double) surf_network_link_get_latency(surf_cpp_resource_t link);
-
 /**
  * @brief Get the content of a storage
  *
index 7f5da90..cda30b4 100644 (file)
@@ -9,7 +9,7 @@
 #include "xbt/dict.h"
 #include "xbt/sysdep.h"
 #include "surf/surf.h"
-
+#include "simgrid/link.h"
 
 /* Creates a link and registers it in SD.
  */
index 542c958..ecd437e 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
                                 "Logging specific to the SURF network module");
 
+/*********
+ * C API *
+ *********/
+SG_BEGIN_DECL()
+int surf_network_link_is_shared(Link *link){
+  return link->isShared();
+}
+
+double surf_network_link_get_bandwidth(Link *link){
+  return link->getBandwidth();
+}
+
+double surf_network_link_get_latency(Link *link){
+  return link->getLatency();
+}
+SG_END_DECL()
+
 /*************
  * Callbacks *
  *************/
index ba829aa..159a650 100644 (file)
@@ -7,6 +7,8 @@
 #include "surf_interface.hpp"
 #include "surf_routing.hpp"
 
+#include "simgrid/link.h"
+
 #ifndef SURF_NETWORK_INTERFACE_HPP_
 #define SURF_NETWORK_INTERFACE_HPP_
 
@@ -16,9 +18,6 @@
 class NetworkModel;
 typedef NetworkModel *NetworkModelPtr;
 
-class Link;
-typedef Link *LinkPtr;
-
 class NetworkAction;
 typedef NetworkAction *NetworkActionPtr;
 
index 298cae7..02078c0 100644 (file)
@@ -489,18 +489,6 @@ void surf_vm_set_affinity(surf_resource_t vm, surf_resource_t cpu, unsigned long
   return get_casted_vm(vm)->setAffinity(sg_host_surfcpu(cpu), mask);
 }
 
-int surf_network_link_is_shared(surf_cpp_resource_t link){
-  return static_cast<LinkPtr>(link)->isShared();
-}
-
-double surf_network_link_get_bandwidth(surf_cpp_resource_t link){
-  return static_cast<LinkPtr>(link)->getBandwidth();
-}
-
-double surf_network_link_get_latency(surf_cpp_resource_t link){
-  return static_cast<LinkPtr>(link)->getLatency();
-}
-
 xbt_dict_t surf_storage_get_content(surf_resource_t resource){
   return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getContent();
 }