Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
not all resources need a property set, only Host, Link and Storage
[simgrid.git] / src / surf / network_interface.cpp
index 14bd060..a6b7937 100644 (file)
@@ -194,7 +194,8 @@ double NetworkModel::shareResourcesFull(double now)
  ************/
 
 Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props)
  ************/
 
 Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props)
-: Resource(model, name, props)
+: Resource(model, name),
+  p_properties(props)
 {
   links->insert({name, this});
 
 {
   links->insert({name, this});
 
@@ -205,7 +206,8 @@ Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t prop
                                 lmm_constraint_t constraint,
                             tmgr_history_t history,
                             tmgr_trace_t state_trace)
                                 lmm_constraint_t constraint,
                             tmgr_history_t history,
                             tmgr_trace_t state_trace)
-: Resource(model, name, props, constraint)
+: Resource(model, name, constraint),
+  p_properties(props)
 {
   if (state_trace)
     p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
 {
   if (state_trace)
     p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
@@ -218,6 +220,7 @@ Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t prop
 Link::~Link()
 {
   surf_callback_emit(networkLinkDestructedCallbacks, this);
 Link::~Link()
 {
   surf_callback_emit(networkLinkDestructedCallbacks, this);
+  xbt_dict_free(&p_properties);
 }
 
 bool Link::isUsed()
 }
 
 bool Link::isUsed()
@@ -246,6 +249,13 @@ void Link::setState(e_surf_resource_state_t state){
   surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
 }
 
   surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
 }
 
+xbt_dict_t Link::getProperties()
+{
+       if (p_properties==NULL)
+               p_properties = xbt_dict_new();
+       return p_properties;
+}
+
 /**********
  * Action *
  **********/
 /**********
  * Action *
  **********/