TODO: integrate the properties into that ancestor
* Rename model methods:
action_free -> action_unref
- action_use -> action_ref
action_change_state -> action_state_set
action_get_state -> action_state_get
+ * Change model methods into classical functions:
+ action_use -> surf_action_ref
XBT:
* Add xbt_set_get_by_name_or_null() [Silas De Munck]
*
* \see e_surf_action_state_t
*/
- typedef struct surf_action *surf_action_t;
+typedef struct surf_action *surf_action_t;
+/** @Brief Specify that we use that action */
+XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
+
/** \brief Model datatype
* \ingroup SURF_models
double (*action_get_start_time) (surf_action_t action);/**< Return the start time of an action */
double (*action_get_finish_time) (surf_action_t action);/**< Return the finish time of an action */
- void (*action_ref) (surf_action_t action);/**< Specify that we use that action */
int (*action_unref) (surf_action_t action);/**< Specify that we don't use that action anymore */
void (*action_cancel) (surf_action_t action);/**< Cancel a running action */
void (*action_recycle) (surf_action_t action);/**< Recycle an action */
return 0;
}
-static void action_ref(surf_action_t action)
-{
- action->refcount++;
-}
-
static void action_cancel(surf_action_t action)
{
surf_action_state_set(action, SURF_ACTION_FAILED);
surf_cpu_model->name = "CPU";
surf_cpu_model->action_unref = action_unref;
- surf_cpu_model->action_ref = action_ref;
surf_cpu_model->action_cancel = action_cancel;
surf_cpu_model->action_state_set = cpu_action_state_set;
return 0;
}
-static void action_ref(surf_action_t action)
-{
- action->refcount++;
-}
-
static void action_cancel(surf_action_t action)
{
return;
surf_network_model->name = "network";
surf_network_model->action_unref = action_unref;
- surf_network_model->action_ref = action_ref;
surf_network_model->action_cancel = action_cancel;
surf_network_model->action_recycle = action_recycle;
return 0;
}
-static void action_ref(surf_action_t action)
-{
- action->refcount++;
-}
-
static void action_cancel(surf_action_t action)
{
return;
surf_network_model->name = "network constant";
surf_network_model->action_unref = action_unref;
- surf_network_model->action_ref = action_ref;
surf_network_model->action_cancel = action_cancel;
surf_network_model->action_recycle = action_recycle;
return 0;
}
-static void action_ref(surf_action_t action)
-{
- action->refcount++;
-}
-
static void action_cancel(surf_action_t action)
{
- xbt_assert0(0, "Cannot cancel GTNetS flow");
+ xbt_die("Cannot cancel GTNetS flow");
return;
}
static void action_recycle(surf_action_t action)
{
- xbt_assert0(0, "Cannot recycle GTNetS flow");
+ xbt_die("Cannot recycle GTNetS flow");
return;
}
surf_network_model = surf_model_init();
surf_network_model->name = "network GTNetS";
- surf_network_model->action_ref = action_ref;
surf_network_model->action_unref = action_unref;
surf_network_model->action_cancel = action_cancel;
surf_network_model->action_recycle = action_recycle;
{
action->data = data;
}
+
+void surf_action_ref(surf_action_t action)
+{
+ action->refcount++;
+}
THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
}
-static void parallel_action_use(surf_action_t action)
-{
- THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
-}
-
static int action_unref(surf_action_t action)
{
if (action->model_type == surf_network_model)
return 0;
}
-static void action_ref(surf_action_t action)
-{
- if (action->model_type == surf_network_model)
- surf_network_model->action_ref(action);
- else if (action->model_type == surf_cpu_model)
- surf_cpu_model->action_ref(action);
- else if (action->model_type == surf_workstation_model)
- parallel_action_use(action);
- else
- DIE_IMPOSSIBLE;
- return;
-}
-
static void action_cancel(surf_action_t action)
{
if (action->model_type == surf_network_model)
surf_workstation_model->name = "Workstation";
surf_workstation_model->action_unref = action_unref;
- surf_workstation_model->action_ref = action_ref;
surf_workstation_model->action_cancel = action_cancel;
surf_workstation_model->action_state_set = ws_action_state_set;
return ((cpu_L07_t) r)->properties;
}
-/* action_get_state is inherited from the surf module */
-
-static void action_ref(surf_action_t action)
-{
- action->refcount++;
- return;
-}
-
static int action_unref(surf_action_t action)
{
action->refcount--;
{
surf_workstation_model = surf_model_init();
- surf_workstation_model->action_ref = action_ref;
surf_workstation_model->action_unref = action_unref;
surf_workstation_model->action_cancel = action_cancel;
surf_workstation_model->action_state_set = surf_action_state_set;