Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use swags to handle task states and change structure s_SD_task_t.
[simgrid.git] / src / simdag / sd_workstation.c
index ed3b9fb..6f517d7 100644 (file)
@@ -7,7 +7,7 @@
 /* Creates a workstation and registers it in SD.
  */
 SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(surf_workstation != NULL, "surf_workstation is NULL !");
 
   SD_workstation_data_t sd_data = xbt_new0(s_SD_workstation_data_t, 1); /* workstation private data */
@@ -19,15 +19,15 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) {
   
   const char *name = SD_workstation_get_name(workstation);
   xbt_dict_set(sd_global->workstations, name, workstation, __SD_workstation_destroy); /* add the workstation to the dictionary */
+  sd_global->workstation_count++;
 
-  /* TODO: route */
   return workstation;
 }
 
 /* Returns a workstation given its name, or NULL if there is no such workstation.
  */
 SD_workstation_t SD_workstation_get_by_name(const char *name) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
 
   xbt_assert0(name != NULL, "Invalid parameter");
 
@@ -37,7 +37,7 @@ SD_workstation_t SD_workstation_get_by_name(const char *name) {
 /* Returns a NULL-terminated array of existing workstations.
  */
 SD_workstation_t*  SD_workstation_get_list(void) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
 
   SD_workstation_t* array = xbt_new0(SD_workstation_t, sd_global->workstation_count + 1);
   
@@ -57,14 +57,14 @@ SD_workstation_t*  SD_workstation_get_list(void) {
 /* Returns the number or workstations.
  */
 int SD_workstation_get_number(void) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   return sd_global->workstation_count;
 }
 
 /* Sets the data of a workstation. The new data can be NULL. The old data should have been freed first if it was not NULL.
  */
 void SD_workstation_set_data(SD_workstation_t workstation, void *data) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   workstation->data = data;
 }
@@ -72,7 +72,7 @@ void SD_workstation_set_data(SD_workstation_t workstation, void *data) {
 /* Returns the data of a workstation. The user data can be NULL.
  */
 void* SD_workstation_get_data(SD_workstation_t workstation) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return workstation->data;
 }
@@ -80,7 +80,7 @@ void* SD_workstation_get_data(SD_workstation_t workstation) {
 /* Returns the name of a workstation.
  */
 const char* SD_workstation_get_name(SD_workstation_t workstation) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return surf_workstation_resource->common_public->get_resource_name(workstation->sd_data->surf_workstation);
 }
@@ -88,7 +88,7 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) {
 /* Returns an new array of links representating the route between two workstations.
  */
 SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t dst) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
 
   void *surf_src = src->sd_data->surf_workstation;
   void *surf_dst = dst->sd_data->surf_workstation;
@@ -110,7 +110,7 @@ SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t
 /* Returns the number of links on the route between two workstations.
  */
 int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   return surf_workstation_resource->extension_public->
     get_route_size(src->sd_data->surf_workstation, dst->sd_data->surf_workstation);
 }
@@ -118,7 +118,7 @@ int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst) {
 /* Returns the total power of a workstation.
  */
 double SD_workstation_get_power(SD_workstation_t workstation) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return surf_workstation_resource->extension_public->get_speed(workstation->sd_data->surf_workstation, 1.0);
 }
@@ -126,7 +126,7 @@ double SD_workstation_get_power(SD_workstation_t workstation) {
 /* Returns the proportion of available power in a workstation (normally a number between 0 and 1).
  */
 double SD_workstation_get_available_power(SD_workstation_t workstation) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return surf_workstation_resource->extension_public->get_available_speed(workstation->sd_data->surf_workstation);
 }
@@ -134,14 +134,12 @@ double SD_workstation_get_available_power(SD_workstation_t workstation) {
 /* Destroys a workstation. The user data (if any) should have been destroyed first.
  */
 void __SD_workstation_destroy(void *workstation) {
-  CHECK_INIT_DONE();
+  SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
 
   if (((SD_workstation_t) workstation)->sd_data != NULL) {
     xbt_free(((SD_workstation_t) workstation)->sd_data);
   }
   
-  /* TODO: route */
-
   xbt_free(workstation);
 }