From: Gabriel Corona Date: Wed, 9 Dec 2015 13:10:35 +0000 (+0100) Subject: [surf] Move some code in a simgrid::surf namespace X-Git-Tag: v3_13~1469 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/638b21d2071c77f39da2f322156f05f75bf91517 [surf] Move some code in a simgrid::surf namespace --- diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index 2f6279c8e1..1875ce9329 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -8,25 +8,35 @@ #define SG_PLATF_TYPES_H #include -#include #ifdef __cplusplus +namespace simgrid { +namespace surf { + class Cpu; class RoutingEdge; +class As; -#else +} +} -typedef struct Cpu Cpu; -typedef struct RoutingEdge RoutingEdge; +typedef simgrid::surf::Cpu surf_Cpu; +typedef simgrid::surf::RoutingEdge surf_RoutingEdge; +typedef simgrid::surf::As surf_As; -#endif +#else -typedef Cpu *surf_cpu_t; -typedef RoutingEdge *routing_edge_t; -typedef RoutingEdge *sg_routing_edge_t; +typedef struct surf_Cpu surf_Cpu; +typedef struct surf_RoutingEdge surf_RoutingEdge; +typedef struct surf_As surf_As; +#endif +typedef surf_Cpu *surf_cpu_t; +typedef surf_RoutingEdge *routing_edge_t; +typedef surf_RoutingEdge *sg_routing_edge_t; +typedef surf_As *AS_t; // Types which are in fact dictelmt: diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 03040e825f..185d57f26f 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -11,7 +11,6 @@ #include #include -#include SG_BEGIN_DECL() @@ -22,12 +21,6 @@ static XBT_INLINE char *sg_host_get_name(sg_host_t host){ } XBT_PUBLIC(xbt_dynar_t) sg_hosts_as_dynar(void); -#ifdef __cplusplus -#define DEFINE_EXTERNAL_CLASS(klass) class klass; -class Cpu; -#else -#define DEFINE_EXTERNAL_CLASS(klass) typedef struct klass klass; -#endif // ========== User Data ============== XBT_PUBLIC(void*) sg_host_user(sg_host_t host); XBT_PUBLIC(void) sg_host_user_set(sg_host_t host, void* userdata); @@ -76,7 +69,6 @@ XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host); XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host); - SG_END_DECL() #endif /* SIMGRID_HOST_H_ */ diff --git a/include/simgrid/link.h b/include/simgrid/link.h index 644ab7dbf4..538d3783a9 100644 --- a/include/simgrid/link.h +++ b/include/simgrid/link.h @@ -11,7 +11,16 @@ #ifdef __cplusplus + +namespace simgrid { +namespace surf { + class Link; + +} +} +typedef simgrid::surf::Link Link; + #else typedef struct Link Link; #endif diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index bd4a8d894d..872ccb9378 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -9,6 +9,7 @@ #include "xbt.h" #include "xbt/lib.h" +#include "simgrid/forward.h" #include "simgrid/simix.h" #include "simgrid/platf.h" @@ -29,7 +30,7 @@ SG_BEGIN_DECL() typedef struct s_smx_rvpoint *msg_mailbox_t; /* ******************************** Environment ************************************ */ -typedef struct As *msg_as_t; +typedef surf_As *msg_as_t; /* ******************************** Host ************************************ */ diff --git a/src/bindings/java/org/simgrid/surf/Action.java b/src/bindings/java/org/simgrid/surf/Action.java index 6680aae400..4a5755f438 100644 --- a/src/bindings/java/org/simgrid/surf/Action.java +++ b/src/bindings/java/org/simgrid/surf/Action.java @@ -8,11 +8,6 @@ package org.simgrid.surf; -/** - * An action created by a Resource (e.g., a communication, an execution) - * @see Model - * @see Resource - */ public class Action { private long swigCPtr; protected boolean swigCMemOwn; @@ -40,110 +35,48 @@ public class Action { } } - protected static long[] cArrayUnwrap(Action[] arrayWrapper) { - long[] cArray = new long[arrayWrapper.length]; - for (int i=0; i - *
  • Model: It handle the interactions between resoucses and actions
  • - *
  • Resource: A resource used by the model (e.g., a cpu, a network link)
  • - *
  • Action: An action generated by the resources (e.g., execution, communication)
  • - * - * @see Resource - * @see Action - */ public class Model { private long swigCPtr; protected boolean swigCMemOwn; @@ -45,12 +35,6 @@ public class Model { } } - - /** - * Share the resources between the actions - * @param now the current time - * @return the date of the next action of the model will finish - */ public double shareResources(double now) { return SurfJNI.Model_shareResources(swigCPtr, this, now); } @@ -63,12 +47,6 @@ public class Model { return SurfJNI.Model_shareResourcesFull(swigCPtr, this, now); } - - /** - * Update time of actions and eventually their states - * @param now the new current time - * @param delta the delta between previous and new current time - */ public void updateActionsState(double now, double delta) { SurfJNI.Model_updateActionsState(swigCPtr, this, now, delta); } @@ -81,10 +59,6 @@ public class Model { SurfJNI.Model_updateActionsStateFull(swigCPtr, this, now, delta); } - - /** - * Get the List of running Actions - */ public ActionList getRunningActionSet() { long cPtr = SurfJNI.Model_getRunningActionSet(swigCPtr, this); return (cPtr == 0) ? null : new ActionList(cPtr, false); diff --git a/src/bindings/java/org/simgrid/surf/NetworkAction.java b/src/bindings/java/org/simgrid/surf/NetworkAction.java index d1df779b80..a307477305 100644 --- a/src/bindings/java/org/simgrid/surf/NetworkAction.java +++ b/src/bindings/java/org/simgrid/surf/NetworkAction.java @@ -8,10 +8,6 @@ package org.simgrid.surf; -/** - * An network action created by network model - * @see Link - */ public class NetworkAction extends Action { private long swigCPtr; @@ -39,10 +35,6 @@ public class NetworkAction extends Action { super.delete(); } - - /** - * @return The latency of the action - */ public double getLatency() { return SurfJNI.NetworkAction_getLatency(swigCPtr, this); } diff --git a/src/bindings/java/org/simgrid/surf/Resource.java b/src/bindings/java/org/simgrid/surf/Resource.java index 77e8bf9597..f21b7b50e7 100644 --- a/src/bindings/java/org/simgrid/surf/Resource.java +++ b/src/bindings/java/org/simgrid/surf/Resource.java @@ -8,11 +8,6 @@ package org.simgrid.surf; -/** - * A resource used by a model (e.g., a cpu, a network link) - * @see Model - * @see Action - */ public class Resource { private long swigCPtr; protected boolean swigCMemOwn; @@ -40,65 +35,33 @@ public class Resource { } } - - /** - * @return The name of the resource - */ public String getName() { return SurfJNI.Resource_getName(swigCPtr, this); } - - /** - * @return True if the Resource is used - */ public boolean isUsed() { return SurfJNI.Resource_isUsed(swigCPtr, this); } - - /** - * @return The model associated to this Resource - */ public Model getModel() { long cPtr = SurfJNI.Resource_getModel(swigCPtr, this); return (cPtr == 0) ? null : new Model(cPtr, false); } - - /** - * @return The state of the resource - * @see ResourceState - */ public ResourceState getState() { return ResourceState.swigToEnum(SurfJNI.Resource_getState(swigCPtr, this)); } - - /** - * @return The constraint associatied (if using LMM) - */ public LmmConstraint getConstraint() { long cPtr = SurfJNI.Resource_getConstraint(swigCPtr, this); return (cPtr == 0) ? null : new LmmConstraint(cPtr, false); } - - /** - * @return The XbtDict of properties associated to this Resource - */ public XbtDict getProperties() { long cPtr = SurfJNI.Resource_getProperties(swigCPtr, this); return (cPtr == 0) ? null : new XbtDict(cPtr, false); } - - /** - * Update the state of the Resource - * @param event_type - * @param value - * @param date - */ public void updateState(TmgrTraceEvent event_type, double value, double date) { SurfJNI.Resource_updateState(swigCPtr, this, TmgrTraceEvent.getCPtr(event_type), event_type, value, date); } diff --git a/src/bindings/java/org/simgrid/surf/Surf.java b/src/bindings/java/org/simgrid/surf/Surf.java index 3437a60807..e58ee89b4d 100644 --- a/src/bindings/java/org/simgrid/surf/Surf.java +++ b/src/bindings/java/org/simgrid/surf/Surf.java @@ -38,9 +38,9 @@ public class Surf { } public static CpuModel getCpuModel() { - long cPtr = SurfJNI.getCpuModel(); - return (CpuModel)Surf.getCpuModelDirector(cPtr); -} + long cPtr = SurfJNI.getCpuModel(); + return (cPtr == 0) ? null : new CpuModel(cPtr, false); + } public static void setCpuModel(CpuModel cpuModel) { SurfJNI.setCpuModel(CpuModel.getCPtr(cpuModel), cpuModel); diff --git a/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx b/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx index 1633eb0247..2bca0426b3 100644 --- a/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx +++ b/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx @@ -1050,12 +1050,12 @@ static jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize typedef struct lmm_constraint *lmm_constraint_t; typedef xbt_dynar_t DoubleDynar; -SWIGINTERN ActionArrayPtr ActionList_getArray(ActionList *self){ +SWIGINTERN ActionArrayPtr simgrid_surf_ActionList_getArray(simgrid::surf::ActionList *self){ return self; } SWIGINTERN unsigned int tmgr_trace_event_getIdx(tmgr_trace_event *self){return 0;} -SWIGINTERN Cpu *CpuAction_getCpu(CpuAction *self){return getActionCpu(self);} -SWIGINTERN double NetworkAction_getLatency(NetworkAction *self){return self->m_latency;} +SWIGINTERN simgrid::surf::Cpu *simgrid_surf_CpuAction_getCpu(simgrid::surf::CpuAction *self){return getActionCpu(self);} +SWIGINTERN double simgrid_surf_NetworkAction_getLatency(simgrid::surf::NetworkAction *self){return self->m_latency;} SWIGINTERN double lmm_constraint_getUsage(lmm_constraint *self){return lmm_constraint_get_usage(self);} SWIGINTERN double lmm_variable_getValue(lmm_variable *self){return lmm_variable_getvalue(self);} SWIGINTERN char *s_xbt_dict_getValue(s_xbt_dict *self,char *key){return (char*)xbt_dict_get_or_null(self, key);} @@ -1075,7 +1075,7 @@ SwigDirector_Plugin::~SwigDirector_Plugin() { } -void SwigDirector_Plugin::cpuCreatedCallback(Cpu *cpu) { +void SwigDirector_Plugin::cpuCreatedCallback(simgrid::surf::Cpu *cpu) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1087,7 +1087,7 @@ void SwigDirector_Plugin::cpuCreatedCallback(Cpu *cpu) { } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Cpu **)&jcpu) = (Cpu *) cpu; + *((simgrid::surf::Cpu **)&jcpu) = (simgrid::surf::Cpu *) cpu; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[0], swigjobj, jcpu); if (jenv->ExceptionCheck() == JNI_TRUE) return ; } else { @@ -1096,7 +1096,7 @@ void SwigDirector_Plugin::cpuCreatedCallback(Cpu *cpu) { if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::cpuDestructedCallback(Cpu *cpu) { +void SwigDirector_Plugin::cpuDestructedCallback(simgrid::surf::Cpu *cpu) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1108,7 +1108,7 @@ void SwigDirector_Plugin::cpuDestructedCallback(Cpu *cpu) { } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Cpu **)&jcpu) = (Cpu *) cpu; + *((simgrid::surf::Cpu **)&jcpu) = (simgrid::surf::Cpu *) cpu; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[1], swigjobj, jcpu); if (jenv->ExceptionCheck() == JNI_TRUE) return ; } else { @@ -1117,7 +1117,7 @@ void SwigDirector_Plugin::cpuDestructedCallback(Cpu *cpu) { if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) { +void SwigDirector_Plugin::cpuStateChangedCallback(simgrid::surf::Cpu *cpu, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1131,7 +1131,7 @@ void SwigDirector_Plugin::cpuStateChangedCallback(Cpu *cpu, e_surf_resource_stat } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Cpu **)&jcpu) = (Cpu *) cpu; + *((simgrid::surf::Cpu **)&jcpu) = (simgrid::surf::Cpu *) cpu; jarg1 = (jint) arg1; jarg2 = (jint) arg2; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[2], swigjobj, jcpu, jarg1, jarg2); @@ -1142,7 +1142,7 @@ void SwigDirector_Plugin::cpuStateChangedCallback(Cpu *cpu, e_surf_resource_stat if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t arg1, e_surf_action_state_t arg2) { +void SwigDirector_Plugin::cpuActionStateChangedCallback(simgrid::surf::CpuAction *action, e_surf_action_state_t arg1, e_surf_action_state_t arg2) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1156,7 +1156,7 @@ void SwigDirector_Plugin::cpuActionStateChangedCallback(CpuAction *action, e_sur } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((CpuAction **)&jaction) = (CpuAction *) action; + *((simgrid::surf::CpuAction **)&jaction) = (simgrid::surf::CpuAction *) action; jarg1 = (jint) arg1; jarg2 = (jint) arg2; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[3], swigjobj, jaction, jarg1, jarg2); @@ -1167,7 +1167,7 @@ void SwigDirector_Plugin::cpuActionStateChangedCallback(CpuAction *action, e_sur if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::networkLinkCreatedCallback(Link *link) { +void SwigDirector_Plugin::networkLinkCreatedCallback(simgrid::surf::Link *link) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1179,7 +1179,7 @@ void SwigDirector_Plugin::networkLinkCreatedCallback(Link *link) { } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Link **)&jlink) = (Link *) link; + *((simgrid::surf::Link **)&jlink) = (simgrid::surf::Link *) link; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[4], swigjobj, jlink); if (jenv->ExceptionCheck() == JNI_TRUE) return ; } else { @@ -1188,7 +1188,7 @@ void SwigDirector_Plugin::networkLinkCreatedCallback(Link *link) { if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::networkLinkDestructedCallback(Link *link) { +void SwigDirector_Plugin::networkLinkDestructedCallback(simgrid::surf::Link *link) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1200,7 +1200,7 @@ void SwigDirector_Plugin::networkLinkDestructedCallback(Link *link) { } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Link **)&jlink) = (Link *) link; + *((simgrid::surf::Link **)&jlink) = (simgrid::surf::Link *) link; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[5], swigjobj, jlink); if (jenv->ExceptionCheck() == JNI_TRUE) return ; } else { @@ -1209,7 +1209,7 @@ void SwigDirector_Plugin::networkLinkDestructedCallback(Link *link) { if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) { +void SwigDirector_Plugin::networkLinkStateChangedCallback(simgrid::surf::Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1223,7 +1223,7 @@ void SwigDirector_Plugin::networkLinkStateChangedCallback(Link *link, e_surf_res } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((Link **)&jlink) = (Link *) link; + *((simgrid::surf::Link **)&jlink) = (simgrid::surf::Link *) link; jarg1 = (jint) arg1; jarg2 = (jint) arg2; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[6], swigjobj, jlink, jarg1, jarg2); @@ -1234,7 +1234,7 @@ void SwigDirector_Plugin::networkLinkStateChangedCallback(Link *link, e_surf_res if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) { +void SwigDirector_Plugin::networkActionStateChangedCallback(simgrid::surf::NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1248,7 +1248,7 @@ void SwigDirector_Plugin::networkActionStateChangedCallback(NetworkAction *actio } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((NetworkAction **)&jaction) = (NetworkAction *) action; + *((simgrid::surf::NetworkAction **)&jaction) = (simgrid::surf::NetworkAction *) action; jold = (jint) old; jcur = (jint) cur; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[7], swigjobj, jaction, jold, jcur); @@ -1259,7 +1259,7 @@ void SwigDirector_Plugin::networkActionStateChangedCallback(NetworkAction *actio if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -void SwigDirector_Plugin::networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate) { +void SwigDirector_Plugin::networkCommunicateCallback(simgrid::surf::NetworkAction *action, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, double size, double rate) { JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; @@ -1275,9 +1275,9 @@ void SwigDirector_Plugin::networkCommunicateCallback(NetworkAction *action, Rout } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((NetworkAction **)&jaction) = (NetworkAction *) action; - *((RoutingEdge **)&jsrc) = (RoutingEdge *) src; - *((RoutingEdge **)&jdst) = (RoutingEdge *) dst; + *((simgrid::surf::NetworkAction **)&jaction) = (simgrid::surf::NetworkAction *) action; + *((simgrid::surf::RoutingEdge **)&jsrc) = (simgrid::surf::RoutingEdge *) src; + *((simgrid::surf::RoutingEdge **)&jdst) = (simgrid::surf::RoutingEdge *) dst; jsize = (jdouble) size; jrate = (jdouble) rate; jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[8], swigjobj, jaction, jsrc, jdst, jsize, jrate); @@ -1348,7 +1348,7 @@ void SwigDirector_Plugin::swig_connect_director(JNIEnv *jenv, jobject jself, jcl } -SwigDirector_CpuModel::SwigDirector_CpuModel(JNIEnv *jenv) : CpuModel(), Swig::Director(jenv) { +SwigDirector_CpuModel::SwigDirector_CpuModel(JNIEnv *jenv) : simgrid::surf::CpuModel(), Swig::Director(jenv) { } double SwigDirector_CpuModel::shareResources(double now) { @@ -1360,7 +1360,7 @@ double SwigDirector_CpuModel::shareResources(double now) { jdouble jnow ; if (!swig_override[0]) { - return Model::shareResources(now); + return simgrid::surf::Model::shareResources(now); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1384,7 +1384,7 @@ double SwigDirector_CpuModel::shareResourcesLazy(double now) { jdouble jnow ; if (!swig_override[1]) { - return Model::shareResourcesLazy(now); + return simgrid::surf::Model::shareResourcesLazy(now); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1408,7 +1408,7 @@ double SwigDirector_CpuModel::shareResourcesFull(double now) { jdouble jnow ; if (!swig_override[2]) { - return Model::shareResourcesFull(now); + return simgrid::surf::Model::shareResourcesFull(now); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1431,7 +1431,7 @@ void SwigDirector_CpuModel::updateActionsState(double now, double delta) { jdouble jdelta ; if (!swig_override[3]) { - Model::updateActionsState(now,delta); + simgrid::surf::Model::updateActionsState(now,delta); return; } swigjobj = swig_get_self(jenv); @@ -1454,7 +1454,7 @@ void SwigDirector_CpuModel::updateActionsStateLazy(double now, double delta) { jdouble jdelta ; if (!swig_override[4]) { - Model::updateActionsStateLazy(now,delta); + simgrid::surf::Model::updateActionsStateLazy(now,delta); return; } swigjobj = swig_get_self(jenv); @@ -1477,7 +1477,7 @@ void SwigDirector_CpuModel::updateActionsStateFull(double now, double delta) { jdouble jdelta ; if (!swig_override[5]) { - Model::updateActionsStateFull(now,delta); + simgrid::surf::Model::updateActionsStateFull(now,delta); return; } swigjobj = swig_get_self(jenv); @@ -1492,21 +1492,21 @@ void SwigDirector_CpuModel::updateActionsStateFull(double now, double delta) { if (swigjobj) jenv->DeleteLocalRef(swigjobj); } -ActionList *SwigDirector_CpuModel::getRunningActionSet() { - ActionList *c_result = 0 ; +simgrid::surf::ActionList *SwigDirector_CpuModel::getRunningActionSet() { + simgrid::surf::ActionList *c_result = 0 ; jlong jresult = 0 ; JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; jobject swigjobj = (jobject) NULL ; if (!swig_override[6]) { - return Model::getRunningActionSet(); + return simgrid::surf::Model::getRunningActionSet(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[15], swigjobj); if (jenv->ExceptionCheck() == JNI_TRUE) return c_result; - c_result = *(ActionList **)&jresult; + c_result = *(simgrid::surf::ActionList **)&jresult; } else { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object"); } @@ -1520,7 +1520,7 @@ void SwigDirector_CpuModel::addTraces() { jobject swigjobj = (jobject) NULL ; if (!swig_override[7]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method CpuModel::addTraces."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::CpuModel::addTraces."); return; } swigjobj = swig_get_self(jenv); @@ -1538,8 +1538,8 @@ SwigDirector_CpuModel::~SwigDirector_CpuModel() { } -Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties) { - Cpu *c_result = 0 ; +simgrid::surf::Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties) { + simgrid::surf::Cpu *c_result = 0 ; jlong jresult = 0 ; JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; @@ -1555,7 +1555,7 @@ Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, jlong jcpu_properties = 0 ; if (!swig_override[8]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method CpuModel::createCpu."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::CpuModel::createCpu."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1580,7 +1580,7 @@ Cpu *SwigDirector_CpuModel::createCpu(char const *name, DoubleDynar power_peak, *((s_xbt_dict **)&jcpu_properties) = (s_xbt_dict *) cpu_properties; jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[17], swigjobj, jname, jpower_peak, jpstate, jpower_scale, jpower_trace, jcore, jstate_initial, jstate_trace, jcpu_properties); if (jenv->ExceptionCheck() == JNI_TRUE) return c_result; - c_result = *(Cpu **)&jresult; + c_result = *(simgrid::surf::Cpu **)&jresult; } else { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object"); } @@ -1648,10 +1648,10 @@ void SwigDirector_CpuModel::swig_connect_director(JNIEnv *jenv, jobject jself, j } -SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale) : Cpu(model, name, props, constraint, core, powerPeak, powerScale), Swig::Director(jenv) { +SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, props, constraint, core, powerPeak, powerScale), Swig::Director(jenv) { } -SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale) : Cpu(model, name, props, core, powerPeak, powerScale), Swig::Director(jenv) { +SwigDirector_Cpu::SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale) : simgrid::surf::Cpu(model, name, props, core, powerPeak, powerScale), Swig::Director(jenv) { } bool SwigDirector_Cpu::isUsed() { @@ -1662,7 +1662,7 @@ bool SwigDirector_Cpu::isUsed() { jobject swigjobj = (jobject) NULL ; if (!swig_override[0]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::isUsed."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::isUsed."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1685,7 +1685,7 @@ e_surf_resource_state_t SwigDirector_Cpu::getState() { jobject swigjobj = (jobject) NULL ; if (!swig_override[1]) { - return Resource::getState(); + return simgrid::surf::Resource::getState(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1708,7 +1708,7 @@ void SwigDirector_Cpu::updateState(tmgr_trace_event *event_type, double value, d jdouble jdate ; if (!swig_override[2]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::updateState."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::updateState."); return; } swigjobj = swig_get_self(jenv); @@ -1737,7 +1737,7 @@ double SwigDirector_Cpu::getCurrentPowerPeak() { jobject swigjobj = (jobject) NULL ; if (!swig_override[3]) { - return Cpu::getCurrentPowerPeak(); + return simgrid::surf::Cpu::getCurrentPowerPeak(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1751,8 +1751,8 @@ double SwigDirector_Cpu::getCurrentPowerPeak() { return c_result; } -CpuAction *SwigDirector_Cpu::execute(double size) { - CpuAction *c_result = 0 ; +simgrid::surf::CpuAction *SwigDirector_Cpu::execute(double size) { + simgrid::surf::CpuAction *c_result = 0 ; jlong jresult = 0 ; JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; @@ -1760,7 +1760,7 @@ CpuAction *SwigDirector_Cpu::execute(double size) { jdouble jsize ; if (!swig_override[4]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::execute."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::execute."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1768,7 +1768,7 @@ CpuAction *SwigDirector_Cpu::execute(double size) { jsize = (jdouble) size; jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[22], swigjobj, jsize); if (jenv->ExceptionCheck() == JNI_TRUE) return c_result; - c_result = *(CpuAction **)&jresult; + c_result = *(simgrid::surf::CpuAction **)&jresult; } else { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object"); } @@ -1776,8 +1776,8 @@ CpuAction *SwigDirector_Cpu::execute(double size) { return c_result; } -CpuAction *SwigDirector_Cpu::sleep(double duration) { - CpuAction *c_result = 0 ; +simgrid::surf::CpuAction *SwigDirector_Cpu::sleep(double duration) { + simgrid::surf::CpuAction *c_result = 0 ; jlong jresult = 0 ; JNIEnvWrapper swigjnienv(this) ; JNIEnv * jenv = swigjnienv.getJNIEnv() ; @@ -1785,7 +1785,7 @@ CpuAction *SwigDirector_Cpu::sleep(double duration) { jdouble jduration ; if (!swig_override[5]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::sleep."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::sleep."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1793,7 +1793,7 @@ CpuAction *SwigDirector_Cpu::sleep(double duration) { jduration = (jdouble) duration; jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_SurfJNI, Swig::director_methids[23], swigjobj, jduration); if (jenv->ExceptionCheck() == JNI_TRUE) return c_result; - c_result = *(CpuAction **)&jresult; + c_result = *(simgrid::surf::CpuAction **)&jresult; } else { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object"); } @@ -1809,7 +1809,7 @@ int SwigDirector_Cpu::getCore() { jobject swigjobj = (jobject) NULL ; if (!swig_override[6]) { - return Cpu::getCore(); + return simgrid::surf::Cpu::getCore(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1832,7 +1832,7 @@ double SwigDirector_Cpu::getSpeed(double load) { jdouble jload ; if (!swig_override[7]) { - return Cpu::getSpeed(load); + return simgrid::surf::Cpu::getSpeed(load); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1855,7 +1855,7 @@ double SwigDirector_Cpu::getAvailableSpeed() { jobject swigjobj = (jobject) NULL ; if (!swig_override[8]) { - return Cpu::getAvailableSpeed(); + return simgrid::surf::Cpu::getAvailableSpeed(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -1878,7 +1878,7 @@ double SwigDirector_Cpu::getPowerPeakAt(int pstate_index) { jint jpstate_index ; if (!swig_override[9]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::getPowerPeakAt."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::getPowerPeakAt."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1902,7 +1902,7 @@ int SwigDirector_Cpu::getNbPstates() { jobject swigjobj = (jobject) NULL ; if (!swig_override[10]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::getNbPstates."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::getNbPstates."); return c_result; } swigjobj = swig_get_self(jenv); @@ -1924,7 +1924,7 @@ void SwigDirector_Cpu::setPstate(int pstate_index) { jint jpstate_index ; if (!swig_override[11]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::setPstate."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::setPstate."); return; } swigjobj = swig_get_self(jenv); @@ -1946,7 +1946,7 @@ int SwigDirector_Cpu::getPstate() { jobject swigjobj = (jobject) NULL ; if (!swig_override[12]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Cpu::getPstate."); + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method simgrid::surf::Cpu::getPstate."); return c_result; } swigjobj = swig_get_self(jenv); @@ -2033,7 +2033,7 @@ void SwigDirector_Cpu::swig_connect_director(JNIEnv *jenv, jobject jself, jclass } -SwigDirector_CpuAction::SwigDirector_CpuAction(JNIEnv *jenv, Model *model, double cost, bool failed) : CpuAction(model, cost, failed), Swig::Director(jenv) { +SwigDirector_CpuAction::SwigDirector_CpuAction(JNIEnv *jenv, simgrid::surf::Model *model, double cost, bool failed) : simgrid::surf::CpuAction(model, cost, failed), Swig::Director(jenv) { } SwigDirector_CpuAction::~SwigDirector_CpuAction() { @@ -2049,7 +2049,7 @@ double SwigDirector_CpuAction::getRemains() { jobject swigjobj = (jobject) NULL ; if (!swig_override[0]) { - return Action::getRemains(); + return simgrid::surf::Action::getRemains(); } swigjobj = swig_get_self(jenv); if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { @@ -2070,7 +2070,7 @@ void SwigDirector_CpuAction::setPriority(double priority) { jdouble jpriority ; if (!swig_override[1]) { - Action::setPriority(priority); + simgrid::surf::Action::setPriority(priority); return; } swigjobj = swig_get_self(jenv); @@ -2091,7 +2091,7 @@ void SwigDirector_CpuAction::setState(e_surf_action_state_t state) { jint jstate ; if (!swig_override[2]) { - Action::setState(state); + simgrid::surf::Action::setState(state); return; } swigjobj = swig_get_self(jenv); @@ -2158,11 +2158,13 @@ extern "C" { #endif JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_getAction(JNIEnv *env, jclass cls, jlong jarg1) { - Action * action = (Action *)jarg1; + simgrid::surf::Action * action = (simgrid::surf::Action *)jarg1; jobject res; - CpuAction *cpu_action = dynamic_cast(action); + simgrid::surf::CpuAction *cpu_action = + dynamic_cast(action); if (cpu_action) { - SwigDirector_CpuAction *dir_cpu_action = dynamic_cast(cpu_action); + SwigDirector_CpuAction *dir_cpu_action = + dynamic_cast(cpu_action); if (dir_cpu_action) { res = dir_cpu_action->swig_get_self(env);\ } else { @@ -2183,7 +2185,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_getAction(JNIEnv *env, j #define GETDIRECTOR(NAME) \ JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_get## NAME ## Director(JNIEnv *env, jclass cls, jlong jarg1)\ {\ - NAME * arg1 = (NAME*)jarg1;\ + simgrid::surf::NAME * arg1 = (simgrid::surf::NAME*)jarg1;\ SwigDirector_ ##NAME *director = dynamic_cast(arg1);\ jobject res;\ if (director) {\ @@ -2208,24 +2210,24 @@ GETDIRECTOR(CpuAction) SWIGEXPORT jlongArray JNICALL Java_org_simgrid_surf_SurfJNI_ActionList_1getArray(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlongArray jresult = 0 ; - ActionList *arg1 = (ActionList *) 0 ; + simgrid::surf::ActionList *arg1 = (simgrid::surf::ActionList *) 0 ; ActionArrayPtr result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(ActionList **)&jarg1; - result = (ActionArrayPtr)ActionList_getArray(arg1); + arg1 = *(simgrid::surf::ActionList **)&jarg1; + result = (ActionArrayPtr)simgrid_surf_ActionList_getArray(arg1); { long l = 0; - for(ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) { + for(simgrid::surf::ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) { l++; } jresult = jenv->NewLongArray(l); jlong *elts = jenv->GetLongArrayElements(jresult, NULL); l = 0; - for(ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) { - elts[l++] = (jlong)static_cast(&*it); + for(simgrid::surf::ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) { + elts[l++] = (jlong)static_cast(&*it); } jenv->ReleaseLongArrayElements(jresult, elts, 0); } @@ -2235,22 +2237,22 @@ SWIGEXPORT jlongArray JNICALL Java_org_simgrid_surf_SurfJNI_ActionList_1getArray SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1ActionList(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; - ActionList *result = 0 ; + simgrid::surf::ActionList *result = 0 ; (void)jenv; (void)jcls; - result = (ActionList *)new ActionList(); - *(ActionList **)&jresult = result; + result = (simgrid::surf::ActionList *)new simgrid::surf::ActionList(); + *(simgrid::surf::ActionList **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1ActionList(JNIEnv *jenv, jclass jcls, jlong jarg1) { - ActionList *arg1 = (ActionList *) 0 ; + simgrid::surf::ActionList *arg1 = (simgrid::surf::ActionList *) 0 ; (void)jenv; (void)jcls; - arg1 = *(ActionList **)&jarg1; + arg1 = *(simgrid::surf::ActionList **)&jarg1; delete arg1; } @@ -2276,30 +2278,30 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_clean(JNIEnv *jenv, jclass SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_getCpuModel(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; - CpuModel *result = 0 ; + simgrid::surf::CpuModel *result = 0 ; (void)jenv; (void)jcls; - result = (CpuModel *)getCpuModel(); - *(CpuModel **)&jresult = result; + result = (simgrid::surf::CpuModel *)getCpuModel(); + *(simgrid::surf::CpuModel **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_setCpuModel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - CpuModel *arg1 = (CpuModel *) 0 ; + simgrid::surf::CpuModel *arg1 = (simgrid::surf::CpuModel *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(CpuModel **)&jarg1; + arg1 = *(simgrid::surf::CpuModel **)&jarg1; setCpuModel(arg1); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_setCpu(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) { char *arg1 = (char *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; @@ -2309,7 +2311,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_setCpu(JNIEnv *jenv, jclas arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0); if (!arg1) return ; } - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; setCpu(arg1,arg2); { @@ -2377,28 +2379,28 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateCpuCreated SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuCreatedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; (arg1)->cpuCreatedCallback(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuCreatedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; (arg1)->Plugin::cpuCreatedCallback(arg2); } @@ -2416,28 +2418,28 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateCpuDestruc SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuDestructedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; (arg1)->cpuDestructedCallback(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuDestructedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; (arg1)->Plugin::cpuDestructedCallback(arg2); } @@ -2455,7 +2457,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateCpuStateCh SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; e_surf_resource_state_t arg3 ; e_surf_resource_state_t arg4 ; @@ -2464,7 +2466,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuStateChangedCal (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; arg3 = (e_surf_resource_state_t)jarg3; arg4 = (e_surf_resource_state_t)jarg4; (arg1)->cpuStateChangedCallback(arg2,arg3,arg4); @@ -2473,7 +2475,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuStateChangedCal SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuStateChangedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - Cpu *arg2 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg2 = (simgrid::surf::Cpu *) 0 ; e_surf_resource_state_t arg3 ; e_surf_resource_state_t arg4 ; @@ -2482,7 +2484,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuStateChangedCal (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Cpu **)&jarg2; + arg2 = *(simgrid::surf::Cpu **)&jarg2; arg3 = (e_surf_resource_state_t)jarg3; arg4 = (e_surf_resource_state_t)jarg4; (arg1)->Plugin::cpuStateChangedCallback(arg2,arg3,arg4); @@ -2502,7 +2504,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateCpuActionS SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - CpuAction *arg2 = (CpuAction *) 0 ; + simgrid::surf::CpuAction *arg2 = (simgrid::surf::CpuAction *) 0 ; e_surf_action_state_t arg3 ; e_surf_action_state_t arg4 ; @@ -2511,7 +2513,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChan (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(CpuAction **)&jarg2; + arg2 = *(simgrid::surf::CpuAction **)&jarg2; arg3 = (e_surf_action_state_t)jarg3; arg4 = (e_surf_action_state_t)jarg4; (arg1)->cpuActionStateChangedCallback(arg2,arg3,arg4); @@ -2520,7 +2522,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChan SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChangedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - CpuAction *arg2 = (CpuAction *) 0 ; + simgrid::surf::CpuAction *arg2 = (simgrid::surf::CpuAction *) 0 ; e_surf_action_state_t arg3 ; e_surf_action_state_t arg4 ; @@ -2529,7 +2531,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChan (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(CpuAction **)&jarg2; + arg2 = *(simgrid::surf::CpuAction **)&jarg2; arg3 = (e_surf_action_state_t)jarg3; arg4 = (e_surf_action_state_t)jarg4; (arg1)->Plugin::cpuActionStateChangedCallback(arg2,arg3,arg4); @@ -2549,28 +2551,28 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkCreate SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkCreatedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; (arg1)->networkLinkCreatedCallback(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkCreatedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; (arg1)->Plugin::networkLinkCreatedCallback(arg2); } @@ -2588,28 +2590,28 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkDestru SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkDestructedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; (arg1)->networkLinkDestructedCallback(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkDestructedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; (arg1)->Plugin::networkLinkDestructedCallback(arg2); } @@ -2627,7 +2629,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkStateC SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; e_surf_resource_state_t arg3 ; e_surf_resource_state_t arg4 ; @@ -2636,7 +2638,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; arg3 = (e_surf_resource_state_t)jarg3; arg4 = (e_surf_resource_state_t)jarg4; (arg1)->networkLinkStateChangedCallback(arg2,arg3,arg4); @@ -2645,7 +2647,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateChangedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - Link *arg2 = (Link *) 0 ; + simgrid::surf::Link *arg2 = (simgrid::surf::Link *) 0 ; e_surf_resource_state_t arg3 ; e_surf_resource_state_t arg4 ; @@ -2654,7 +2656,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(Link **)&jarg2; + arg2 = *(simgrid::surf::Link **)&jarg2; arg3 = (e_surf_resource_state_t)jarg3; arg4 = (e_surf_resource_state_t)jarg4; (arg1)->Plugin::networkLinkStateChangedCallback(arg2,arg3,arg4); @@ -2674,7 +2676,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateNetworkAct SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkActionStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - NetworkAction *arg2 = (NetworkAction *) 0 ; + simgrid::surf::NetworkAction *arg2 = (simgrid::surf::NetworkAction *) 0 ; e_surf_action_state_t arg3 ; e_surf_action_state_t arg4 ; @@ -2683,7 +2685,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkActionState (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(NetworkAction **)&jarg2; + arg2 = *(simgrid::surf::NetworkAction **)&jarg2; arg3 = (e_surf_action_state_t)jarg3; arg4 = (e_surf_action_state_t)jarg4; (arg1)->networkActionStateChangedCallback(arg2,arg3,arg4); @@ -2692,7 +2694,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkActionState SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkActionStateChangedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) { Plugin *arg1 = (Plugin *) 0 ; - NetworkAction *arg2 = (NetworkAction *) 0 ; + simgrid::surf::NetworkAction *arg2 = (simgrid::surf::NetworkAction *) 0 ; e_surf_action_state_t arg3 ; e_surf_action_state_t arg4 ; @@ -2701,7 +2703,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkActionState (void)jarg1_; (void)jarg2_; arg1 = *(Plugin **)&jarg1; - arg2 = *(NetworkAction **)&jarg2; + arg2 = *(simgrid::surf::NetworkAction **)&jarg2; arg3 = (e_surf_action_state_t)jarg3; arg4 = (e_surf_action_state_t)jarg4; (arg1)->Plugin::networkActionStateChangedCallback(arg2,arg3,arg4); @@ -2721,9 +2723,9 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateNetworkCom SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkCommunicateCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_, jdouble jarg5, jdouble jarg6) { Plugin *arg1 = (Plugin *) 0 ; - NetworkAction *arg2 = (NetworkAction *) 0 ; - RoutingEdge *arg3 = (RoutingEdge *) 0 ; - RoutingEdge *arg4 = (RoutingEdge *) 0 ; + simgrid::surf::NetworkAction *arg2 = (simgrid::surf::NetworkAction *) 0 ; + simgrid::surf::RoutingEdge *arg3 = (simgrid::surf::RoutingEdge *) 0 ; + simgrid::surf::RoutingEdge *arg4 = (simgrid::surf::RoutingEdge *) 0 ; double arg5 ; double arg6 ; @@ -2734,9 +2736,9 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkCommunicate (void)jarg3_; (void)jarg4_; arg1 = *(Plugin **)&jarg1; - arg2 = *(NetworkAction **)&jarg2; - arg3 = *(RoutingEdge **)&jarg3; - arg4 = *(RoutingEdge **)&jarg4; + arg2 = *(simgrid::surf::NetworkAction **)&jarg2; + arg3 = *(simgrid::surf::RoutingEdge **)&jarg3; + arg4 = *(simgrid::surf::RoutingEdge **)&jarg4; arg5 = (double)jarg5; arg6 = (double)jarg6; (arg1)->networkCommunicateCallback(arg2,arg3,arg4,arg5,arg6); @@ -2745,9 +2747,9 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkCommunicate SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkCommunicateCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_, jdouble jarg5, jdouble jarg6) { Plugin *arg1 = (Plugin *) 0 ; - NetworkAction *arg2 = (NetworkAction *) 0 ; - RoutingEdge *arg3 = (RoutingEdge *) 0 ; - RoutingEdge *arg4 = (RoutingEdge *) 0 ; + simgrid::surf::NetworkAction *arg2 = (simgrid::surf::NetworkAction *) 0 ; + simgrid::surf::RoutingEdge *arg3 = (simgrid::surf::RoutingEdge *) 0 ; + simgrid::surf::RoutingEdge *arg4 = (simgrid::surf::RoutingEdge *) 0 ; double arg5 ; double arg6 ; @@ -2758,9 +2760,9 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkCommunicate (void)jarg3_; (void)jarg4_; arg1 = *(Plugin **)&jarg1; - arg2 = *(NetworkAction **)&jarg2; - arg3 = *(RoutingEdge **)&jarg3; - arg4 = *(RoutingEdge **)&jarg4; + arg2 = *(simgrid::surf::NetworkAction **)&jarg2; + arg3 = *(simgrid::surf::RoutingEdge **)&jarg3; + arg4 = *(simgrid::surf::RoutingEdge **)&jarg4; arg5 = (double)jarg5; arg6 = (double)jarg6; (arg1)->Plugin::networkCommunicateCallback(arg2,arg3,arg4,arg5,arg6); @@ -2836,14 +2838,14 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1TmgrTraceEvent(JNI SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResources(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jdouble jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; result = (double)(arg1)->shareResources(arg2); jresult = (jdouble)result; @@ -2853,14 +2855,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResources(J SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResourcesLazy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jdouble jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; result = (double)(arg1)->shareResourcesLazy(arg2); jresult = (jdouble)result; @@ -2870,14 +2872,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResourcesLa SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResourcesFull(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jdouble jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; result = (double)(arg1)->shareResourcesFull(arg2); jresult = (jdouble)result; @@ -2886,14 +2888,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResourcesFu SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) { - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; arg3 = (double)jarg3; (arg1)->updateActionsState(arg2,arg3); @@ -2901,14 +2903,14 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsState( SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsStateLazy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) { - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; arg3 = (double)jarg3; (arg1)->updateActionsStateLazy(arg2,arg3); @@ -2916,14 +2918,14 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsStateL SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsStateFull(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) { - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; double arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; arg3 = (double)jarg3; (arg1)->updateActionsStateFull(arg2,arg3); @@ -2932,65 +2934,65 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1updateActionsStateF SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Model_1getRunningActionSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; - ActionList *result = 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; + simgrid::surf::ActionList *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; - result = (ActionList *)(arg1)->getRunningActionSet(); - *(ActionList **)&jresult = result; + arg1 = *(simgrid::surf::Model **)&jarg1; + result = (simgrid::surf::ActionList *)(arg1)->getRunningActionSet(); + *(simgrid::surf::ActionList **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Model_1addTraces(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; (arg1)->addTraces(); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Model(JNIEnv *jenv, jclass jcls, jlong jarg1) { - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; (void)jenv; (void)jcls; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; delete arg1; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1CpuModel(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; - CpuModel *result = 0 ; + simgrid::surf::CpuModel *result = 0 ; (void)jenv; (void)jcls; - result = (CpuModel *)new SwigDirector_CpuModel(jenv); - *(CpuModel **)&jresult = result; + result = (simgrid::surf::CpuModel *)new SwigDirector_CpuModel(jenv); + *(simgrid::surf::CpuModel **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1CpuModel(JNIEnv *jenv, jclass jcls, jlong jarg1) { - CpuModel *arg1 = (CpuModel *) 0 ; + simgrid::surf::CpuModel *arg1 = (simgrid::surf::CpuModel *) 0 ; (void)jenv; (void)jcls; - arg1 = *(CpuModel **)&jarg1; + arg1 = *(simgrid::surf::CpuModel **)&jarg1; delete arg1; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdoubleArray jarg3, jint jarg4, jdouble jarg5, jlong jarg6, jobject jarg6_, jint jarg7, jint jarg8, jlong jarg9, jobject jarg9_, jlong jarg10, jobject jarg10_) { jlong jresult = 0 ; - CpuModel *arg1 = (CpuModel *) 0 ; + simgrid::surf::CpuModel *arg1 = (simgrid::surf::CpuModel *) 0 ; char *arg2 = (char *) 0 ; DoubleDynar arg3 ; int arg4 ; @@ -3001,7 +3003,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn tmgr_trace *arg9 = (tmgr_trace *) 0 ; s_xbt_dict *arg10 = (s_xbt_dict *) 0 ; DoubleDynar *argp3 ; - Cpu *result = 0 ; + simgrid::surf::Cpu *result = 0 ; (void)jenv; (void)jcls; @@ -3009,7 +3011,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn (void)jarg6_; (void)jarg9_; (void)jarg10_; - arg1 = *(CpuModel **)&jarg1; + arg1 = *(simgrid::surf::CpuModel **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -3028,8 +3030,8 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn arg8 = (e_surf_resource_state_t)jarg8; arg9 = *(tmgr_trace **)&jarg9; arg10 = *(s_xbt_dict **)&jarg10; - result = (Cpu *)(arg1)->createCpu((char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); - *(Cpu **)&jresult = result; + result = (simgrid::surf::Cpu *)(arg1)->createCpu((char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); + *(simgrid::surf::Cpu **)&jresult = result; { } @@ -3038,7 +3040,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1createCpu(JNIEn SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - CpuModel *obj = *((CpuModel **)&objarg); + simgrid::surf::CpuModel *obj = *((simgrid::surf::CpuModel **)&objarg); (void)jcls; SwigDirector_CpuModel *director = dynamic_cast(obj); if (director) { @@ -3048,7 +3050,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1director_1connec SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - CpuModel *obj = *((CpuModel **)&objarg); + simgrid::surf::CpuModel *obj = *((simgrid::surf::CpuModel **)&objarg); SwigDirector_CpuModel *director = dynamic_cast(obj); (void)jcls; if (director) { @@ -3059,13 +3061,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1change_1ownershi SWIGEXPORT jstring JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getName(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jstring jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; char *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; result = (char *)(arg1)->getName(); if (result) jresult = jenv->NewStringUTF((const char *)result); return jresult; @@ -3074,13 +3076,13 @@ SWIGEXPORT jstring JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getName(JNIEn SWIGEXPORT jboolean JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1isUsed(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jboolean jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; bool result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; result = (bool)(arg1)->isUsed(); jresult = (jboolean)result; return jresult; @@ -3089,28 +3091,28 @@ SWIGEXPORT jboolean JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1isUsed(JNIEn SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getModel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; - Model *result = 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; + simgrid::surf::Model *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; - result = (Model *)(arg1)->getModel(); - *(Model **)&jresult = result; + arg1 = *(simgrid::surf::Resource **)&jarg1; + result = (simgrid::surf::Model *)(arg1)->getModel(); + *(simgrid::surf::Model **)&jresult = result; return jresult; } SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; e_surf_resource_state_t result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; result = (e_surf_resource_state_t)(arg1)->getState(); jresult = (jint)result; return jresult; @@ -3119,13 +3121,13 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getState(JNIEnv SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getConstraint(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; lmm_constraint *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; result = (lmm_constraint *)(arg1)->getConstraint(); *(lmm_constraint **)&jresult = result; return jresult; @@ -3134,13 +3136,13 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getConstraint(J SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getProperties(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; s_xbt_dict *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; result = (s_xbt_dict *)(arg1)->getProperties(); *(s_xbt_dict **)&jresult = result; return jresult; @@ -3148,7 +3150,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1getProperties(J SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1updateState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jdouble jarg3, jdouble jarg4) { - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; tmgr_trace_event *arg2 = (tmgr_trace_event *) 0 ; double arg3 ; double arg4 ; @@ -3157,7 +3159,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1updateState(JNIE (void)jcls; (void)jarg1_; (void)jarg2_; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; arg2 = *(tmgr_trace_event **)&jarg2; arg3 = (double)jarg3; arg4 = (double)jarg4; @@ -3166,32 +3168,32 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Resource_1updateState(JNIE SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Resource(JNIEnv *jenv, jclass jcls, jlong jarg1) { - Resource *arg1 = (Resource *) 0 ; + simgrid::surf::Resource *arg1 = (simgrid::surf::Resource *) 0 ; (void)jenv; (void)jcls; - arg1 = *(Resource **)&jarg1; + arg1 = *(simgrid::surf::Resource **)&jarg1; delete arg1; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_, jint jarg5, jdouble jarg6, jdouble jarg7) { jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; char *arg2 = (char *) 0 ; s_xbt_dict *arg3 = (s_xbt_dict *) 0 ; lmm_constraint *arg4 = (lmm_constraint *) 0 ; int arg5 ; double arg6 ; double arg7 ; - Cpu *result = 0 ; + simgrid::surf::Cpu *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg3_; (void)jarg4_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -3202,8 +3204,8 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEn arg5 = (int)jarg5; arg6 = (double)jarg6; arg7 = (double)jarg7; - result = (Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); - *(Cpu **)&jresult = result; + result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); + *(simgrid::surf::Cpu **)&jresult = result; { } @@ -3213,19 +3215,19 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_10(JNIEn SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4, jdouble jarg5, jdouble jarg6) { jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; char *arg2 = (char *) 0 ; s_xbt_dict *arg3 = (s_xbt_dict *) 0 ; int arg4 ; double arg5 ; double arg6 ; - Cpu *result = 0 ; + simgrid::surf::Cpu *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg3_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -3235,8 +3237,8 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_11(JNIEn arg4 = (int)jarg4; arg5 = (double)jarg5; arg6 = (double)jarg6; - result = (Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6); - *(Cpu **)&jresult = result; + result = (simgrid::surf::Cpu *)new SwigDirector_Cpu(jenv,arg1,(char const *)arg2,arg3,arg4,arg5,arg6); + *(simgrid::surf::Cpu **)&jresult = result; { } @@ -3245,24 +3247,24 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Cpu_1_1SWIG_11(JNIEn SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Cpu(JNIEnv *jenv, jclass jcls, jlong jarg1) { - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; (void)jenv; (void)jcls; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; delete arg1; } SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCurrentPowerPeak(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; result = (double)(arg1)->getCurrentPowerPeak(); jresult = (jdouble)result; return jresult; @@ -3271,14 +3273,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCurrentPowerPea SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCurrentPowerPeakSwigExplicitCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; - result = (double)(arg1)->Cpu::getCurrentPowerPeak(); + arg1 = *(simgrid::surf::Cpu **)&jarg1; + result = (double)(arg1)->simgrid::surf::Cpu::getCurrentPowerPeak(); jresult = (jdouble)result; return jresult; } @@ -3286,47 +3288,47 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCurrentPowerPea SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jlong jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double arg2 ; - CpuAction *result = 0 ; + simgrid::surf::CpuAction *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (double)jarg2; - result = (CpuAction *)(arg1)->execute(arg2); - *(CpuAction **)&jresult = result; + result = (simgrid::surf::CpuAction *)(arg1)->execute(arg2); + *(simgrid::surf::CpuAction **)&jresult = result; return jresult; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1sleep(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jlong jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double arg2 ; - CpuAction *result = 0 ; + simgrid::surf::CpuAction *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (double)jarg2; - result = (CpuAction *)(arg1)->sleep(arg2); - *(CpuAction **)&jresult = result; + result = (simgrid::surf::CpuAction *)(arg1)->sleep(arg2); + *(simgrid::surf::CpuAction **)&jresult = result; return jresult; } SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; result = (int)(arg1)->getCore(); jresult = (jint)result; return jresult; @@ -3335,14 +3337,14 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCore(JNIEnv *jenv, SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCoreSwigExplicitCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; - result = (int)(arg1)->Cpu::getCore(); + arg1 = *(simgrid::surf::Cpu **)&jarg1; + result = (int)(arg1)->simgrid::surf::Cpu::getCore(); jresult = (jint)result; return jresult; } @@ -3350,14 +3352,14 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getCoreSwigExplicitCp SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getSpeed(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (double)jarg2; result = (double)(arg1)->getSpeed(arg2); jresult = (jdouble)result; @@ -3367,16 +3369,16 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getSpeed(JNIEnv *j SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getSpeedSwigExplicitCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (double)jarg2; - result = (double)(arg1)->Cpu::getSpeed(arg2); + result = (double)(arg1)->simgrid::surf::Cpu::getSpeed(arg2); jresult = (jdouble)result; return jresult; } @@ -3384,13 +3386,13 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getSpeedSwigExplic SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getAvailableSpeed(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; result = (double)(arg1)->getAvailableSpeed(); jresult = (jdouble)result; return jresult; @@ -3399,14 +3401,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getAvailableSpeed( SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getAvailableSpeedSwigExplicitCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; - result = (double)(arg1)->Cpu::getAvailableSpeed(); + arg1 = *(simgrid::surf::Cpu **)&jarg1; + result = (double)(arg1)->simgrid::surf::Cpu::getAvailableSpeed(); jresult = (jdouble)result; return jresult; } @@ -3414,14 +3416,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getAvailableSpeedS SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getPowerPeakAt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { jdouble jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int arg2 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (int)jarg2; result = (double)(arg1)->getPowerPeakAt(arg2); jresult = (jdouble)result; @@ -3431,13 +3433,13 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getPowerPeakAt(JNI SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getNbPstates(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; result = (int)(arg1)->getNbPstates(); jresult = (jint)result; return jresult; @@ -3445,13 +3447,13 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getNbPstates(JNIEnv * SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1setPstate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (int)jarg2; (arg1)->setPstate(arg2); } @@ -3459,13 +3461,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1setPstate(JNIEnv *jen SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getPstate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; int result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; result = (int)(arg1)->getPstate(); jresult = (jint)result; return jresult; @@ -3473,20 +3475,20 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1getPstate(JNIEnv *jen SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1setState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - Cpu *arg1 = (Cpu *) 0 ; + simgrid::surf::Cpu *arg1 = (simgrid::surf::Cpu *) 0 ; e_surf_resource_state_t arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Cpu **)&jarg1; + arg1 = *(simgrid::surf::Cpu **)&jarg1; arg2 = (e_surf_resource_state_t)jarg2; (arg1)->setState(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - Cpu *obj = *((Cpu **)&objarg); + simgrid::surf::Cpu *obj = *((simgrid::surf::Cpu **)&objarg); (void)jcls; SwigDirector_Cpu *director = dynamic_cast(obj); if (director) { @@ -3496,7 +3498,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1director_1connect(JNI SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - Cpu *obj = *((Cpu **)&objarg); + simgrid::surf::Cpu *obj = *((simgrid::surf::Cpu **)&objarg); SwigDirector_Cpu *director = dynamic_cast(obj); (void)jcls; if (director) { @@ -3506,24 +3508,24 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1change_1ownership(JNI SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Link(JNIEnv *jenv, jclass jcls, jlong jarg1) { - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; (void)jenv; (void)jcls; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; delete arg1; } SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getBandwidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; result = (double)(arg1)->getBandwidth(); jresult = (jdouble)result; return jresult; @@ -3531,14 +3533,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getBandwidth(JNIE SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) { - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double arg2 ; double arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; arg2 = (double)jarg2; arg3 = (double)jarg3; (arg1)->updateBandwidth(arg2,arg3); @@ -3546,13 +3548,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1S SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; arg2 = (double)jarg2; (arg1)->updateBandwidth(arg2); } @@ -3560,13 +3562,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1S SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getLatency(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; result = (double)(arg1)->getLatency(); jresult = (jdouble)result; return jresult; @@ -3574,14 +3576,14 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getLatency(JNIEnv SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) { - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double arg2 ; double arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; arg2 = (double)jarg2; arg3 = (double)jarg3; (arg1)->updateLatency(arg2,arg3); @@ -3589,13 +3591,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWI SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - Link *arg1 = (Link *) 0 ; + simgrid::surf::Link *arg1 = (simgrid::surf::Link *) 0 ; double arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Link **)&jarg1; + arg1 = *(simgrid::surf::Link **)&jarg1; arg2 = (double)jarg2; (arg1)->updateLatency(arg2); } @@ -3603,57 +3605,57 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWI SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1Action(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jboolean jarg3) { jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; bool arg3 ; - Action *result = 0 ; + simgrid::surf::Action *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; arg3 = jarg3 ? true : false; - result = (Action *)new Action(arg1,arg2,arg3); - *(Action **)&jresult = result; + result = (simgrid::surf::Action *)new simgrid::surf::Action(arg1,arg2,arg3); + *(simgrid::surf::Action **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Action(JNIEnv *jenv, jclass jcls, jlong jarg1) { - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; (void)jenv; (void)jcls; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; delete arg1; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getModel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Action *arg1 = (Action *) 0 ; - Model *result = 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; + simgrid::surf::Model *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; - result = (Model *)(arg1)->getModel(); - *(Model **)&jresult = result; + arg1 = *(simgrid::surf::Action **)&jarg1; + result = (simgrid::surf::Model *)(arg1)->getModel(); + *(simgrid::surf::Model **)&jresult = result; return jresult; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getVariable(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; lmm_variable *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; result = (lmm_variable *)(arg1)->getVariable(); *(lmm_variable **)&jresult = result; return jresult; @@ -3662,13 +3664,13 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getVariable(JNIEn SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; e_surf_action_state_t result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; result = (e_surf_action_state_t)(arg1)->getState(); jresult = (jint)result; return jresult; @@ -3677,13 +3679,13 @@ SWIGEXPORT jint JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getState(JNIEnv *j SWIGEXPORT jboolean JNICALL Java_org_simgrid_surf_SurfJNI_Action_1isSuspended(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jboolean jresult = 0 ; - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; bool result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; result = (bool)(arg1)->isSuspended(); jresult = (jboolean)result; return jresult; @@ -3692,13 +3694,13 @@ SWIGEXPORT jboolean JNICALL Java_org_simgrid_surf_SurfJNI_Action_1isSuspended(JN SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getBound(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; result = (double)(arg1)->getBound(); jresult = (jdouble)result; return jresult; @@ -3706,26 +3708,26 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getBound(JNIEnv SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1setBound(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; double arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; arg2 = (double)jarg2; (arg1)->setBound(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1updateRemains(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; double arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; arg2 = (double)jarg2; (arg1)->updateRemains(arg2); } @@ -3733,13 +3735,13 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1updateRemains(JNIE SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getRemains(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; result = (double)(arg1)->getRemains(); jresult = (jdouble)result; return jresult; @@ -3747,26 +3749,26 @@ SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Action_1getRemains(JNIE SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1setPriority(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; double arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; arg2 = (double)jarg2; (arg1)->setPriority(arg2); } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1setState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - Action *arg1 = (Action *) 0 ; + simgrid::surf::Action *arg1 = (simgrid::surf::Action *) 0 ; e_surf_action_state_t arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Action **)&jarg1; + arg1 = *(simgrid::surf::Action **)&jarg1; arg2 = (e_surf_action_state_t)jarg2; (arg1)->setState(arg2); } @@ -3774,50 +3776,50 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Action_1setState(JNIEnv *j SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1CpuAction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jboolean jarg3) { jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; + simgrid::surf::Model *arg1 = (simgrid::surf::Model *) 0 ; double arg2 ; bool arg3 ; - CpuAction *result = 0 ; + simgrid::surf::CpuAction *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(Model **)&jarg1; + arg1 = *(simgrid::surf::Model **)&jarg1; arg2 = (double)jarg2; arg3 = jarg3 ? true : false; - result = (CpuAction *)new SwigDirector_CpuAction(jenv,arg1,arg2,arg3); - *(CpuAction **)&jresult = result; + result = (simgrid::surf::CpuAction *)new SwigDirector_CpuAction(jenv,arg1,arg2,arg3); + *(simgrid::surf::CpuAction **)&jresult = result; return jresult; } SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1getCpu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - CpuAction *arg1 = (CpuAction *) 0 ; - Cpu *result = 0 ; + simgrid::surf::CpuAction *arg1 = (simgrid::surf::CpuAction *) 0 ; + simgrid::surf::Cpu *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(CpuAction **)&jarg1; - result = (Cpu *)CpuAction_getCpu(arg1); - *(Cpu **)&jresult = result; + arg1 = *(simgrid::surf::CpuAction **)&jarg1; + result = (simgrid::surf::Cpu *)simgrid_surf_CpuAction_getCpu(arg1); + *(simgrid::surf::Cpu **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1CpuAction(JNIEnv *jenv, jclass jcls, jlong jarg1) { - CpuAction *arg1 = (CpuAction *) 0 ; + simgrid::surf::CpuAction *arg1 = (simgrid::surf::CpuAction *) 0 ; (void)jenv; (void)jcls; - arg1 = *(CpuAction **)&jarg1; + arg1 = *(simgrid::surf::CpuAction **)&jarg1; delete arg1; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - CpuAction *obj = *((CpuAction **)&objarg); + simgrid::surf::CpuAction *obj = *((simgrid::surf::CpuAction **)&objarg); (void)jcls; SwigDirector_CpuAction *director = dynamic_cast(obj); if (director) { @@ -3827,7 +3829,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1director_1conne SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - CpuAction *obj = *((CpuAction **)&objarg); + simgrid::surf::CpuAction *obj = *((simgrid::surf::CpuAction **)&objarg); SwigDirector_CpuAction *director = dynamic_cast(obj); (void)jcls; if (director) { @@ -3838,38 +3840,38 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1change_1ownersh SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_NetworkAction_1getLatency(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jdouble jresult = 0 ; - NetworkAction *arg1 = (NetworkAction *) 0 ; + simgrid::surf::NetworkAction *arg1 = (simgrid::surf::NetworkAction *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(NetworkAction **)&jarg1; - result = (double)NetworkAction_getLatency(arg1); + arg1 = *(simgrid::surf::NetworkAction **)&jarg1; + result = (double)simgrid_surf_NetworkAction_getLatency(arg1); jresult = (jdouble)result; return jresult; } SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1NetworkAction(JNIEnv *jenv, jclass jcls, jlong jarg1) { - NetworkAction *arg1 = (NetworkAction *) 0 ; + simgrid::surf::NetworkAction *arg1 = (simgrid::surf::NetworkAction *) 0 ; (void)jenv; (void)jcls; - arg1 = *(NetworkAction **)&jarg1; + arg1 = *(simgrid::surf::NetworkAction **)&jarg1; delete arg1; } SWIGEXPORT jstring JNICALL Java_org_simgrid_surf_SurfJNI_RoutingEdge_1getName(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jstring jresult = 0 ; - RoutingEdge *arg1 = (RoutingEdge *) 0 ; + simgrid::surf::RoutingEdge *arg1 = (simgrid::surf::RoutingEdge *) 0 ; char *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(RoutingEdge **)&jarg1; + arg1 = *(simgrid::surf::RoutingEdge **)&jarg1; result = (char *)(arg1)->getName(); if (result) jresult = jenv->NewStringUTF((const char *)result); return jresult; @@ -3877,11 +3879,11 @@ SWIGEXPORT jstring JNICALL Java_org_simgrid_surf_SurfJNI_RoutingEdge_1getName(JN SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1RoutingEdge(JNIEnv *jenv, jclass jcls, jlong jarg1) { - RoutingEdge *arg1 = (RoutingEdge *) 0 ; + simgrid::surf::RoutingEdge *arg1 = (simgrid::surf::RoutingEdge *) 0 ; (void)jenv; (void)jcls; - arg1 = *(RoutingEdge **)&jarg1; + arg1 = *(simgrid::surf::RoutingEdge **)&jarg1; delete arg1; } @@ -4044,7 +4046,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuModel_1SWIGUpcast(JNIE jlong baseptr = 0; (void)jenv; (void)jcls; - *(Model **)&baseptr = *(CpuModel **)&jarg1; + *(simgrid::surf::Model **)&baseptr = *(simgrid::surf::CpuModel **)&jarg1; return baseptr; } @@ -4052,7 +4054,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1SWIGUpcast(JNIEnv *j jlong baseptr = 0; (void)jenv; (void)jcls; - *(Resource **)&baseptr = *(Cpu **)&jarg1; + *(simgrid::surf::Resource **)&baseptr = *(simgrid::surf::Cpu **)&jarg1; return baseptr; } @@ -4060,7 +4062,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Link_1SWIGUpcast(JNIEnv * jlong baseptr = 0; (void)jenv; (void)jcls; - *(Resource **)&baseptr = *(Link **)&jarg1; + *(simgrid::surf::Resource **)&baseptr = *(simgrid::surf::Link **)&jarg1; return baseptr; } @@ -4068,7 +4070,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_CpuAction_1SWIGUpcast(JNI jlong baseptr = 0; (void)jenv; (void)jcls; - *(Action **)&baseptr = *(CpuAction **)&jarg1; + *(simgrid::surf::Action **)&baseptr = *(simgrid::surf::CpuAction **)&jarg1; return baseptr; } @@ -4076,7 +4078,7 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_NetworkAction_1SWIGUpcast jlong baseptr = 0; (void)jenv; (void)jcls; - *(Action **)&baseptr = *(NetworkAction **)&jarg1; + *(simgrid::surf::Action **)&baseptr = *(simgrid::surf::NetworkAction **)&jarg1; return baseptr; } diff --git a/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h b/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h index 53d5d17115..82b10b6b37 100644 --- a/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h +++ b/src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h @@ -17,15 +17,15 @@ public: void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); SwigDirector_Plugin(JNIEnv *jenv); virtual ~SwigDirector_Plugin(); - virtual void cpuCreatedCallback(Cpu *cpu); - virtual void cpuDestructedCallback(Cpu *cpu); - virtual void cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2); - virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t arg1, e_surf_action_state_t arg2); - virtual void networkLinkCreatedCallback(Link *link); - virtual void networkLinkDestructedCallback(Link *link); - virtual void networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2); - virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur); - virtual void networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate); + virtual void cpuCreatedCallback(simgrid::surf::Cpu *cpu); + virtual void cpuDestructedCallback(simgrid::surf::Cpu *cpu); + virtual void cpuStateChangedCallback(simgrid::surf::Cpu *cpu, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2); + virtual void cpuActionStateChangedCallback(simgrid::surf::CpuAction *action, e_surf_action_state_t arg1, e_surf_action_state_t arg2); + virtual void networkLinkCreatedCallback(simgrid::surf::Link *link); + virtual void networkLinkDestructedCallback(simgrid::surf::Link *link); + virtual void networkLinkStateChangedCallback(simgrid::surf::Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2); + virtual void networkActionStateChangedCallback(simgrid::surf::NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur); + virtual void networkCommunicateCallback(simgrid::surf::NetworkAction *action, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, double size, double rate); public: bool swig_overrides(int n) { return (n < 9 ? swig_override[n] : false); @@ -34,7 +34,7 @@ protected: bool swig_override[9]; }; -class SwigDirector_CpuModel : public CpuModel, public Swig::Director { +class SwigDirector_CpuModel : public simgrid::surf::CpuModel, public Swig::Director { public: void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); @@ -45,10 +45,10 @@ public: virtual void updateActionsState(double now, double delta); virtual void updateActionsStateLazy(double now, double delta); virtual void updateActionsStateFull(double now, double delta); - virtual ActionList *getRunningActionSet(); + virtual simgrid::surf::ActionList *getRunningActionSet(); virtual void addTraces(); virtual ~SwigDirector_CpuModel(); - virtual Cpu *createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties); + virtual simgrid::surf::Cpu *createCpu(char const *name, DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, tmgr_trace *state_trace, s_xbt_dict *cpu_properties); public: bool swig_overrides(int n) { return (n < 9 ? swig_override[n] : false); @@ -57,19 +57,19 @@ protected: bool swig_override[9]; }; -class SwigDirector_Cpu : public Cpu, public Swig::Director { +class SwigDirector_Cpu : public simgrid::surf::Cpu, public Swig::Director { public: void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_Cpu(JNIEnv *jenv, Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale); - SwigDirector_Cpu(JNIEnv *jenv, Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale); + SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale); + SwigDirector_Cpu(JNIEnv *jenv, simgrid::surf::Model *model, char const *name, s_xbt_dict *props, int core, double powerPeak, double powerScale); virtual bool isUsed(); virtual e_surf_resource_state_t getState(); virtual void updateState(tmgr_trace_event *event_type, double value, double date); virtual ~SwigDirector_Cpu(); virtual double getCurrentPowerPeak(); - virtual CpuAction *execute(double size); - virtual CpuAction *sleep(double duration); + virtual simgrid::surf::CpuAction *execute(double size); + virtual simgrid::surf::CpuAction *sleep(double duration); virtual int getCore(); virtual double getSpeed(double load); virtual double getAvailableSpeed(); @@ -85,11 +85,11 @@ protected: bool swig_override[13]; }; -class SwigDirector_CpuAction : public CpuAction, public Swig::Director { +class SwigDirector_CpuAction : public simgrid::surf::CpuAction, public Swig::Director { public: void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_CpuAction(JNIEnv *jenv, Model *model, double cost, bool failed); + SwigDirector_CpuAction(JNIEnv *jenv, simgrid::surf::Model *model, double cost, bool failed); virtual ~SwigDirector_CpuAction(); virtual double getRemains(); virtual void setPriority(double priority); diff --git a/src/bindings/java/surf.i b/src/bindings/java/surf.i index 43d2c27ecf..a20d84c9a3 100644 --- a/src/bindings/java/surf.i +++ b/src/bindings/java/surf.i @@ -46,11 +46,13 @@ extern "C" { #endif JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_getAction(JNIEnv *env, jclass cls, jlong jarg1) { - Action * action = (Action *)jarg1; + simgrid::surf::Action * action = (simgrid::surf::Action *)jarg1; jobject res; - CpuAction *cpu_action = dynamic_cast(action); + simgrid::surf::CpuAction *cpu_action = + dynamic_cast(action); if (cpu_action) { - SwigDirector_CpuAction *dir_cpu_action = dynamic_cast(cpu_action); + SwigDirector_CpuAction *dir_cpu_action = + dynamic_cast(cpu_action); if (dir_cpu_action) { res = dir_cpu_action->swig_get_self(env);\ } else { @@ -71,7 +73,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_getAction(JNIEnv *env, j #define GETDIRECTOR(NAME) \ JNIEXPORT jobject JNICALL Java_org_simgrid_surf_SurfJNI_get## NAME ## Director(JNIEnv *env, jclass cls, jlong jarg1)\ {\ - NAME * arg1 = (NAME*)jarg1;\ + simgrid::surf::NAME * arg1 = (simgrid::surf::NAME*)jarg1;\ SwigDirector_ ##NAME *director = dynamic_cast(arg1);\ jobject res;\ if (director) {\ @@ -113,18 +115,21 @@ JAVA_ARRAYSOFCLASSES(Action); } %typemap(out) ActionArrayPtr { long l = 0; - for(ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) { + for(simgrid::surf::ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) { l++; } $result = jenv->NewLongArray(l); jlong *elts = jenv->GetLongArrayElements($result, NULL); l = 0; - for(ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) { - elts[l++] = (jlong)static_cast(&*it); + for(simgrid::surf::ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) { + elts[l++] = (jlong)static_cast(&*it); } jenv->ReleaseLongArrayElements($result, elts, 0); } +namespace simgrid { +namespace surf { + class ActionList { public: //void push_front(Action &action); @@ -136,9 +141,12 @@ public: } }; +} +} + /* Handle xbt_dynar_t of Link */ -JAVA_ARRAYSOFCLASSES(Link); -%apply Link[] {LinkDynar}; +JAVA_ARRAYSOFCLASSES(simgrid::surf::Link); +%apply simgrid::surf::Link[] {LinkDynar}; %typemap(jstype) LinkDynar "Link[]" %typemap(javain) LinkDynar "Link.cArrayUnwrap($javainput)" %typemap(javaout) LinkDynar { @@ -200,6 +208,29 @@ JAVA_ARRAYSOFCLASSES(Link); %include "src/bindings/java/surf_swig.hpp" +namespace simgrid { +namespace surf { + +class Model; +class CpuModel; +class HostModel; +class VMModel; +class NetworkModel; +class StorageModel; +class Resource; +class ResourceLmm; +class Host; +class HostCLM03; +class NetworkCm02Link; +class Action; +class ActionLmm; +class StorageActionLmm; +class As; +class RoutingPlatf; + +} +} + %rename tmgr_trace TmgrTrace; %nodefaultctor tmgr_trace; struct tmgr_trace { @@ -230,6 +261,9 @@ struct tmgr_trace_event { } }; +namespace simgrid { +namespace surf { + %nodefaultctor Model; class Model { public: @@ -243,7 +277,7 @@ public: virtual void updateActionsStateLazy(double now, double delta); virtual void updateActionsStateFull(double now, double delta); - virtual ActionList *getRunningActionSet(); + virtual simgrid::surf::ActionList *getRunningActionSet(); virtual void addTraces()=0; }; @@ -253,7 +287,8 @@ class CpuModel : public Model { public: CpuModel(); virtual ~CpuModel(); - virtual Cpu *createCpu(const char *name, DoubleDynar power_peak, + virtual simgrid::surf::Cpu *createCpu(const char *name, + DoubleDynar power_peak, int pstate, double power_scale, tmgr_trace *power_trace, int core, e_surf_resource_state_t state_initial, @@ -266,7 +301,7 @@ public: Resource(); const char *getName(); virtual bool isUsed()=0; - Model *getModel(); + simgrid::surf::Model *getModel(); virtual e_surf_resource_state_t getState(); lmm_constraint *getConstraint(); @@ -277,14 +312,14 @@ public: %feature("director") Cpu; class Cpu : public Resource { public: - Cpu(Model *model, const char *name, s_xbt_dict *props, + Cpu(simgrid::surf::Model *model, const char *name, s_xbt_dict *props, lmm_constraint *constraint, int core, double powerPeak, double powerScale); - Cpu(Model *model, const char *name, s_xbt_dict *props, + Cpu(simgrid::surf::Model *model, const char *name, s_xbt_dict *props, int core, double powerPeak, double powerScale); virtual ~Cpu(); virtual double getCurrentPowerPeak(); - virtual CpuAction *execute(double size)=0; - virtual CpuAction *sleep(double duration)=0; + virtual simgrid::surf::CpuAction *execute(double size)=0; + virtual simgrid::surf::CpuAction *sleep(double duration)=0; virtual int getCore(); virtual double getSpeed(double load); virtual double getAvailableSpeed(); @@ -295,7 +330,7 @@ public: void setState(e_surf_resource_state_t state); }; -class Link : public Resource { +class Link : public simgrid::surf::Resource { public: Link(); ~Link(); @@ -328,7 +363,7 @@ class CpuAction : public Action { public: CpuAction(Model *model, double cost, bool failed); %extend { - Cpu *getCpu() {return getActionCpu($self);} + simgrid::surf::Cpu *getCpu() {return getActionCpu($self);} } }; @@ -347,6 +382,9 @@ public: virtual char *getName()=0; }; +} +} + %rename lmm_constraint LmmConstraint; struct lmm_constraint { %extend { diff --git a/src/bindings/java/surf_swig.cpp b/src/bindings/java/surf_swig.cpp index f27fdf2e03..a3ccced254 100644 --- a/src/bindings/java/surf_swig.cpp +++ b/src/bindings/java/surf_swig.cpp @@ -31,70 +31,88 @@ void clean() { SIMIX_clean(); } -CpuModel *getCpuModel(){ +simgrid::surf::CpuModel *getCpuModel(){ return surf_cpu_model_pm; } -CpuModel *java_cpu_model; +simgrid::surf::CpuModel *java_cpu_model; static void java_cpu_model_init_preparse() { surf_cpu_model_pm = java_cpu_model; xbt_dynar_push(all_existing_models, &java_cpu_model); } -void setCpuModel(CpuModel *cpuModel){ +void setCpuModel(simgrid::surf::CpuModel *cpuModel){ java_cpu_model = cpuModel; surf_cpu_model_init_preparse = java_cpu_model_init_preparse; } -void setCpu(char *name, Cpu *cpu) { +void setCpu(char *name, simgrid::surf::Cpu *cpu) { sg_host_surfcpu_set(sg_host_by_name(name), cpu); } LinkDynar getRoute(char *srcName, char *dstName) { - RoutingEdge *src = sg_host_edge(sg_host_by_name(srcName)); - RoutingEdge *dst = sg_host_edge(sg_host_by_name(dstName)); + simgrid::surf::RoutingEdge *src = sg_host_edge(sg_host_by_name(srcName)); + simgrid::surf::RoutingEdge *dst = sg_host_edge(sg_host_by_name(dstName)); xbt_assert(src,"Cannot get the route from a NULL source"); xbt_assert(dst,"Cannot get the route to a NULL destination"); - xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdge*), NULL); + xbt_dynar_t route = xbt_dynar_new(sizeof(simgrid::surf::RoutingEdge*), NULL); routing_platf->getRouteAndLatency(src, dst, &route, NULL); return route; } -void Plugin::activateCpuCreatedCallback(){ - surf_callback_connect(cpuCreatedCallbacks, std::bind(&Plugin::cpuCreatedCallback, this, _1)); +void Plugin::activateCpuCreatedCallback() +{ + surf_callback_connect(simgrid::surf::cpuCreatedCallbacks, + std::bind(&Plugin::cpuCreatedCallback, this, _1)); } -void Plugin::activateCpuDestructedCallback(){ - surf_callback_connect(cpuDestructedCallbacks, std::bind(&Plugin::cpuDestructedCallback, this, _1)); +void Plugin::activateCpuDestructedCallback() +{ + surf_callback_connect(simgrid::surf::cpuDestructedCallbacks, + std::bind(&Plugin::cpuDestructedCallback, this, _1)); } -void Plugin::activateCpuStateChangedCallback(){ - surf_callback_connect(cpuStateChangedCallbacks, std::bind(&Plugin::cpuStateChangedCallback, this, _1, _2, _3)); +void Plugin::activateCpuStateChangedCallback() +{ + surf_callback_connect(simgrid::surf::cpuStateChangedCallbacks, + std::bind(&Plugin::cpuStateChangedCallback, this, _1, _2, _3)); } -void Plugin::activateCpuActionStateChangedCallback(){ - surf_callback_connect(cpuActionStateChangedCallbacks, std::bind(&Plugin::cpuActionStateChangedCallback, this, _1, _2, _3)); +void Plugin::activateCpuActionStateChangedCallback() +{ + surf_callback_connect(simgrid::surf::cpuActionStateChangedCallbacks, + std::bind(&Plugin::cpuActionStateChangedCallback, this, _1, _2, _3)); } -void Plugin::activateLinkCreatedCallback(){ - surf_callback_connect(networkLinkCreatedCallbacks, std::bind(&Plugin::networkLinkCreatedCallback, this, _1)); +void Plugin::activateLinkCreatedCallback() +{ + surf_callback_connect(simgrid::surf::networkLinkCreatedCallbacks, + std::bind(&Plugin::networkLinkCreatedCallback, this, _1)); } -void Plugin::activateLinkDestructedCallback(){ - surf_callback_connect(networkLinkDestructedCallbacks, std::bind(&Plugin::networkLinkDestructedCallback, this, _1)); +void Plugin::activateLinkDestructedCallback() +{ + surf_callback_connect(simgrid::surf::networkLinkDestructedCallbacks, + std::bind(&Plugin::networkLinkDestructedCallback, this, _1)); } -void Plugin::activateLinkStateChangedCallback(){ - surf_callback_connect(networkLinkStateChangedCallbacks, std::bind(&Plugin::networkLinkStateChangedCallback, this, _1, _2, _3)); +void Plugin::activateLinkStateChangedCallback() +{ + surf_callback_connect(simgrid::surf::networkLinkStateChangedCallbacks, + std::bind(&Plugin::networkLinkStateChangedCallback, this, _1, _2, _3)); } -void Plugin::activateNetworkActionStateChangedCallback(){ - surf_callback_connect(networkActionStateChangedCallbacks, std::bind(&Plugin::networkActionStateChangedCallback, this, _1, _2, _3)); +void Plugin::activateNetworkActionStateChangedCallback() +{ + surf_callback_connect(simgrid::surf::networkActionStateChangedCallbacks, + std::bind(&Plugin::networkActionStateChangedCallback, this, _1, _2, _3)); } -void Plugin::activateNetworkCommunicateCallback(){ - surf_callback_connect(networkCommunicateCallbacks, std::bind(&Plugin::networkCommunicateCallback, this, _1, _2, _3, _4, _5)); +void Plugin::activateNetworkCommunicateCallback() +{ + surf_callback_connect(simgrid::surf::networkCommunicateCallbacks, + std::bind(&Plugin::networkCommunicateCallback, this, _1, _2, _3, _4, _5)); } diff --git a/src/bindings/java/surf_swig.hpp b/src/bindings/java/surf_swig.hpp index 0f1c8a8e4a..39f533ed33 100644 --- a/src/bindings/java/surf_swig.hpp +++ b/src/bindings/java/surf_swig.hpp @@ -11,16 +11,16 @@ #include "src/surf/maxmin_private.hpp" typedef xbt_dynar_t LinkDynar; -typedef ActionList *ActionArrayPtr; +typedef simgrid::surf::ActionList *ActionArrayPtr; double getClock(); void clean(); -CpuModel *getCpuModel(); -void setCpuModel(CpuModel *cpuModel); +simgrid::surf::CpuModel *getCpuModel(); +void setCpuModel(simgrid::surf::CpuModel *cpuModel); -void setCpu(char *name, Cpu *cpu); +void setCpu(char *name, simgrid::surf::Cpu *cpu); LinkDynar getRoute(char *srcName, char *dstName); @@ -31,30 +31,30 @@ public: } void activateCpuCreatedCallback(); - virtual void cpuCreatedCallback(Cpu *cpu) {} + virtual void cpuCreatedCallback(simgrid::surf::Cpu *cpu) {} void activateCpuDestructedCallback(); - virtual void cpuDestructedCallback(Cpu *cpu) {} + virtual void cpuDestructedCallback(simgrid::surf::Cpu *cpu) {} void activateCpuStateChangedCallback(); - virtual void cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t, e_surf_resource_state_t) {} + virtual void cpuStateChangedCallback(simgrid::surf::Cpu *cpu, e_surf_resource_state_t, e_surf_resource_state_t) {} void activateCpuActionStateChangedCallback(); - virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t, e_surf_action_state_t) {} + virtual void cpuActionStateChangedCallback(simgrid::surf::CpuAction *action, e_surf_action_state_t, e_surf_action_state_t) {} void activateLinkCreatedCallback(); - virtual void networkLinkCreatedCallback(Link *link) {} + virtual void networkLinkCreatedCallback(simgrid::surf::Link *link) {} void activateLinkDestructedCallback(); - virtual void networkLinkDestructedCallback(Link *link) {} + virtual void networkLinkDestructedCallback(simgrid::surf::Link *link) {} void activateLinkStateChangedCallback(); - virtual void networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t, e_surf_resource_state_t) {} + virtual void networkLinkStateChangedCallback(simgrid::surf::Link *link, e_surf_resource_state_t, e_surf_resource_state_t) {} void activateNetworkActionStateChangedCallback(); - virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) {} + virtual void networkActionStateChangedCallback(simgrid::surf::NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) {} void activateNetworkCommunicateCallback(); - virtual void networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate) {} + virtual void networkCommunicateCallback(simgrid::surf::NetworkAction *action, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, double size, double rate) {} }; diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 37d4b84ca0..706486ea22 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -14,6 +14,7 @@ #include "xbt/misc.h" #include "xbt/config.h" #include "src/portable.h" +#include "surf/surf_routing.h" #include "surf/datatypes.h" #include "xbt/lib.h" #include "surf/surf_routing.h" @@ -42,6 +43,10 @@ typedef enum { } e_surf_network_element_type_t; #ifdef __cplusplus + +namespace simgrid { +namespace surf { + class Model; class CpuModel; class HostModel; @@ -58,23 +63,44 @@ class ActionLmm; class StorageActionLmm; class As; class RoutingPlatf; + +} +} + +typedef simgrid::surf::Model surf_Model; +typedef simgrid::surf::CpuModel surf_CpuModel; +typedef simgrid::surf::HostModel surf_HostModel; +typedef simgrid::surf::VMModel surf_VMModel; +typedef simgrid::surf::NetworkModel surf_NetworkModel; +typedef simgrid::surf::StorageModel surf_StorageModel; +typedef simgrid::surf::Resource surf_Resource; +typedef simgrid::surf::ResourceLmm surf_ResourceLmm; +typedef simgrid::surf::Host surf_Host; +typedef simgrid::surf::HostCLM03 surf_HostCLM03; +typedef simgrid::surf::NetworkCm02Link surf_NetworkCm02Link; +typedef simgrid::surf::Action surf_Action; +typedef simgrid::surf::ActionLmm surf_ActionLmm; +typedef simgrid::surf::StorageActionLmm surf_StorageActionLmm; +typedef simgrid::surf::RoutingPlatf surf_RoutingPlatf; + #else -typedef struct Model Model; -typedef struct CpuModel CpuModel; -typedef struct HostModel HostModel; -typedef struct VMModel VMModel; -typedef struct NetworkModel NetworkModel; -typedef struct StorageModel StorageModel; -typedef struct Resource Resource; -typedef struct ResourceLmm ResourceLmm; -typedef struct HostCLM03 HostCLM03; -typedef struct Host Host; -typedef struct NetworkCm02Link NetworkCm02Link; -typedef struct Action Action; -typedef struct ActionLmm ActionLmm; -typedef struct StorageActionLmm StorageActionLmm; -typedef struct As As; -typedef struct RoutingPlatf RoutingPlatf; + +typedef struct surf_Model surf_Model; +typedef struct surf_CpuModel surf_CpuModel; +typedef struct surf_HostModel surf_HostModel; +typedef struct surf_VMModel surf_VMModel; +typedef struct surf_NetworkModel surf_NetworkModel; +typedef struct surf_StorageModel surf_StorageModel; +typedef struct surf_Resource surf_Resource; +typedef struct surf_ResourceLmm surf_ResourceLmm; +typedef struct surf_HostCLM03 surf_HostCLM03; +typedef struct surf_Host surf_Host; +typedef struct surf_NetworkCm02Link surf_NetworkCm02Link; +typedef struct surf_Action surf_Action; +typedef struct surf_ActionLmm surf_ActionLmm; +typedef struct surf_StorageActionLmm surf_StorageActionLmm; +typedef struct surf_RoutingPlatf surf_RoutingPlatf; + #endif /** @ingroup SURF_c_bindings @@ -83,18 +109,17 @@ typedef struct RoutingPlatf RoutingPlatf; * Generic data structure for a model. The hosts, * the CPUs and the network links are examples of models. */ -typedef Model *surf_model_t; -typedef CpuModel *surf_cpu_model_t; -typedef HostModel *surf_host_model_t; -typedef VMModel *surf_vm_model_t; - -typedef NetworkModel *surf_network_model_t; -typedef StorageModel *surf_storage_model_t; +typedef surf_Model *surf_model_t; +typedef surf_CpuModel *surf_cpu_model_t; +typedef surf_HostModel *surf_host_model_t; +typedef surf_VMModel *surf_vm_model_t; +typedef surf_NetworkModel *surf_network_model_t; +typedef surf_StorageModel *surf_storage_model_t; typedef xbt_dictelm_t surf_resource_t; -typedef Resource *surf_cpp_resource_t; -typedef Host *surf_host_t; -typedef Cpu *surf_cpu_t; +typedef surf_Resource *surf_cpp_resource_t; +typedef surf_Host *surf_host_t; +typedef surf_Cpu *surf_cpu_t; /** @ingroup SURF_c_bindings * \brief Action structure @@ -104,10 +129,8 @@ typedef Cpu *surf_cpu_t; * * \see e_surf_action_state_t */ -typedef Action *surf_action_t; - -typedef As *AS_t; -typedef RoutingPlatf *routing_platf_t; +typedef surf_Action *surf_action_t; +typedef surf_RoutingPlatf *routing_platf_t; typedef struct surf_file *surf_file_t; @@ -1166,9 +1189,9 @@ void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *fi /********** Routing **********/ void routing_AS_begin(sg_platf_AS_cbarg_t AS); void routing_AS_end(void); -RoutingEdge *routing_add_host(As* as, sg_platf_host_cbarg_t host); +surf_RoutingEdge* routing_add_host(surf_As* as, sg_platf_host_cbarg_t host); void routing_cluster_add_backbone(void* bb); -As* routing_get_current(); +surf_As* routing_get_current(); SG_END_DECL() #endif /* _SURF_SURF_H */ diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index c8f1907b09..4f4ea787a7 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -51,10 +51,10 @@ int USER_HOST_LEVEL; #include "src/surf/surf_routing.hpp" static XBT_INLINE void surf_cpu_free(void *r) { - delete static_cast(r); + delete static_cast(r); } static XBT_INLINE void routing_asr_host_free(void *p) { - delete static_cast(p); + delete static_cast(p); } void sg_host_init() { @@ -119,18 +119,18 @@ void sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu) { } void sg_host_surfcpu_register(sg_host_t host, surf_cpu_t cpu) { - surf_callback_emit(cpuCreatedCallbacks, cpu); - surf_callback_emit(cpuStateChangedCallbacks, cpu, SURF_RESOURCE_ON, cpu->getState()); + surf_callback_emit(simgrid::surf::cpuCreatedCallbacks, cpu); + surf_callback_emit(simgrid::surf::cpuStateChangedCallbacks, cpu, SURF_RESOURCE_ON, cpu->getState()); sg_host_surfcpu_set(host, cpu); } void sg_host_surfcpu_destroy(sg_host_t host) { xbt_lib_unset(host_lib,host->key,SURF_CPU_LEVEL,1); } // ========== RoutingEdge ============ -RoutingEdge *sg_host_edge(sg_host_t host) { - return (RoutingEdge*) xbt_lib_get_level(host, ROUTING_HOST_LEVEL); +surf_RoutingEdge *sg_host_edge(sg_host_t host) { + return (surf_RoutingEdge*) xbt_lib_get_level(host, ROUTING_HOST_LEVEL); } -void sg_host_edge_set(sg_host_t host, RoutingEdge *edge) { +void sg_host_edge_set(sg_host_t host, surf_RoutingEdge *edge) { xbt_lib_set(host_lib, host->key, ROUTING_HOST_LEVEL, edge); } void sg_host_edge_destroy(sg_host_t host, int do_callback) { diff --git a/src/surf/callbacks.cpp b/src/surf/callbacks.cpp index 86dedde039..22b2bc4144 100644 --- a/src/surf/callbacks.cpp +++ b/src/surf/callbacks.cpp @@ -12,7 +12,7 @@ void surf_on_host_created(void (*callback)(sg_host_t)) { - hostCreatedCallbacks.connect([callback](Host* host) { + simgrid::surf::hostCreatedCallbacks.connect([callback](simgrid::surf::Host* host) { const char* id = host->getName(); sg_host_t h = sg_host_by_name(id); xbt_assert(h != NULL, "Host not found for name %s", id); @@ -22,7 +22,7 @@ void surf_on_host_created(void (*callback)(sg_host_t)) void surf_on_storage_created(void (*callback)(sg_storage_t)) { - storageCreatedCallbacks.connect([callback](Storage* storage) { + simgrid::surf::storageCreatedCallbacks.connect([callback](simgrid::surf::Storage* storage) { const char* id = storage->getName(); // TODO, create sg_storage_by_name sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, id); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index f24f51f281..7aac612325 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -27,18 +27,21 @@ void surf_cpu_model_init_Cas01() return; } - surf_cpu_model_pm = new CpuCas01Model(); - surf_cpu_model_vm = new CpuCas01Model(); + surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(); + surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(); - sg_platf_postparse_add_cb(cpu_add_traces); + sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces); - Model *model_pm = surf_cpu_model_pm; - Model *model_vm = surf_cpu_model_vm; + simgrid::surf::Model *model_pm = surf_cpu_model_pm; + simgrid::surf::Model *model_vm = surf_cpu_model_vm; xbt_dynar_push(all_existing_models, &model_pm); xbt_dynar_push(all_existing_models, &model_vm); } -CpuCas01Model::CpuCas01Model() : CpuModel() +namespace simgrid { +namespace surf { + +CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel() { char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim"); int select = xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update"); @@ -369,3 +372,6 @@ CpuCas01Action::CpuCas01Action(Model *model, double cost, bool failed, double sp } lmm_expand(model->getMaxminSystem(), constraint, getVariable(), 1.0); } + +} +} diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index fb1d02b6b2..b98fd237e6 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -11,6 +11,10 @@ /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class XBT_PRIVATE CpuCas01Model; class XBT_PRIVATE CpuCas01; class XBT_PRIVATE CpuCas01Action; @@ -18,7 +22,8 @@ class XBT_PRIVATE CpuCas01Action; /********* * Model * *********/ -class CpuCas01Model : public CpuModel { + +class CpuCas01Model : public simgrid::surf::CpuModel { public: CpuCas01Model(); ~CpuCas01Model(); @@ -83,3 +88,6 @@ public: ~CpuCas01Action() {}; }; + +} +} diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index bc366f94be..2b7c2e321e 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -14,8 +14,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, int autoload_surf_cpu_model = 1; void_f_void_t surf_cpu_model_init_preparse = NULL; -CpuModel *surf_cpu_model_pm; -CpuModel *surf_cpu_model_vm; +simgrid::surf::CpuModel *surf_cpu_model_pm; +simgrid::surf::CpuModel *surf_cpu_model_vm; + +namespace simgrid { +namespace surf { + /************* * Callbacks * *************/ @@ -30,7 +34,6 @@ surf_callback(void, Cpu*) cpuCreatedCallbacks; surf_callback(void, Cpu*) cpuDestructedCallbacks; surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks; surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks; - void cpu_add_traces(){ surf_cpu_model_pm->addTraces(); } @@ -38,6 +41,7 @@ void cpu_add_traces(){ /********* * Model * *********/ + void CpuModel::updateActionsStateLazy(double now, double /*delta*/) { CpuAction *action; @@ -128,7 +132,6 @@ void CpuModel::updateActionsStateFull(double now, double delta) /************ * Resource * ************/ - Cpu::Cpu(){ } @@ -328,3 +331,6 @@ void CpuAction::setState(e_surf_action_state_t state){ Action::setState(state); surf_callback_emit(cpuActionStateChangedCallbacks, this, old, state); } + +} +} diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 4e9e97f09d..590b798519 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -13,6 +13,10 @@ /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class CpuModel; class Cpu; class CpuAction; @@ -94,7 +98,7 @@ public: * @brief SURF cpu resource interface class * @details A Cpu represent a cpu associated to a host */ -XBT_PUBLIC_CLASS Cpu : public Resource { +XBT_PUBLIC_CLASS Cpu : public simgrid::surf::Resource { public: Cpu(); @@ -110,7 +114,7 @@ public: * @param speedScale The speed scale of this Cpu in [0;1] (available amount) * @param stateInitial whether it is created running or crashed */ - Cpu(Model *model, const char *name, xbt_dict_t props, + Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); @@ -125,13 +129,13 @@ public: * @param speedScale The speed scale of this Cpu in [0;1] (available amount) * @param stateInitial whether it is created running or crashed */ - Cpu(Model *model, const char *name, xbt_dict_t props, + Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props, int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); - Cpu(Model *model, const char *name, xbt_dict_t props, + Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, int core, double speedPeak, double speedScale); - Cpu(Model *model, const char *name, xbt_dict_t props, + Cpu(simgrid::surf::Model *model, const char *name, xbt_dict_t props, int core, double speedPeak, double speedScale); ~Cpu(); @@ -142,7 +146,7 @@ public: * @param size The value of the processing amount (in flop) needed to process * @return The CpuAction corresponding to the processing */ - virtual Action *execute(double size)=0; + virtual simgrid::surf::Action *execute(double size)=0; /** * @brief Make a process sleep for duration (in seconds) @@ -150,7 +154,7 @@ public: * @param duration The number of seconds to sleep * @return The CpuAction corresponding to the sleeping */ - virtual Action *sleep(double duration)=0; + virtual simgrid::surf::Action *sleep(double duration)=0; /** @brief Get the amount of cores */ virtual int getCore(); @@ -190,15 +194,15 @@ public: * @brief SURF Cpu action interface class * @details A CpuAction represent the execution of code on a Cpu */ -XBT_PUBLIC_CLASS CpuAction : public Action { +XBT_PUBLIC_CLASS CpuAction : public simgrid::surf::Action { friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action); public: /** @brief CpuAction constructor */ - CpuAction(Model *model, double cost, bool failed) + CpuAction(simgrid::surf::Model *model, double cost, bool failed) : Action(model, cost, failed) {} //FIXME:REMOVE /** @brief CpuAction constructor */ - CpuAction(Model *model, double cost, bool failed, lmm_variable_t var) + CpuAction(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) : Action(model, cost, failed, var) {} /** @@ -213,4 +217,7 @@ public: }; +} +} + #endif /* SURF_CPU_INTERFACE_HPP_ */ diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 3e2d91be93..0eeb532ce1 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -14,7 +14,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf_cpu, "Logging specific to the SURF CPU TRACE INTEGRATION module"); -static void cpu_ti_action_update_index_heap(void *action, int i); +namespace simgrid { +namespace surf { + +static inline +void cpu_ti_action_update_index_heap(void *action, int i) +{ + ((simgrid::surf::CpuTiAction*)action)->updateIndexHeap(i); +} /********* * Trace * @@ -375,13 +382,16 @@ int CpuTiTrace::binarySearch(double *array, double a, int low, int high) return low; } +} +} + /************* * CallBacks * *************/ static void cpu_ti_define_callbacks() { - sg_platf_postparse_add_cb(cpu_add_traces); + sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces); } /********* @@ -393,16 +403,19 @@ void surf_cpu_model_init_ti() xbt_assert(!surf_cpu_model_pm,"CPU model already initialized. This should not happen."); xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen."); - surf_cpu_model_pm = new CpuTiModel(); - surf_cpu_model_vm = new CpuTiModel(); + surf_cpu_model_pm = new simgrid::surf::CpuTiModel(); + surf_cpu_model_vm = new simgrid::surf::CpuTiModel(); cpu_ti_define_callbacks(); - Model *model_pm = static_cast(surf_cpu_model_pm); - Model *model_vm = static_cast(surf_cpu_model_vm); + simgrid::surf::Model *model_pm = static_cast(surf_cpu_model_pm); + simgrid::surf::Model *model_vm = static_cast(surf_cpu_model_vm); xbt_dynar_push(all_existing_models, &model_pm); xbt_dynar_push(all_existing_models, &model_vm); } +namespace simgrid { +namespace surf { + CpuTiModel::CpuTiModel() : CpuModel() { p_runningActionSetThatDoesNotNeedBeingChecked = new ActionList(); @@ -844,11 +857,6 @@ void CpuTi::modified(bool modified){ * Action * **********/ -static void cpu_ti_action_update_index_heap(void *action, int i) -{ -((CpuTiAction*)action)->updateIndexHeap(i); -} - CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cpu) : CpuAction(model_, cost, failed) @@ -965,5 +973,8 @@ double CpuTiAction::getRemains() return m_remains; } +} +} + #endif /* SURF_MODEL_CPUTI_H_ */ diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 0196d91788..75ffbf40e8 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -13,6 +13,9 @@ /* Epsilon */ #define EPSILON 0.000000001 +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -173,10 +176,13 @@ public: xbt_heap_t p_tiActionHeap; protected: - void NotifyResourceTurnedOn(Resource*){}; - void NotifyResourceTurnedOff(Resource*){}; + void NotifyResourceTurnedOn(simgrid::surf::Resource*){}; + void NotifyResourceTurnedOff(simgrid::surf::Resource*){}; void NotifyActionCancel(Action*){}; void NotifyActionResume(Action*){}; void NotifyActionSuspend(Action*){}; }; + +} +} diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index e7151dbfcc..3850c8bc0c 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -26,12 +26,12 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host); void surf_host_model_init_current_default(void) { - surf_host_model = new HostCLM03Model(); + surf_host_model = new simgrid::surf::HostCLM03Model(); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes"); surf_cpu_model_init_Cas01(); surf_network_model_init_LegrandVelho(); - Model *model = surf_host_model; + simgrid::surf::Model *model = surf_host_model; xbt_dynar_push(all_existing_models, &model); } @@ -40,12 +40,15 @@ void surf_host_model_init_compound() xbt_assert(surf_cpu_model_pm, "No CPU model defined yet!"); xbt_assert(surf_network_model, "No network model defined yet!"); - surf_host_model = new HostCLM03Model(); + surf_host_model = new simgrid::surf::HostCLM03Model(); xbt_dynar_push(all_existing_models, &surf_host_model); } +namespace simgrid { +namespace surf { + Host *HostCLM03Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu){ - Host *host = new HostCLM03(surf_host_model, name, NULL, + Host *host = new simgrid::surf::HostCLM03(surf_host_model, name, NULL, (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL), netElm, cpu); surf_callback_emit(hostCreatedCallbacks, host); @@ -149,3 +152,6 @@ e_surf_resource_state_t HostCLM03::getState() { /********** * Action * **********/ + +} +} diff --git a/src/surf/host_clm03.hpp b/src/surf/host_clm03.hpp index 6b6166ceab..ea0218b88d 100644 --- a/src/surf/host_clm03.hpp +++ b/src/surf/host_clm03.hpp @@ -18,6 +18,9 @@ * Classes * ***********/ +namespace simgrid { +namespace surf { + class XBT_PRIVATE HostCLM03Model; class XBT_PRIVATE HostCLM03; class XBT_PRIVATE HostCLM03Action; @@ -66,6 +69,7 @@ public: * Action * **********/ - +} +} #endif /* SURF_HOST_CLM03_HPP_ */ diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index 7ed5f057bd..737583bcee 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -16,24 +16,28 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf, "Logging specific to the SURF host module"); -HostModel *surf_host_model = NULL; +simgrid::surf::HostModel *surf_host_model = NULL; + +void host_add_traces(){ + surf_host_model->addTraces(); +} /************* * Callbacks * *************/ -surf_callback(void, Host*) hostCreatedCallbacks; -surf_callback(void, Host*) hostDestructedCallbacks; -surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks; -surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks; - -void host_add_traces(){ - surf_host_model->addTraces(); -} +namespace simgrid { +namespace surf { + +surf_callback(void, simgrid::surf::Host*) hostCreatedCallbacks; +surf_callback(void, simgrid::surf::Host*) hostDestructedCallbacks; +surf_callback(void, simgrid::surf::Host*, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks; +surf_callback(void, simgrid::surf::HostAction*, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks; /********* * Model * *********/ + /* Each VM has a dummy CPU action on the PM layer. This CPU action works as the * constraint (capacity) of the VM in the PM layer. If the VM does not have any * active task, the dummy CPU action must be deactivated, so that the VM does @@ -72,7 +76,7 @@ void HostModel::adjustWeightOfDummyCpuActions() /************ * Resource * ************/ -Host::Host(Model *model, const char *name, xbt_dict_t props, +Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu) : Resource(model, name, props) , p_storage(storage), p_netElm(netElm), p_cpu(cpu) @@ -80,7 +84,7 @@ Host::Host(Model *model, const char *name, xbt_dict_t props, p_params.ramsize = 0; } -Host::Host(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, +Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu) : Resource(model, name, props, constraint) , p_storage(storage), p_netElm(netElm), p_cpu(cpu) @@ -104,9 +108,9 @@ xbt_dict_t Host::getProperties() return p_cpu->getProperties(); } -Storage *Host::findStorageOnMountList(const char* mount) +simgrid::surf::Storage *Host::findStorageOnMountList(const char* mount) { - Storage *st = NULL; + simgrid::surf::Storage *st = NULL; s_mount_t mnt; unsigned int cursor; @@ -115,7 +119,7 @@ Storage *Host::findStorageOnMountList(const char* mount) { XBT_DEBUG("See '%s'",mnt.name); if(!strcmp(mount,mnt.name)){ - st = static_cast(mnt.storage); + st = static_cast(mnt.storage); break; } } @@ -131,7 +135,7 @@ xbt_dict_t Host::getMountedStorageList() char *storage_name = NULL; xbt_dynar_foreach(p_storage,i,mnt){ - storage_name = (char *)static_cast(mnt.storage)->getName(); + storage_name = (char *)static_cast(mnt.storage)->getName(); xbt_dict_set(storage_list,mnt.name,storage_name,NULL); } return storage_list; @@ -145,7 +149,7 @@ xbt_dynar_t Host::getAttachedStorageList() xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL); xbt_lib_foreach(storage_lib, cursor, key, data) { if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) { - Storage *storage = static_cast(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL)); + simgrid::surf::Storage *storage = static_cast(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL)); if(!strcmp((const char*)storage->p_attach,this->getName())){ xbt_dynar_push_as(result, void *, (void*)storage->getName()); } @@ -156,7 +160,7 @@ xbt_dynar_t Host::getAttachedStorageList() Action *Host::open(const char* fullpath) { - Storage *st = NULL; + simgrid::surf::Storage *st = NULL; s_mount_t mnt; unsigned int cursor; size_t longest_prefix_length = 0; @@ -175,7 +179,7 @@ Action *Host::open(const char* fullpath) { if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>longest_prefix_length) {/* The current mount name is found in the full path and is bigger than the previous*/ longest_prefix_length = strlen(mnt.name); - st = static_cast(mnt.storage); + st = static_cast(mnt.storage); } free(file_mount_name); } @@ -199,19 +203,19 @@ Action *Host::open(const char* fullpath) { } Action *Host::close(surf_file_t fd) { - Storage *st = findStorageOnMountList(fd->mount); + simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName()); return st->close(fd); } Action *Host::read(surf_file_t fd, sg_size_t size) { - Storage *st = findStorageOnMountList(fd->mount); + simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName()); return st->read(fd, size); } Action *Host::write(surf_file_t fd, sg_size_t size) { - Storage *st = findStorageOnMountList(fd->mount); + simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName()); return st->write(fd, size); } @@ -222,7 +226,7 @@ int Host::unlink(surf_file_t fd) { return -1; } else { - Storage *st = findStorageOnMountList(fd->mount); + simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); /* Check if the file is on this storage */ if (!xbt_dict_get_or_null(st->p_content, fd->name)){ XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name, @@ -249,7 +253,7 @@ sg_size_t Host::getSize(surf_file_t fd){ xbt_dynar_t Host::getInfo( surf_file_t fd) { - Storage *st = findStorageOnMountList(fd->mount); + simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); sg_size_t *psize = xbt_new(sg_size_t, 1); *psize = fd->size; xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL); @@ -315,14 +319,14 @@ int Host::fileMove(surf_file_t fd, const char* fullpath){ xbt_dynar_t Host::getVms() { - xbt_dynar_t dyn = xbt_dynar_new(sizeof(VirtualMachine*), NULL); + xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), NULL); /* iterate for all virtual machines */ - for (VMModel::vm_list_t::iterator iter = - VMModel::ws_vms.begin(); - iter != VMModel::ws_vms.end(); ++iter) { + for (simgrid::surf::VMModel::vm_list_t::iterator iter = + simgrid::surf::VMModel::ws_vms.begin(); + iter != simgrid::surf::VMModel::ws_vms.end(); ++iter) { - VirtualMachine *ws_vm = &*iter; + simgrid::surf::VirtualMachine *ws_vm = &*iter; if (this == ws_vm->p_subWs) xbt_dynar_push(dyn, &ws_vm); } @@ -350,3 +354,6 @@ void HostAction::setState(e_surf_action_state_t state){ Action::setState(state); surf_callback_emit(hostActionStateChangedCallbacks, this, old, state); } + +} +} diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index 978ed351b5..e0ec337a7f 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -18,6 +18,9 @@ * Classes * ***********/ +namespace simgrid { +namespace surf { + class XBT_PRIVATE HostModel; class XBT_PRIVATE Host; class XBT_PRIVATE HostAction; @@ -46,15 +49,22 @@ XBT_PUBLIC_DATA(surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resou */ XBT_PUBLIC_DATA(surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t)) hostActionStateChangedCallbacks; +} +} + /********* * Tools * *********/ -XBT_PUBLIC_DATA(HostModel*) surf_host_model; +XBT_PUBLIC_DATA(simgrid::surf::HostModel*) surf_host_model; XBT_PUBLIC(void) host_add_traces(); /********* * Model * *********/ + +namespace simgrid { +namespace surf { + /** @ingroup SURF_host_interface * @brief SURF Host model interface class * @details A model is an object which handle the interactions between its Resources and its Actions @@ -84,7 +94,7 @@ public: * @brief SURF Host interface class * @details An host represents a machine with a aggregation of a Cpu, a Link and a Storage */ -class Host : public Resource { +class Host : public simgrid::surf::Resource { public: /** * @brief Host constructor @@ -96,7 +106,7 @@ public: * @param netElm The RoutingEdge associated to this Host * @param cpu The Cpu associated to this Host */ - Host(Model *model, const char *name, xbt_dict_t props, + Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu); /** @@ -110,7 +120,7 @@ public: * @param netElm The RoutingEdge associated to this Host * @param cpu The Cpu associated to this Host */ - Host(Model *model, const char *name, xbt_dict_t props, + Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu); @@ -145,7 +155,7 @@ public: virtual Action *sleep(double duration)=0; /** @brief Return the storage of corresponding mount point */ - virtual Storage *findStorageOnMountList(const char* storage); + virtual simgrid::surf::Storage *findStorageOnMountList(const char* storage); /** @brief Get the xbt_dict_t of mount_point: Storage */ virtual xbt_dict_t getMountedStorageList(); @@ -285,7 +295,7 @@ public: * @param cost The cost of this HostAction in [TODO] * @param failed [description] */ - HostAction(Model *model, double cost, bool failed) + HostAction(simgrid::surf::Model *model, double cost, bool failed) : Action(model, cost, failed) {} /** @@ -296,11 +306,13 @@ public: * @param failed [description] * @param var The lmm variable associated to this StorageAction if it is part of a LMM component */ - HostAction(Model *model, double cost, bool failed, lmm_variable_t var) + HostAction(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) : Action(model, cost, failed, var) {} void setState(e_surf_action_state_t state); }; +} +} #endif /* SURF_Host_INTERFACE_HPP_ */ diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 57367bb78f..d6d022a7d6 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -41,12 +41,15 @@ void surf_host_model_init_ptask_L07(void) sg_platf_link_add_cb(ptask_netlink_parse_init); sg_platf_postparse_add_cb(host_add_traces); - surf_host_model = new HostL07Model(); - Model *model = surf_host_model; + surf_host_model = new simgrid::surf::HostL07Model(); + simgrid::surf::Model *model = surf_host_model; xbt_dynar_push(all_existing_models, &model); } +namespace simgrid { +namespace surf { + HostL07Model::HostL07Model() : HostModel() { if (!ptask_maxmin_system) ptask_maxmin_system = lmm_system_new(1); @@ -670,3 +673,6 @@ double L07Action::getRemains() XBT_OUT(); return m_remains; } + +} +} diff --git a/src/surf/host_ptask_L07.hpp b/src/surf/host_ptask_L07.hpp index 60454c9f74..b4c550916a 100644 --- a/src/surf/host_ptask_L07.hpp +++ b/src/surf/host_ptask_L07.hpp @@ -15,6 +15,9 @@ #ifndef HOST_L07_HPP_ #define HOST_L07_HPP_ +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -181,4 +184,7 @@ public: double m_rate; }; +} +} + #endif /* HOST_L07_HPP_ */ diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 57507b9b97..3af832b7a0 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -677,7 +677,7 @@ void lmm_solve(lmm_system_t sys) cnst->usage = elem->value / elem->variable->weight; make_elem_active(elem); - Action *action = static_cast(elem->variable->id); + simgrid::surf::Action *action = static_cast(elem->variable->id); if (sys->keep_track && !action->is_linked()) sys->keep_track->push_back(*action); } diff --git a/src/surf/maxmin_private.hpp b/src/surf/maxmin_private.hpp index b08682769c..bccc21780a 100644 --- a/src/surf/maxmin_private.hpp +++ b/src/surf/maxmin_private.hpp @@ -99,7 +99,7 @@ typedef struct lmm_system { s_xbt_swag_t saturated_variable_set; /* a list of lmm_variable_t */ s_xbt_swag_t saturated_constraint_set; /* a list of lmm_constraint_t_t */ - ActionLmmListPtr keep_track; + simgrid::surf::ActionLmmListPtr keep_track; xbt_mallocator_t variable_mallocator; } s_lmm_system_t; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 50fb7bee7c..2002616db7 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -54,9 +54,9 @@ void surf_network_model_init_LegrandVelho(void) if (surf_network_model) return; - surf_network_model = new NetworkCm02Model(); + surf_network_model = new simgrid::surf::NetworkCm02Model(); net_define_callbacks(); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", @@ -83,9 +83,9 @@ void surf_network_model_init_CM02(void) if (surf_network_model) return; - surf_network_model = new NetworkCm02Model(); + surf_network_model = new simgrid::surf::NetworkCm02Model(); net_define_callbacks(); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0); @@ -109,9 +109,9 @@ void surf_network_model_init_Reno(void) if (surf_network_model) return; - surf_network_model = new NetworkCm02Model(); + surf_network_model = new simgrid::surf::NetworkCm02Model(); net_define_callbacks(); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi); @@ -129,9 +129,9 @@ void surf_network_model_init_Reno2(void) if (surf_network_model) return; - surf_network_model = new NetworkCm02Model(); + surf_network_model = new simgrid::surf::NetworkCm02Model(); net_define_callbacks(); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi); @@ -149,9 +149,9 @@ void surf_network_model_init_Vegas(void) if (surf_network_model) return; - surf_network_model = new NetworkCm02Model(); + surf_network_model = new simgrid::surf::NetworkCm02Model(); net_define_callbacks(); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi); @@ -163,6 +163,9 @@ void surf_network_model_init_Vegas(void) xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } +namespace simgrid { +namespace surf { + NetworkCm02Model::NetworkCm02Model() :NetworkModel() { @@ -695,3 +698,5 @@ void NetworkCm02Action::updateRemainingLazy(double now) m_lastValue = lmm_variable_getvalue(getVariable()); } +} +} diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index dc691d0917..e164901567 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -13,13 +13,22 @@ #include "xbt/fifo.h" #include "xbt/graph.h" + + /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class XBT_PRIVATE NetworkCm02Model; class XBT_PRIVATE NetworkCm02Action; class XBT_PRIVATE NetworkSmpiModel; +} +} + /********* * Tools * *********/ @@ -29,6 +38,10 @@ XBT_PRIVATE void net_define_callbacks(void); /********* * Model * *********/ + +namespace simgrid { +namespace surf { + class NetworkCm02Model : public NetworkModel { private: void initialize(); @@ -96,4 +109,7 @@ protected: double m_senderGap; }; +} +} + #endif /* SURF_NETWORK_CM02_HPP_ */ diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index b9c0d76ebc..b9be1fd2ca 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -23,19 +23,22 @@ static void netcste_parse_nolink(sg_platf_link_cbarg_t link){ void surf_network_model_init_Constant() { xbt_assert(surf_network_model == NULL); - surf_network_model = new NetworkConstantModel(); + surf_network_model = new simgrid::surf::NetworkConstantModel(); routing_model_create(NULL); - hostCreatedCallbacks.connect([](Host*) { + simgrid::surf::hostCreatedCallbacks.connect([](simgrid::surf::Host*) { host_number_int++; }); sg_platf_link_add_cb(netcste_parse_nolink); - Model *model = surf_network_model; + simgrid::surf::Model *model = surf_network_model; xbt_dynar_push(all_existing_models, &model); } +namespace simgrid { +namespace surf { + double NetworkConstantModel::shareResources(double /*now*/) { NetworkConstantAction *action = NULL; @@ -138,3 +141,5 @@ bool NetworkConstantAction::isSuspended() return m_suspended; } +} +} diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index ad400846c6..b79c6a5973 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -11,9 +11,13 @@ #include "network_interface.hpp" +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ + class XBT_PRIVATE NetworkConstantModel; class XBT_PRIVATE NetworkConstantAction; @@ -69,4 +73,7 @@ public: int m_suspended; }; +} +} + #endif /* NETWORK_CONSTANT_HPP_ */ diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 4e51c2b2df..6c7bec7220 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -14,7 +14,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); -static void IB_create_host_callback(Host* host){ +static void IB_create_host_callback(simgrid::surf::Host* host){ + using namespace simgrid::surf; static int id=0; // pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives @@ -29,7 +30,11 @@ static void IB_create_host_callback(Host* host){ } -static void IB_action_state_changed_callback(NetworkAction *action, e_surf_action_state_t statein, e_surf_action_state_t stateout){ +static void IB_action_state_changed_callback( + simgrid::surf::NetworkAction *action, + e_surf_action_state_t statein, e_surf_action_state_t stateout) +{ + using namespace simgrid::surf; if(statein!=SURF_ACTION_RUNNING|| stateout!=SURF_ACTION_DONE) return; std::pair pair = ((NetworkIBModel*)surf_network_model)->active_comms[action]; @@ -42,7 +47,11 @@ static void IB_action_state_changed_callback(NetworkAction *action, e_surf_actio } -static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, RoutingEdge *dst, double size, double rate){ +static void IB_action_init_callback( + simgrid::surf::NetworkAction *action, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, + double size, double rate) +{ + using namespace simgrid::surf; if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL) xbt_die("IB comm added, without any node connected !"); @@ -64,8 +73,6 @@ static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, Rout } - - /********* * Model * *********/ @@ -82,20 +89,28 @@ static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, Rout /* } */ void surf_network_model_init_IB(void) { + using simgrid::surf::networkActionStateChangedCallbacks; + using simgrid::surf::networkCommunicateCallbacks; + using simgrid::surf::hostCreatedCallbacks; if (surf_network_model) return; - surf_network_model = new NetworkIBModel(); + surf_network_model = new simgrid::surf::NetworkIBModel(); net_define_callbacks(); xbt_dynar_push(all_existing_models, &surf_network_model); - surf_callback_connect(networkActionStateChangedCallbacks, IB_action_state_changed_callback); - surf_callback_connect(networkCommunicateCallbacks, IB_action_init_callback); + surf_callback_connect(networkActionStateChangedCallbacks, + IB_action_state_changed_callback); + surf_callback_connect(networkCommunicateCallbacks, + IB_action_init_callback); hostCreatedCallbacks.connect(IB_create_host_callback); xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } +namespace simgrid { +namespace surf { + NetworkIBModel::NetworkIBModel() : NetworkSmpiModel() { m_haveGap=false; @@ -229,3 +244,6 @@ void NetworkIBModel::updateIBfactors(NetworkAction *action, IBNode *from, IBNode delete comm; xbt_free(updated); } + +} +} diff --git a/src/surf/network_ib.hpp b/src/surf/network_ib.hpp index 26a27eaf46..553f9419e9 100644 --- a/src/surf/network_ib.hpp +++ b/src/surf/network_ib.hpp @@ -10,6 +10,10 @@ #include #include "network_smpi.hpp" + +namespace simgrid { +namespace surf { + class XBT_PRIVATE IBNode; class XBT_PRIVATE ActiveComm{ @@ -54,4 +58,7 @@ public: }; +} +} + #endif diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index b64761a91c..14bd060176 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -18,7 +18,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, /********* * C API * *********/ -SG_BEGIN_DECL() + +extern "C" { + const char* sg_link_name(Link *link) { return link->getName(); } @@ -50,11 +52,16 @@ Link** sg_link_list(void) { void sg_link_exit(void) { Link::linksExit(); } -SG_END_DECL() + +} + /***************** * List of links * *****************/ +namespace simgrid { +namespace surf { + boost::unordered_map *Link::links = new boost::unordered_map(); Link *Link::byName(const char* name) { Link * res = NULL; @@ -83,15 +90,19 @@ void Link::linksExit() { delete (kv.second); delete links; } + /************* * Callbacks * *************/ -surf_callback(void, Link*) networkLinkCreatedCallbacks; -surf_callback(void, Link*) networkLinkDestructedCallbacks; -surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks; -surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks; -surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate) networkCommunicateCallbacks; +surf_callback(void, simgrid::surf::Link*) networkLinkCreatedCallbacks; +surf_callback(void, simgrid::surf::Link*) networkLinkDestructedCallbacks; +surf_callback(void, simgrid::surf::Link*, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks; +surf_callback(void, simgrid::surf::NetworkAction*, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks; +surf_callback(void, simgrid::surf::NetworkAction*, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, double size, double rate) networkCommunicateCallbacks; + +} +} void netlink_parse_init(sg_platf_link_cbarg_t link){ if (link->policy == SURF_LINK_FULLDUPLEX) { @@ -133,7 +144,10 @@ void net_add_traces(){ * Model * *********/ -NetworkModel *surf_network_model = NULL; +simgrid::surf::NetworkModel *surf_network_model = NULL; + +namespace simgrid { +namespace surf { double NetworkModel::latencyFactor(double /*size*/) { return sg_latency_factor; @@ -179,7 +193,7 @@ double NetworkModel::shareResourcesFull(double now) * Resource * ************/ -Link::Link(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) { links->insert({name, this}); @@ -187,7 +201,7 @@ Link::Link(NetworkModel *model, const char *name, xbt_dict_t props) XBT_DEBUG("Create link '%s'",name); } -Link::Link(NetworkModel *model, const char *name, xbt_dict_t props, +Link::Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, tmgr_history_t history, tmgr_trace_t state_trace) @@ -232,8 +246,6 @@ void Link::setState(e_surf_resource_state_t state){ surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state); } - - /********** * Action * **********/ @@ -244,4 +256,7 @@ void NetworkAction::setState(e_surf_action_state_t state){ surf_callback_emit(networkActionStateChangedCallbacks, this, old, state); } +} +} + #endif /* NETWORK_INTERFACE_CPP_ */ diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index d1f327dd34..0bbd3dab2c 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -21,6 +21,10 @@ /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class NetworkModel; class NetworkAction; @@ -32,31 +36,34 @@ class NetworkAction; * @brief Callbacks handler which emits the callbacks after Link creation * @details Callback functions have the following signature: `void(Link*)` */ -XBT_PUBLIC_DATA( surf_callback(void, Link*)) networkLinkCreatedCallbacks; +XBT_PUBLIC_DATA( surf_callback(void, simgrid::surf::Link*)) networkLinkCreatedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emits the callbacks after Link destruction * @details Callback functions have the following signature: `void(Link*)` */ -XBT_PUBLIC_DATA( surf_callback(void, Link*)) networkLinkDestructedCallbacks; +XBT_PUBLIC_DATA( surf_callback(void, simgrid::surf::Link*)) networkLinkDestructedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emits the callbacks after Link State changed * @details Callback functions have the following signature: `void(LinkAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)` */ -XBT_PUBLIC_DATA( surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks; +XBT_PUBLIC_DATA( surf_callback(void, simgrid::surf::Link*, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emits the callbacks after NetworkAction State changed * @details Callback functions have the following signature: `void(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t current)` */ -XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks; +XBT_PUBLIC_DATA( surf_callback(void, simgrid::surf::NetworkAction*, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emits the callbacks after communication created * @details Callback functions have the following signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate)` */ -XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate)) networkCommunicateCallbacks; +XBT_PUBLIC_DATA( surf_callback(void, simgrid::surf::NetworkAction*, simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, double size, double rate)) networkCommunicateCallbacks; + +} +} /********* * Tools * @@ -68,6 +75,10 @@ XBT_PUBLIC(void) net_add_traces(); /********* * Model * *********/ + +namespace simgrid { +namespace surf { + /** @ingroup SURF_network_interface * @brief SURF network model interface class * @details A model is an object which handles the interactions between its Resources and its Actions @@ -176,7 +187,7 @@ public: * @brief SURF network link interface class * @details A Link represents the link between two [hosts](\ref Host) */ -class Link : public Resource { +class Link : public simgrid::surf::Resource { public: /** * @brief Link constructor @@ -185,7 +196,7 @@ public: * @param name The name of the Link * @param props Dictionary of properties associated to this Link */ - Link(NetworkModel *model, const char *name, xbt_dict_t props); + Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props); /** * @brief Link constructor @@ -197,7 +208,7 @@ public: * @param history [TODO] * @param state_trace [TODO] */ - Link(NetworkModel *model, const char *name, xbt_dict_t props, + Link(simgrid::surf::NetworkModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, tmgr_history_t history, tmgr_trace_t state_trace); @@ -258,7 +269,7 @@ public: * @brief SURF network action interface class * @details A NetworkAction represents a communication between two [hosts](\ref Host) */ -class NetworkAction : public Action { +class NetworkAction : public simgrid::surf::Action { public: /** @brief Constructor * @@ -266,8 +277,8 @@ public: * @param cost The cost of this NetworkAction in [TODO] * @param failed [description] */ - NetworkAction(Model *model, double cost, bool failed) - : Action(model, cost, failed) {} + NetworkAction(simgrid::surf::Model *model, double cost, bool failed) + : simgrid::surf::Action(model, cost, failed) {} /** * @brief NetworkAction constructor @@ -278,8 +289,8 @@ public: * @param var The lmm variable associated to this Action if it is part of a * LMM component */ - NetworkAction(Model *model, double cost, bool failed, lmm_variable_t var) - : Action(model, cost, failed, var) {}; + NetworkAction(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) + : simgrid::surf::Action(model, cost, failed, var) {}; void setState(e_surf_action_state_t state); @@ -305,6 +316,9 @@ public: }; +} +} + #endif /* SURF_NETWORK_INTERFACE_HPP_ */ diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 56361f7d8c..fc3cb25fd9 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -40,7 +40,7 @@ static void replace_lat_ns3(char ** lat) xbt_free(temp); } -static void simgrid_ns3_add_host(Host* host) +static void simgrid_ns3_add_host(simgrid::surf::Host* host) { const char* id = host->getName(); XBT_DEBUG("NS3_ADD_HOST '%s'", id); @@ -68,7 +68,7 @@ static void parse_ns3_add_link(sg_platf_link_cbarg_t link) link->properties); } -static void simgrid_ns3_add_router(RoutingEdge* router) +static void simgrid_ns3_add_router(simgrid::surf::RoutingEdge* router) { const char* router_id = router->getName(); XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id); @@ -79,7 +79,7 @@ static void simgrid_ns3_add_router(RoutingEdge* router) ); } -static void parse_ns3_add_AS(As* as) +static void parse_ns3_add_AS(simgrid::surf::As* as) { const char* as_id = as->p_name; XBT_DEBUG("NS3_ADD_AS '%s'", as_id); @@ -198,12 +198,13 @@ static void create_ns3_topology(void) xbt_die("There is no routes!"); XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used); //save them in trace file - Onelink *onelink; + simgrid::surf::Onelink *onelink; unsigned int iter; xbt_dynar_foreach(onelink_routes, iter, onelink) { char *src = onelink->p_src->getName(); char *dst = onelink->p_dst->getName(); - NetworkNS3Link *link = static_cast(onelink->p_link); + simgrid::surf::NetworkNS3Link *link = + static_cast(onelink->p_link); if (strcmp(src,dst) && link->m_created){ XBT_DEBUG("Route from '%s' to '%s' with link '%s'", src, dst, link->getName()); @@ -240,13 +241,11 @@ static void parse_ns3_end_platform(void) static void define_callbacks_ns3(void) { - hostCreatedCallbacks.connect(simgrid_ns3_add_host); - routingEdgeCreatedCallbacks.connect(simgrid_ns3_add_router); + simgrid::surf::hostCreatedCallbacks.connect(simgrid_ns3_add_host); + simgrid::surf::routingEdgeCreatedCallbacks.connect(simgrid_ns3_add_router); sg_platf_link_add_cb (&parse_ns3_add_link); sg_platf_cluster_add_cb (&parse_ns3_add_cluster); - - asCreatedCallbacks.connect(parse_ns3_add_AS); - + simgrid::surf::asCreatedCallbacks.connect(parse_ns3_add_AS); sg_platf_postparse_add_cb(&create_ns3_topology); //get_one_link_routes sg_platf_postparse_add_cb(&parse_ns3_end_platform); //InitializeRoutes } @@ -256,7 +255,7 @@ static void define_callbacks_ns3(void) *********/ static void free_ns3_link(void * elmts) { - delete static_cast(elmts); + delete static_cast(elmts); } static void free_ns3_host(void * elmts) @@ -270,11 +269,14 @@ void surf_network_model_init_NS3() if (surf_network_model) return; - surf_network_model = new NetworkNS3Model(); + surf_network_model = new simgrid::surf::NetworkNS3Model(); xbt_dynar_push(all_existing_models, &surf_network_model); } +namespace simgrid { +namespace surf { + NetworkNS3Model::NetworkNS3Model() : NetworkModel() { if (ns3_initialize(xbt_cfg_get_string(_sg_cfg_set, "ns3/TcpModel"))) { xbt_die("Impossible to initialize NS3 interface"); @@ -483,3 +485,6 @@ int NetworkNS3Action::unref() } return 0; } + +} +} diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 686feeecf8..1923e55e5c 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -15,9 +15,16 @@ /*********** * Classes * ***********/ + +namespace simgrid { +namespace surf { + class XBT_PRIVATE NetworkNS3Model; class XBT_PRIVATE NetworkNS3Action; +} +} + /********* * Tools * *********/ @@ -28,6 +35,9 @@ XBT_PRIVATE void net_define_callbacks(void); * Model * *********/ +namespace simgrid { +namespace surf { + class NetworkNS3Model : public NetworkModel { public: NetworkNS3Model(); @@ -95,5 +105,7 @@ void resume(); RoutingEdge *p_dstElm; }; +} +} #endif /* NETWORK_NS3_HPP_ */ diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index c30c13fd2c..c0d682f238 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -83,7 +83,7 @@ void surf_network_model_init_SMPI(void) if (surf_network_model) return; - surf_network_model = new NetworkSmpiModel(); + surf_network_model = new simgrid::surf::NetworkSmpiModel(); net_define_callbacks(); xbt_dynar_push(all_existing_models, &surf_network_model); @@ -91,6 +91,9 @@ void surf_network_model_init_SMPI(void) xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } +namespace simgrid { +namespace surf { + NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model() { m_haveGap=true; @@ -226,3 +229,6 @@ double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double s /********** * Action * **********/ + +} +} diff --git a/src/surf/network_smpi.hpp b/src/surf/network_smpi.hpp index 0c02b26ef3..30cf4eefa1 100644 --- a/src/surf/network_smpi.hpp +++ b/src/surf/network_smpi.hpp @@ -8,6 +8,9 @@ #include "network_cm02.hpp" +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -46,4 +49,5 @@ public: * Action * **********/ - +} +} diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 87bd154583..8fed9f5c82 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -50,21 +50,30 @@ and then use the following function to retrieve the consumption of a given host: XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_energy, surf, "Logging specific to the SURF energy plugin"); -std::map *surf_energy=NULL; +namespace simgrid { +namespace energy { -static void energyHostCreatedCallback(Host *host){ +std::map *surf_energy = NULL; + +} +} + +using simgrid::energy::HostEnergy; +using simgrid::energy::surf_energy; + +static void energyHostCreatedCallback(simgrid::surf::Host *host){ (*surf_energy)[host] = new HostEnergy(host); } -static void energyVMCreatedCallback(VirtualMachine* vm) { - std::map::iterator host_energy_it = surf_energy->find(vm->p_subWs); +static void energyVMCreatedCallback(simgrid::surf::VirtualMachine* vm) { + std::map::iterator host_energy_it = surf_energy->find(vm->p_subWs); xbt_assert(host_energy_it != surf_energy->end(), "The host is not in surf_energy."); (*surf_energy)[vm] = host_energy_it->second; host_energy_it->second->ref(); // protect the HostEnergy from getting deleted too early } /* Computes the consumption so far. Called lazily on need. */ -static void update_consumption(Host *host, HostEnergy *host_energy) { +static void update_consumption(simgrid::surf::Host *host, HostEnergy *host_energy) { double cpu_load = lmm_constraint_get_usage(host->p_cpu->getConstraint()) / host->p_cpu->m_speedPeak; double start_time = host_energy->last_updated; double finish_time = surf_get_clock(); @@ -86,8 +95,8 @@ static void update_consumption(Host *host, HostEnergy *host_energy) { start_time, finish_time, host->p_cpu->m_speedPeak, previous_energy, energy_this_step); } -static void energyHostDestructedCallback(Host *host){ - std::map::iterator host_energy_it = surf_energy->find(host); +static void energyHostDestructedCallback(simgrid::surf::Host *host){ + std::map::iterator host_energy_it = surf_energy->find(host); xbt_assert(host_energy_it != surf_energy->end(), "The host is not in surf_energy."); HostEnergy *host_energy = host_energy_it->second; @@ -99,9 +108,11 @@ static void energyHostDestructedCallback(Host *host){ surf_energy->erase(host_energy_it); } -static void energyCpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t cur){ +static void energyCpuActionStateChangedCallback( + simgrid::surf::CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) +{ const char *name = getActionCpu(action)->getName(); - Host *host = static_cast(surf_host_resource_priv(sg_host_by_name(name))); + simgrid::surf::Host *host = static_cast(surf_host_resource_priv(sg_host_by_name(name))); HostEnergy *host_energy = (*surf_energy)[host]; @@ -109,7 +120,8 @@ static void energyCpuActionStateChangedCallback(CpuAction *action, e_surf_action update_consumption(host, host_energy); } -static void energyStateChangedCallback(Host *host, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){ +static void energyStateChangedCallback(simgrid::surf::Host *host, e_surf_resource_state_t oldState, e_surf_resource_state_t newState) +{ HostEnergy *host_energy = (*surf_energy)[host]; if(host_energy->last_updated < surf_get_clock()) @@ -127,21 +139,25 @@ static void sg_energy_plugin_exit() * \details Enable energy plugin to get joules consumption of each cpu. You should call this function before #MSG_init(). */ void sg_energy_plugin_init() { - if (surf_energy == NULL) { - surf_energy = new std::map(); - surf_callback_connect(hostCreatedCallbacks, energyHostCreatedCallback); - surf_callback_connect(VMCreatedCallbacks, energyVMCreatedCallback); - surf_callback_connect(hostDestructedCallbacks, energyHostDestructedCallback); - surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback); - surf_callback_connect(surfExitCallbacks, sg_energy_plugin_exit); - surf_callback_connect(hostStateChangedCallbacks, energyStateChangedCallback); + if (simgrid::energy::surf_energy == NULL) { + simgrid::energy::surf_energy = + new std::map(); + surf_callback_connect(simgrid::surf::hostCreatedCallbacks, energyHostCreatedCallback); + surf_callback_connect(simgrid::surf::VMCreatedCallbacks, energyVMCreatedCallback); + surf_callback_connect(simgrid::surf::hostDestructedCallbacks, energyHostDestructedCallback); + surf_callback_connect(simgrid::surf::cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback); + surf_callback_connect(simgrid::surf::surfExitCallbacks, sg_energy_plugin_exit); + surf_callback_connect(simgrid::surf::hostStateChangedCallbacks, energyStateChangedCallback); } } +namespace simgrid { +namespace energy { + /** * */ -HostEnergy::HostEnergy(Host *ptr) +HostEnergy::HostEnergy(simgrid::surf::Host *ptr) { host = ptr; total_energy = 0; @@ -170,14 +186,14 @@ HostEnergy::~HostEnergy(){ double HostEnergy::getWattMinAt(int pstate) { xbt_dynar_t power_range_list = power_range_watts_list; xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName()); - xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(host->p_cpu)->getPState(), xbt_dynar_t); + xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(host->p_cpu)->getPState(), xbt_dynar_t); double min_power = xbt_dynar_get_as(current_power_values, 0, double); return min_power; } double HostEnergy::getWattMaxAt(int pstate) { xbt_dynar_t power_range_list = power_range_watts_list; xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName()); - xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(host->p_cpu)->getPState(), xbt_dynar_t); + xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(host->p_cpu)->getPState(), xbt_dynar_t); double max_power = xbt_dynar_get_as(current_power_values, 1, double); return max_power; } @@ -192,7 +208,9 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) xbt_assert(power_range_watts_list, "No power range properties specified for host %s", host->getName()); /* retrieve the power values associated with the current pstate */ - xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(host->p_cpu)->getPState(), xbt_dynar_t); + xbt_dynar_t current_power_values = xbt_dynar_get_as( power_range_list, + static_cast(host->p_cpu)->getPState(), + xbt_dynar_t); /* min_power corresponds to the idle power (cpu load = 0) */ /* max_power is the power consumed at 100% cpu load */ @@ -261,3 +279,6 @@ xbt_dynar_t HostEnergy::getWattsRangeList() xbt_dynar_free(&all_power_values); return power_range_list; } + +} +} diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index a50a6f6e95..a1ee85cf60 100644 --- a/src/surf/plugins/energy.hpp +++ b/src/surf/plugins/energy.hpp @@ -12,13 +12,16 @@ #ifndef ENERGY_CALLBACK_HPP_ #define ENERGY_CALLBACK_HPP_ +namespace simgrid { +namespace energy { + class XBT_PRIVATE HostEnergy; -extern XBT_PRIVATE std::map *surf_energy; +extern XBT_PRIVATE std::map *surf_energy; class HostEnergy { public: - HostEnergy(Host *ptr); + HostEnergy(simgrid::surf::Host *ptr); ~HostEnergy(); double getCurrentWattsValue(double cpu_load); @@ -31,11 +34,14 @@ public: double watts_off; /*< Consumption when the machine is turned off (shutdown) */ double total_energy; /*< Total energy consumed by the host */ double last_updated; /*< Timestamp of the last energy update event*/ - Host *host; + simgrid::surf::Host *host; void unref() {if (--refcount == 0) delete this;} void ref() {refcount++;} int refcount = 1; }; +} +} + #endif /* ENERGY_CALLBACK_HPP_ */ diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index e96281d6bf..206a1ee60c 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -55,12 +55,12 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) xbt_assert(! sg_host_by_name(host->id), "Refusing to create a second host named '%s'.", host->id); - RoutingEdge *net = NULL; - As* current_routing = routing_get_current(); + simgrid::surf::RoutingEdge *net = NULL; + simgrid::surf::As* current_routing = routing_get_current(); if (current_routing) net = routing_add_host(current_routing, host); - Cpu *cpu = surf_cpu_model_pm->createCpu( + simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( host->id, host->speed_peak, host->pstate, @@ -81,7 +81,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) */ void sg_platf_new_router(sg_platf_router_cbarg_t router) { - As* current_routing = routing_get_current(); + simgrid::surf::As* current_routing = routing_get_current(); if (current_routing->p_hierarchy == SURF_ROUTING_NULL) current_routing->p_hierarchy = SURF_ROUTING_BASE; @@ -89,14 +89,12 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router) "Reading a router, processing unit \"%s\" already exists", router->id); - RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(router->id), - -1, - SURF_NETWORK_ELEMENT_ROUTER, - current_routing); + simgrid::surf::RoutingEdge *info = new simgrid::surf::RoutingEdgeImpl( + xbt_strdup(router->id), -1, SURF_NETWORK_ELEMENT_ROUTER, current_routing); info->setId(current_routing->parsePU(info)); xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) info); XBT_DEBUG("Having set name '%s' id '%d'", router->id, info->getId()); - routingEdgeCreatedCallbacks(info); + simgrid::surf::routingEdgeCreatedCallbacks(info); if (router->coord && strcmp(router->coord, "")) { unsigned int cursor; diff --git a/src/surf/storage_interface.cpp b/src/surf/storage_interface.cpp index 4720735639..a723966c52 100644 --- a/src/surf/storage_interface.cpp +++ b/src/surf/storage_interface.cpp @@ -19,16 +19,19 @@ int SURF_STORAGE_LEVEL; xbt_lib_t storage_type_lib; int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level xbt_dynar_t mount_list = NULL; -StorageModel *surf_storage_model = NULL; +simgrid::surf::StorageModel *surf_storage_model = NULL; + +namespace simgrid { +namespace surf { /************* * Callbacks * *************/ -surf_callback(void, Storage*) storageCreatedCallbacks; -surf_callback(void, Storage*) storageDestructedCallbacks; -surf_callback(void, Storage*, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks; -surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks; +surf_callback(void, simgrid::surf::Storage*) storageCreatedCallbacks; +surf_callback(void, simgrid::surf::Storage*) storageDestructedCallbacks; +surf_callback(void, simgrid::surf::Storage*, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks; +surf_callback(void, simgrid::surf::StorageAction*, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks; /********* * Model * @@ -195,3 +198,6 @@ void StorageAction::setState(e_surf_action_state_t state){ Action::setState(state); surf_callback_emit(storageActionStateChangedCallbacks, this, old, state); } + +} +} diff --git a/src/surf/storage_interface.hpp b/src/surf/storage_interface.hpp index fe0c0d48b0..4d30a14c15 100644 --- a/src/surf/storage_interface.hpp +++ b/src/surf/storage_interface.hpp @@ -13,6 +13,9 @@ extern xbt_dynar_t mount_list; +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -29,25 +32,25 @@ class StorageAction; * @brief Callbacks handler which emit the callbacks after Storage creation * * @details Callback functions have the following signature: `void(Storage*)` */ -XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageCreatedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, simgrid::surf::Storage*)) storageCreatedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after Storage destruction * * @details Callback functions have the following signature: `void(StoragePtr)` */ -XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageDestructedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, simgrid::surf::Storage*)) storageDestructedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after Storage State changed * * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)` */ -XBT_PUBLIC_DATA(surf_callback(void, Storage*, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, simgrid::surf::Storage*, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after StorageAction State changed * * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_action_state_t old, e_surf_action_state_t current)` */ -XBT_PUBLIC_DATA(surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, simgrid::surf::StorageAction*, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks; /********* * Model * @@ -98,7 +101,7 @@ public: * @brief SURF storage interface class * @details A Storage represent a storage unit (e.g.: hard drive, usb key) */ -class Storage : public Resource { +class Storage : public simgrid::surf::Resource { public: /** * @brief Storage constructor @@ -293,6 +296,9 @@ public: double progress; }; +} +} + typedef struct s_storage_type { char *model; char *content; diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index bfd139d989..ff06a05bc0 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -31,7 +31,7 @@ static XBT_INLINE void routing_storage_type_free(void *r) static XBT_INLINE void surf_storage_resource_free(void *r) { // specific to storage - Storage *storage = static_cast(r); + simgrid::surf::Storage *storage = static_cast(r); // generic resource delete storage; } @@ -56,10 +56,13 @@ void storage_register_callbacks() void surf_storage_model_init_default(void) { - surf_storage_model = new StorageN11Model(); + surf_storage_model = new simgrid::surf::StorageN11Model(); xbt_dynar_push(all_existing_models, &surf_storage_model); } +namespace simgrid { +namespace surf { + StorageN11Model::StorageN11Model() : StorageModel() { Action *action = NULL; @@ -394,3 +397,5 @@ void StorageN11Action::setPriority(double /*priority*/) THROW_UNIMPLEMENTED; } +} +} diff --git a/src/surf/storage_n11.hpp b/src/surf/storage_n11.hpp index 9cb4522d6f..e34e69465b 100644 --- a/src/surf/storage_n11.hpp +++ b/src/surf/storage_n11.hpp @@ -11,6 +11,9 @@ #ifndef STORAGE_N11_HPP_ #define STORAGE_N11_HPP_ +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -72,4 +75,7 @@ public: }; +} +} + #endif /* STORAGE_N11_HPP_ */ diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 8f6185a516..ac3baae876 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -18,12 +18,12 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel); * TOOLS * *********/ -static Host *get_casted_host(surf_resource_t resource){ - return static_cast(surf_host_resource_priv(resource)); +static simgrid::surf::Host *get_casted_host(surf_resource_t resource){ + return static_cast(surf_host_resource_priv(resource)); } -static VirtualMachine *get_casted_vm(surf_resource_t resource){ - return static_cast(surf_host_resource_priv(resource)); +static simgrid::surf::VirtualMachine *get_casted_vm(surf_resource_t resource){ + return static_cast(surf_host_resource_priv(resource)); } extern double NOW; @@ -33,8 +33,8 @@ void surf_presolve(void) double next_event_date = -1.0; tmgr_trace_event_t event = NULL; double value = -1.0; - Resource *resource = NULL; - Model *model = NULL; + simgrid::surf::Resource *resource = NULL; + simgrid::surf::Model *model = NULL; unsigned int iter; XBT_DEBUG ("First Run! Let's \"purge\" events and put models in the right state"); @@ -61,8 +61,8 @@ double surf_solve(double max_date) double next_event_date = -1.0; double model_next_action_end = -1.0; double value = -1.0; - Resource *resource = NULL; - Model *model = NULL; + simgrid::surf::Resource *resource = NULL; + simgrid::surf::Model *model = NULL; tmgr_trace_event_t event = NULL; unsigned int iter; @@ -171,7 +171,8 @@ void routing_get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst, surf_model_t surf_resource_model(const void *host, int level) { /* If level is SURF_WKS_LEVEL, ws is a host_CLM03 object. It has * surf_resource at the generic_resource field. */ - Resource *ws = static_cast(xbt_lib_get_level((xbt_dictelm_t) host, level)); + simgrid::surf::Resource *ws = static_cast( + xbt_lib_get_level((xbt_dictelm_t) host, level)); return ws->getModel(); } @@ -217,14 +218,16 @@ surf_action_t surf_host_model_execute_parallel_task(surf_host_model_t model, double *flops_amount, double *bytes_amount, double rate){ - return static_cast(model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate)); + return static_cast( + model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate)); } xbt_dynar_t surf_host_model_get_route(surf_host_model_t /*model*/, surf_resource_t src, surf_resource_t dst){ xbt_dynar_t route = NULL; - routing_platf->getRouteAndLatency(get_casted_host(src)->p_netElm, - get_casted_host(dst)->p_netElm, &route, NULL); + routing_platf->getRouteAndLatency( + get_casted_host(src)->p_netElm, + get_casted_host(dst)->p_netElm, &route, NULL); return route; } @@ -290,20 +293,24 @@ void surf_host_set_pstate(surf_resource_t host, int pstate_index){ int surf_host_get_pstate(surf_resource_t host){ return sg_host_surfcpu(host)->getPstate(); } + +using simgrid::energy::HostEnergy; +using simgrid::energy::surf_energy; + double surf_host_get_wattmin_at(surf_resource_t resource, int pstate){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); return hostIt->second->getWattMinAt(pstate); } double surf_host_get_wattmax_at(surf_resource_t resource, int pstate){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); return hostIt->second->getWattMaxAt(pstate); } double surf_host_get_consumed_energy(surf_resource_t resource){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); return hostIt->second->getConsumedEnergy(); } @@ -360,7 +367,7 @@ xbt_dynar_t surf_host_get_vms(surf_resource_t host){ xbt_dynar_t vms = get_casted_host(host)->getVms(); xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL); unsigned int cpt; - VirtualMachine *vm; + simgrid::surf::VirtualMachine *vm; xbt_dynar_foreach(vms, cpt, vm) { sg_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName()); xbt_dynar_push(vms_, &vm_); @@ -379,7 +386,7 @@ void surf_host_set_params(surf_resource_t host, vm_params_t params){ void surf_vm_destroy(surf_resource_t resource){ /* Before clearing the entries in host_lib, we have to pick up resources. */ - VirtualMachine *vm = get_casted_vm(resource); + simgrid::surf::VirtualMachine *vm = get_casted_vm(resource); char* name = xbt_dict_get_elm_key(resource); /* We deregister objects from host_lib, without invoking the freeing callback * of each level. @@ -430,23 +437,23 @@ void surf_vm_set_affinity(surf_resource_t vm, surf_resource_t cpu, unsigned long } xbt_dict_t surf_storage_get_content(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getContent(); + return static_cast(surf_storage_resource_priv(resource))->getContent(); } sg_size_t surf_storage_get_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getSize(); + return static_cast(surf_storage_resource_priv(resource))->getSize(); } sg_size_t surf_storage_get_free_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getFreeSize(); + return static_cast(surf_storage_resource_priv(resource))->getFreeSize(); } sg_size_t surf_storage_get_used_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getUsedSize(); + return static_cast(surf_storage_resource_priv(resource))->getUsedSize(); } const char* surf_storage_get_host(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->p_attach; + return static_cast(surf_storage_resource_priv(resource))->p_attach; } surf_action_t surf_cpu_execute(surf_resource_t cpu, double size){ @@ -510,11 +517,11 @@ double surf_action_get_cost(surf_action_t action){ } void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) { - static_cast(action)->setAffinity(sg_host_surfcpu(cpu), mask); + static_cast(action)->setAffinity(sg_host_surfcpu(cpu), mask); } void surf_cpu_action_set_bound(surf_action_t action, double bound) { - static_cast(action)->setBound(bound); + static_cast(action)->setBound(bound); } #ifdef HAVE_LATENCY_BOUND_TRACKING @@ -524,5 +531,5 @@ double surf_network_action_get_latency_limited(surf_action_t action) { #endif surf_file_t surf_storage_action_get_file(surf_action_t action){ - return static_cast(action)->p_file; + return static_cast(action)->p_file; } diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index b10a5042cc..adf270b04d 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -35,8 +35,14 @@ xbt_dynar_t surf_path = NULL; xbt_dynar_t host_that_restart = NULL; xbt_dict_t watched_hosts_lib; +namespace simgrid { +namespace surf { + surf_callback(void, void) surfExitCallbacks; +} +} + s_surf_model_description_t surf_plugin_description[] = { {"Energy", "Cpu energy consumption.", sg_energy_plugin_init}, {NULL, NULL, NULL} /* this array must be NULL terminated */ @@ -265,12 +271,12 @@ static XBT_INLINE void routing_asr_prop_free(void *p) static XBT_INLINE void surf_host_free(void *r) { - delete static_cast(r); + delete static_cast(r); } static XBT_INLINE void surf_storage_free(void *r) { - delete static_cast(r); + delete static_cast(r); } void sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch) { @@ -318,9 +324,9 @@ void surf_init(int *argc, char **argv) xbt_init(argc, argv); if (!all_existing_models) - all_existing_models = xbt_dynar_new(sizeof(Model*), NULL); + all_existing_models = xbt_dynar_new(sizeof(simgrid::surf::Model*), NULL); if (!model_list_invoke) - model_list_invoke = xbt_dynar_new(sizeof(Model*), NULL); + model_list_invoke = xbt_dynar_new(sizeof(simgrid::surf::Model*), NULL); if (!history) history = tmgr_history_new(); @@ -336,7 +342,7 @@ void surf_init(int *argc, char **argv) void surf_exit(void) { unsigned int iter; - Model *model = NULL; + simgrid::surf::Model *model = NULL; TRACE_end(); /* Just in case it was not called by the upper * layer (or there is no upper layer) */ @@ -360,7 +366,7 @@ void surf_exit(void) xbt_dynar_free(&model_list_invoke); routing_exit(); - surf_callback_emit(surfExitCallbacks); + surf_callback_emit(simgrid::surf::surfExitCallbacks); if (maxmin_system) { lmm_system_free(maxmin_system); @@ -386,6 +392,9 @@ void surf_exit(void) * Model * *********/ +namespace simgrid { +namespace surf { + Model::Model() : p_maxminSystem(NULL) { @@ -574,10 +583,16 @@ void Model::updateActionsStateFull(double /*now*/, double /*delta*/) THROW_UNIMPLEMENTED; } +} +} + /************ * Resource * ************/ +namespace simgrid { +namespace surf { + Resource::Resource() : p_name(NULL), p_properties(NULL), p_model(NULL) {} @@ -654,6 +669,9 @@ lmm_constraint_t Resource::getConstraint() { return p_constraint; } +} +} + /********** * Action * **********/ @@ -667,7 +685,15 @@ const char *surf_action_state_names[6] = { "SURF_ACTION_NOT_IN_THE_SYSTEM" }; -void Action::initialize(Model *model, double cost, bool failed, +/* added to manage the communication action's heap */ +void surf_action_lmm_update_index_heap(void *action, int i) { + static_cast(action)->updateIndexHeap(i); +} + +namespace simgrid { +namespace surf { + +void Action::initialize(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) { m_priority = 1.0; @@ -695,12 +721,12 @@ void Action::initialize(Model *model, double cost, bool failed, p_stateSet->push_back(*this); } -Action::Action(Model *model, double cost, bool failed) +Action::Action(simgrid::surf::Model *model, double cost, bool failed) { initialize(model, cost, failed); } -Action::Action(Model *model, double cost, bool failed, lmm_variable_t var) +Action::Action(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) { initialize(model, cost, failed, var); } @@ -899,11 +925,6 @@ void Action::heapUpdate(xbt_heap_t heap, double key, enum heap_action_type hat) } } -/* added to manage the communication action's heap */ -void surf_action_lmm_update_index_heap(void *action, int i) { - static_cast(action)->updateIndexHeap(i); -} - void Action::updateIndexHeap(int i) { m_indexHeap = i; } @@ -950,7 +971,8 @@ void Action::updateRemainingLazy(double now) double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision); if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) { - Resource *cpu = static_cast(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0))); + simgrid::surf::Resource *cpu = static_cast( + lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0))); TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate); } XBT_DEBUG("Updating action(%p): remains is now %f", this, m_remains); @@ -978,3 +1000,6 @@ void Action::updateRemainingLazy(double now) m_lastUpdate = now; m_lastValue = lmm_variable_getvalue(getVariable()); } + +} +} diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 213e6d42fb..3bccf4d1eb 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -94,8 +94,14 @@ XBT_PUBLIC(double) surf_get_clock(void); extern XBT_PRIVATE double sg_sender_gap; +namespace simgrid { +namespace surf { + extern XBT_PRIVATE surf_callback(void, void) surfExitCallbacks; +} +} + int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path); /*********** @@ -123,8 +129,14 @@ XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency; /********** * Action * **********/ + XBT_PRIVATE void surf_action_lmm_update_index_heap(void *action, int i); +XBT_PUBLIC_DATA(xbt_dynar_t) all_existing_models; + +namespace simgrid { +namespace surf { + /** @ingroup SURF_interface * @brief SURF action interface class * @details An action is an event generated by a resource (e.g.: a communication for the network) @@ -140,7 +152,7 @@ private: /** * @brief Common initializations for the constructors */ - void initialize(Model *model, double cost, bool failed, + void initialize(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var = NULL); public: @@ -151,7 +163,7 @@ public: * @param cost The cost of the Action * @param failed If the action is impossible (e.g.: execute something on a switched off host) */ - Action(Model *model, double cost, bool failed); + Action(simgrid::surf::Model *model, double cost, bool failed); /** * @brief Action constructor @@ -161,7 +173,7 @@ public: * @param failed If the action is impossible (e.g.: execute something on a switched off host) * @param var The lmm variable associated to this Action if it is part of a LMM component */ - Action(Model *model, double cost, bool failed, lmm_variable_t var); + Action(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var); /** @brief Destructor */ virtual ~Action(); @@ -251,7 +263,7 @@ public: s_xbt_swag_hookup_t p_stateHookup; - Model *getModel() {return p_model;} + simgrid::surf::Model *getModel() {return p_model;} protected: ActionList* p_stateSet; @@ -269,7 +281,7 @@ private: int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */ #endif double m_cost; - Model *p_model; + simgrid::surf::Model *p_model; void *p_data; /**< for your convenience */ /* LMM */ @@ -305,7 +317,6 @@ typedef ActionLmmList* ActionLmmListPtr; /********* * Model * *********/ -XBT_PUBLIC_DATA(xbt_dynar_t) all_existing_models; /** @ingroup SURF_interface * @brief SURF model interface class @@ -389,6 +400,9 @@ private: ActionList* p_doneActionSet; /**< Actions in state SURF_ACTION_DONE */ }; +} +} + /************ * Resource * ************/ @@ -402,6 +416,9 @@ typedef struct { tmgr_trace_event_t event; /**< The associated trace event associated to the metric */ } s_surf_metric_t; +namespace simgrid { +namespace surf { + /** @ingroup SURF_interface * @brief SURF resource interface class * @details A resource represent an element of a component (e.g.: a link for the network) @@ -492,4 +509,7 @@ private: lmm_constraint_t p_constraint; }; +} +} + #endif /* SURF_MODEL_H_ */ diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 025e77824a..0da957e14d 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -20,8 +20,14 @@ * Callbacks * *************/ -surf_callback(void, RoutingEdge*) routingEdgeCreatedCallbacks; -surf_callback(void, As*) asCreatedCallbacks; +namespace simgrid { +namespace surf { + +surf_callback(void, simgrid::surf::RoutingEdge*) routingEdgeCreatedCallbacks; +surf_callback(void, simgrid::surf::As*) asCreatedCallbacks; + +} +} /** * @ingroup SURF_build_api @@ -52,16 +58,17 @@ static xbt_dict_t random_value = NULL; * * Routing edges are either host and routers, whatever */ -RoutingEdge *sg_routing_edge_by_name_or_null(const char *name) { +simgrid::surf::RoutingEdge *sg_routing_edge_by_name_or_null(const char *name) +{ sg_host_t h = sg_host_by_name(name); - RoutingEdge *net_elm = h==NULL?NULL: sg_host_edge(h); + simgrid::surf::RoutingEdge *net_elm = h==NULL?NULL: sg_host_edge(h); if (!net_elm) - net_elm = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); + net_elm = (simgrid::surf::RoutingEdge*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); return net_elm; } /* Global vars */ -RoutingPlatf *routing_platf = NULL; +simgrid::surf::RoutingPlatf *routing_platf = NULL; /* global parse functions */ extern xbt_dynar_t mount_list; @@ -69,8 +76,8 @@ extern xbt_dynar_t mount_list; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf"); /** The current AS in the parsing */ -static As *current_routing = NULL; -As* routing_get_current() +static simgrid::surf::As *current_routing = NULL; +simgrid::surf::As* routing_get_current() { return current_routing; } @@ -123,7 +130,7 @@ struct s_model_type routing_models[] = { */ void sg_platf_new_host_link(sg_platf_host_link_cbarg_t host) { - RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id)); + simgrid::surf::RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id)); xbt_assert(info, "Host '%s' not found!", host->id); xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] || current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI], @@ -151,21 +158,23 @@ void sg_platf_new_host_link(sg_platf_host_link_cbarg_t host) /** * \brief Add a "host" to the network element list */ -RoutingEdge *routing_add_host(As* current_routing, sg_platf_host_cbarg_t host) +simgrid::surf::RoutingEdge *routing_add_host( + simgrid::surf::As* current_routing, sg_platf_host_cbarg_t host) { if (current_routing->p_hierarchy == SURF_ROUTING_NULL) current_routing->p_hierarchy = SURF_ROUTING_BASE; xbt_assert(!sg_host_by_name(host->id), "Reading a host, processing unit \"%s\" already exists", host->id); - RoutingEdge *routingEdge = new RoutingEdgeImpl(xbt_strdup(host->id), + simgrid::surf::RoutingEdge *routingEdge = + new simgrid::surf::RoutingEdgeImpl(xbt_strdup(host->id), -1, SURF_NETWORK_ELEMENT_HOST, current_routing); routingEdge->setId(current_routing->parsePU(routingEdge)); sg_host_edge_set(sg_host_by_name_or_create(host->id), routingEdge); XBT_DEBUG("Having set name '%s' id '%d'", host->id, routingEdge->getId()); - routingEdgeCreatedCallbacks(routingEdge); + simgrid::surf::routingEdgeCreatedCallbacks(routingEdge); if(mount_list){ xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list); @@ -301,13 +310,14 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) } /* make a new routing component */ - As *new_as = model->create(); + simgrid::surf::As *new_as = model->create(); new_as->p_modelDesc = model; new_as->p_hierarchy = SURF_ROUTING_NULL; new_as->p_name = xbt_strdup(AS->id); - RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(new_as->p_name), + simgrid::surf::RoutingEdge *info = + new simgrid::surf::RoutingEdgeImpl(xbt_strdup(new_as->p_name), -1, SURF_NETWORK_ELEMENT_AS, current_routing); @@ -344,8 +354,8 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) current_routing = new_as; current_routing->p_netElem = info; - routingEdgeCreatedCallbacks(info); - asCreatedCallbacks(new_as); + simgrid::surf::routingEdgeCreatedCallbacks(info); + simgrid::surf::asCreatedCallbacks(new_as); } /** @@ -389,15 +399,15 @@ static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst, { xbt_assert(src && dst, "bad parameters for \"elements_father\" method"); #define ELEMENTS_FATHER_MAXDEPTH 16 /* increase if it is not enough */ - As *src_as, *dst_as; - As *path_src[ELEMENTS_FATHER_MAXDEPTH]; - As *path_dst[ELEMENTS_FATHER_MAXDEPTH]; + simgrid::surf::As *src_as, *dst_as; + simgrid::surf::As *path_src[ELEMENTS_FATHER_MAXDEPTH]; + simgrid::surf::As *path_dst[ELEMENTS_FATHER_MAXDEPTH]; int index_src = 0; int index_dst = 0; - As *current; - As *current_src; - As *current_dst; - As *father; + simgrid::surf::As *current; + simgrid::surf::As *current_src; + simgrid::surf::As *current_dst; + simgrid::surf::As *father; /* (1) find the as where the src and dst are located */ sg_routing_edge_t src_data = src; @@ -457,8 +467,9 @@ static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst, * This function is called by "get_route" and "get_latency". It allows to walk * recursively through the ASes tree. */ -static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst, - xbt_dynar_t * links, double *latency) +static void _get_route_and_latency( + simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, + xbt_dynar_t * links, double *latency) { s_sg_platf_route_cbarg_t route = SG_PLATF_ROUTE_INITIALIZER; memset(&route,0,sizeof(route)); @@ -467,7 +478,7 @@ static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst, XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->getName(), dst->getName()); /* Find how src and dst are interconnected */ - As *common_father, *src_father, *dst_father; + simgrid::surf::As *common_father, *src_father, *dst_father; elements_father(src, dst, &common_father, &src_father, &dst_father); XBT_DEBUG("elements_father: common father '%s' src_father '%s' dst_father '%s'", common_father->p_name, src_father->p_name, dst_father->p_name); @@ -497,8 +508,8 @@ static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst, route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); // Find the net_card corresponding to father - RoutingEdge *src_father_net_elm = src_father->p_netElem; - RoutingEdge *dst_father_net_elm = dst_father->p_netElem; + simgrid::surf::RoutingEdge *src_father_net_elm = src_father->p_netElem; + simgrid::surf::RoutingEdge *dst_father_net_elm = dst_father->p_netElem; common_father->getRouteAndLatency(src_father_net_elm, dst_father_net_elm, &route, latency); @@ -529,6 +540,8 @@ e_surf_network_element_type_t surf_routing_edge_get_rc_type(sg_routing_edge_t ed return edge->getRcType(); } +namespace simgrid { +namespace surf { /** * \brief Find a route between hosts @@ -544,8 +557,9 @@ e_surf_network_element_type_t surf_routing_edge_get_rc_type(sg_routing_edge_t ed * walk through the routing components tree and find a route between hosts * by calling the differents "get_route" functions in each routing component. */ -void RoutingPlatf::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, - xbt_dynar_t* route, double *latency) +void RoutingPlatf::getRouteAndLatency( + simgrid::surf::RoutingEdge *src, simgrid::surf::RoutingEdge *dst, + xbt_dynar_t* route, double *latency) { XBT_DEBUG("routing_get_route_and_latency from %s to %s", src->getName(), dst->getName()); if (!*route) { @@ -584,9 +598,12 @@ xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(As *rc) return ret; } +} +} + e_surf_network_element_type_t routing_get_network_element_type(const char *name) { - RoutingEdge *rc = sg_routing_edge_by_name_or_null(name); + simgrid::surf::RoutingEdge *rc = sg_routing_edge_by_name_or_null(name); if (rc) return rc->getRcType(); @@ -601,7 +618,7 @@ e_surf_network_element_type_t routing_get_network_element_type(const char *name) void routing_model_create( void *loopback) { /* config the uniq global routing */ - routing_platf = new RoutingPlatf(); + routing_platf = new simgrid::surf::RoutingPlatf(); routing_platf->p_root = NULL; routing_platf->p_loopback = loopback; routing_platf->p_lastRoute = xbt_dynar_new(sizeof(sg_routing_link_t),NULL); @@ -660,7 +677,8 @@ void routing_cluster_add_backbone(void* bb) { xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER], "You have to be in model Cluster to use tag backbone!"); xbt_assert(!static_cast(current_routing)->p_backbone, "The backbone link is already defined!"); - static_cast(current_routing)->p_backbone = static_cast(bb); + static_cast(current_routing)->p_backbone = + static_cast(bb); XBT_DEBUG("Add a backbone to AS '%s'", current_routing->p_name); } @@ -738,6 +756,10 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) { + using simgrid::surf::AsCluster; + using simgrid::surf::AsClusterTorus; + using simgrid::surf::AsClusterFatTree; + char *host_id, *groups, *link_id = NULL; xbt_dict_t patterns = NULL; int rankId=0; @@ -896,7 +918,8 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) info_loop.link_up = Link::byName(tmp_link); info_loop.link_down = info_loop.link_up; free(tmp_link); - xbt_dynar_set(current_routing->p_linkUpDownList, rankId*(static_cast(current_routing))->p_nb_links_per_node, &info_loop); + xbt_dynar_set(current_routing->p_linkUpDownList, + rankId*(static_cast(current_routing))->p_nb_links_per_node, &info_loop); } //add a limiter link (shared link to account for maximal bandwidth of the node) @@ -916,8 +939,9 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) info_lim.link_up = Link::byName(tmp_link); info_lim.link_down = info_lim.link_up; free(tmp_link); + auto as_cluster = static_cast(current_routing); xbt_dynar_set(current_routing->p_linkUpDownList, - rankId*(static_cast(current_routing))->p_nb_links_per_node + static_cast(current_routing)->p_has_loopback , + rankId*(as_cluster)->p_nb_links_per_node + as_cluster->p_has_loopback , &info_lim); } @@ -944,7 +968,7 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) // For fat trees, the links must be created once all nodes have been added if(cluster->topology == SURF_CLUSTER_FAT_TREE) { - static_cast(current_routing)->create_links(); + static_cast(current_routing)->create_links(); } // Add a router. It is magically used thanks to the way in which surf_routing_cluster is written, // and it's very useful to connect clusters together @@ -960,7 +984,7 @@ void routing_new_cluster(sg_platf_cluster_cbarg_t cluster) bprintf("%s%s_router%s", cluster->prefix, cluster->id, cluster->suffix); sg_platf_new_router(&router); - ((AsCluster*)current_routing)->p_router = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL); + ((AsCluster*)current_routing)->p_router = (simgrid::surf::RoutingEdge*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL); free(newid); //Make the backbone @@ -995,6 +1019,9 @@ static void routing_parse_postparse(void) { void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) { + using simgrid::surf::RoutingEdge; + using simgrid::surf::AsCluster; + char *host_id = NULL; char *link_id = NULL; char *router_id = NULL; @@ -1202,10 +1229,10 @@ static void check_disk_attachment() xbt_lib_cursor_t cursor; char *key; void **data; - RoutingEdge *host_elm; + simgrid::surf::RoutingEdge *host_elm; xbt_lib_foreach(storage_lib, cursor, key, data) { if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) { - Storage *storage = static_cast(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL)); + simgrid::surf::Storage *storage = static_cast(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL)); host_elm = sg_routing_edge_by_name_or_null(storage->p_attach); if(!host_elm) surf_parse_error("Unable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach); @@ -1229,7 +1256,7 @@ void routing_register_callbacks() * This fuction is call by "finalize". It allow to finalize the * AS or routing components. It delete all the structures. */ -static void finalize_rec(As *as) { +static void finalize_rec(simgrid::surf::As *as) { xbt_dict_cursor_t cursor = NULL; char *key; AS_t elem; @@ -1246,25 +1273,33 @@ void routing_exit(void) { delete routing_platf; } +namespace simgrid { +namespace surf { + RoutingPlatf::~RoutingPlatf() { xbt_dynar_free(&p_lastRoute); finalize_rec(p_root); } +} +} + AS_t surf_AS_get_routing_root() { return routing_platf->p_root; } -const char *surf_AS_get_name(As *as) { +const char *surf_AS_get_name(simgrid::surf::As *as) { return as->p_name; } -static As *surf_AS_recursive_get_by_name(As *current, const char * name) { +static simgrid::surf::As *surf_AS_recursive_get_by_name( + simgrid::surf::As *current, const char * name) +{ xbt_dict_cursor_t cursor = NULL; char *key; AS_t elem; - As *tmp = NULL; + simgrid::surf::As *tmp = NULL; if(!strcmp(current->p_name, name)) return current; @@ -1278,23 +1313,26 @@ static As *surf_AS_recursive_get_by_name(As *current, const char * name) { return tmp; } - -As *surf_AS_get_by_name(const char * name) { - As *as = surf_AS_recursive_get_by_name(routing_platf->p_root, name); +simgrid::surf::As *surf_AS_get_by_name(const char * name) +{ + simgrid::surf::As *as = surf_AS_recursive_get_by_name(routing_platf->p_root, name); if(as == NULL) XBT_WARN("Impossible to find an AS with name %s, please check your input", name); return as; } -xbt_dict_t surf_AS_get_routing_sons(As *as) { +xbt_dict_t surf_AS_get_routing_sons(simgrid::surf::As *as) +{ return as->p_routingSons; } -const char *surf_AS_get_model(As *as) { +const char *surf_AS_get_model(simgrid::surf::As *as) +{ return as->p_modelDesc->name; } -xbt_dynar_t surf_AS_get_hosts(As *as) { +xbt_dynar_t surf_AS_get_hosts(simgrid::surf::As *as) +{ xbt_dynar_t elms = as->p_indexNetworkElm; sg_routing_edge_t relm; xbt_dictelm_t delm; @@ -1302,7 +1340,7 @@ xbt_dynar_t surf_AS_get_hosts(As *as) { int count = xbt_dynar_length(elms); xbt_dynar_t res = xbt_dynar_new(sizeof(xbt_dictelm_t), NULL); for (index = 0; index < count; index++) { - relm = xbt_dynar_get_as(elms, index, RoutingEdge*); + relm = xbt_dynar_get_as(elms, index, simgrid::surf::RoutingEdge*); delm = xbt_lib_get_elm_or_null(host_lib, relm->getName()); if (delm!=NULL) { xbt_dynar_push(res, &delm); diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 0a4fe65f69..5e42bc20d0 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -14,10 +14,8 @@ XBT_PUBLIC(void) routing_model_create( void *loopback); -/* ************************************************************************** */ -/* ************************* GRAPH EXPORTING FUNCTIONS ********************** */ -XBT_PRIVATE xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes); -XBT_PRIVATE xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges); +namespace simgrid { +namespace surf { /*********** * Classes * @@ -32,7 +30,7 @@ class RoutingPlatf; * @brief A routing edge * @details [long description] */ -struct RoutingEdge { +class RoutingEdge { public: virtual ~RoutingEdge(){}; virtual int getId()=0; @@ -82,17 +80,21 @@ public: * @param into [description] * @param latency [description] */ - virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency)=0; + virtual void getRouteAndLatency( + RoutingEdge *src, RoutingEdge *dst, + sg_platf_route_cbarg_t into, double *latency)=0; virtual xbt_dynar_t getOneLinkRoutes()=0; virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0; - virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat)=0; + virtual sg_platf_route_cbarg_t getBypassRoute( + RoutingEdge *src, RoutingEdge *dst, + double *lat)=0; /* The parser calls the following functions to inform the routing models * that a new element is added to the AS currently built. * * Of course, only the routing model of this AS is informed, not every ones */ virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */ - virtual int parseAS( RoutingEdge *elm)=0; + virtual int parseAS(RoutingEdge *elm)=0; virtual void parseRoute(sg_platf_route_cbarg_t route)=0; virtual void parseASroute(sg_platf_route_cbarg_t route)=0; virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; @@ -164,4 +166,7 @@ public: XBT_PUBLIC_DATA(surf_callback(void, RoutingEdge*)) routingEdgeCreatedCallbacks; XBT_PUBLIC_DATA(surf_callback(void, As*)) asCreatedCallbacks; +} +} + #endif /* NETWORK_ROUTING_HPP_ */ diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 8ee2f556e7..bf0564b571 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -5,6 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "surf_routing_cluster.hpp" +#include "surf_routing_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); @@ -14,9 +15,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf" AS_t model_cluster_create(void) { - return new AsCluster(); + return new simgrid::surf::AsCluster(); } +namespace simgrid { +namespace surf { + /* Creation routing model functions */ AsCluster::AsCluster() : AsNone() { @@ -61,7 +65,8 @@ void AsCluster::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_ } if (p_backbone) { - xbt_dynar_push_as(route->link_list, void *, static_cast(p_backbone)); + xbt_dynar_push_as(route->link_list, void *, + static_cast(p_backbone)); if (lat) *lat += p_backbone->getLatency(); } @@ -113,7 +118,8 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) if (info.link_up) { // link up - const char *link_name = static_cast(info.link_up)->getName(); + const char *link_name = static_cast( + info.link_up)->getName(); current = new_xbt_graph_node(graph, link_name, nodes); new_xbt_graph_edge(graph, previous, current, edges); @@ -126,7 +132,8 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } if (info.link_down) { // link down - const char *link_name = static_cast(info.link_down)->getName(); + const char *link_name = static_cast( + info.link_down)->getName(); current = new_xbt_graph_node(graph, link_name, nodes); new_xbt_graph_edge(graph, previous, current, edges); @@ -181,3 +188,5 @@ int AsCluster::parseAS(RoutingEdge *elm) { return xbt_dynar_length(p_indexNetworkElm)-1; } +} +} diff --git a/src/surf/surf_routing_cluster.hpp b/src/surf/surf_routing_cluster.hpp index c7fa8c805c..4588624f5f 100644 --- a/src/surf/surf_routing_cluster.hpp +++ b/src/surf/surf_routing_cluster.hpp @@ -12,11 +12,14 @@ #include "surf_routing_none.hpp" #include "network_interface.hpp" +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ -class XBT_PRIVATE AsCluster; +class XBT_PRIVATE AsCluster; /* ************************************************** */ /* ************** Cluster ROUTING **************** */ @@ -49,5 +52,7 @@ public: }; +} +} #endif /* SURF_ROUTING_CLUSTER_HPP_ */ diff --git a/src/surf/surf_routing_cluster_fat_tree.cpp b/src/surf/surf_routing_cluster_fat_tree.cpp index e7f1c66777..83bd2ebe93 100644 --- a/src/surf/surf_routing_cluster_fat_tree.cpp +++ b/src/surf/surf_routing_cluster_fat_tree.cpp @@ -19,9 +19,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat tree AS_t model_fat_tree_cluster_create(void) { - return new AsClusterFatTree(); + return new simgrid::surf::AsClusterFatTree(); } +namespace simgrid { +namespace surf { + AsClusterFatTree::AsClusterFatTree() : levels(0) { XBT_DEBUG("Creating a new fat tree."); } @@ -557,3 +560,6 @@ FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster, uniqueId++; free((void*)linkTemplate.id); } + +} +} diff --git a/src/surf/surf_routing_cluster_fat_tree.hpp b/src/surf/surf_routing_cluster_fat_tree.hpp index 78cbfae03b..8aae47c2ea 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -15,6 +15,8 @@ #include "surf_routing_cluster.hpp" +namespace simgrid { +namespace surf { /** \file surf_routing_cluster_fat_tree.cpp * The class AsClusterFatTree describes PGFT, as introduced by Eitan Zahavi @@ -162,4 +164,8 @@ private: bool areRelated(FatTreeNode *parent, FatTreeNode *child); bool isInSubTree(FatTreeNode *root, FatTreeNode *node); }; + +} +} + #endif diff --git a/src/surf/surf_routing_cluster_torus.cpp b/src/surf/surf_routing_cluster_torus.cpp index a371297136..12d08df0ca 100644 --- a/src/surf/surf_routing_cluster_torus.cpp +++ b/src/surf/surf_routing_cluster_torus.cpp @@ -25,9 +25,12 @@ inline unsigned int* rankId_to_coords(int rankId, xbt_dynar_t dimensions) { AS_t model_torus_cluster_create(void) { - return new AsClusterTorus(); + return new simgrid::surf::AsClusterTorus(); } +namespace simgrid { +namespace surf { + /* Creation routing model functions */ AsClusterTorus::AsClusterTorus() : AsCluster() { @@ -237,3 +240,6 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_p return; } + +} +} diff --git a/src/surf/surf_routing_cluster_torus.hpp b/src/surf/surf_routing_cluster_torus.hpp index 04089897e9..cb74764c19 100644 --- a/src/surf/surf_routing_cluster_torus.hpp +++ b/src/surf/surf_routing_cluster_torus.hpp @@ -14,18 +14,20 @@ #include "network_interface.hpp" #include "surf_routing_cluster.hpp" -class XBT_PRIVATE AsClusterTorus: public AsCluster { +namespace simgrid { +namespace surf { + +class XBT_PRIVATE AsClusterTorus: public simgrid::surf::AsCluster { public: AsClusterTorus(); virtual ~AsClusterTorus(); virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position); virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency); void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster); - - xbt_dynar_t p_dimensions; - }; +} +} #endif diff --git a/src/surf/surf_routing_dijkstra.cpp b/src/surf/surf_routing_dijkstra.cpp index 50408cfe4a..28ed73238b 100644 --- a/src/surf/surf_routing_dijkstra.cpp +++ b/src/surf/surf_routing_dijkstra.cpp @@ -36,16 +36,17 @@ static void graph_edge_data_free(void *e) // FIXME: useless code duplication } AS_t model_dijkstra_create(void){ - return new AsDijkstra(0); + return new simgrid::surf::AsDijkstra(0); } AS_t model_dijkstracache_create(void){ - return new AsDijkstra(1); + return new simgrid::surf::AsDijkstra(1); } void model_dijkstra_both_end(AS_t as) { - AsDijkstra *THIS_AS = static_cast(as); + simgrid::surf::AsDijkstra *THIS_AS + = static_cast(as); xbt_node_t node = NULL; unsigned int cursor2; xbt_dynar_t nodes = NULL; @@ -74,6 +75,9 @@ void model_dijkstra_both_end(AS_t as) /* Utility functions */ +namespace simgrid { +namespace surf { + xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id) { xbt_node_t node = NULL; @@ -528,3 +532,6 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route) } xbt_dynar_free(&route->link_list); } + +} +} diff --git a/src/surf/surf_routing_dijkstra.hpp b/src/surf/surf_routing_dijkstra.hpp index aa8400070d..0cc6908837 100644 --- a/src/surf/surf_routing_dijkstra.hpp +++ b/src/surf/surf_routing_dijkstra.hpp @@ -25,9 +25,13 @@ typedef struct route_cache_element { int size; } s_route_cache_element_t, *route_cache_element_t; +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ + class XBT_PRIVATE AsDijkstra; class AsDijkstra : public AsGeneric { @@ -64,4 +68,7 @@ public: int m_cached; }; +} +} + #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */ diff --git a/src/surf/surf_routing_floyd.cpp b/src/surf/surf_routing_floyd.cpp index ce7db29100..8309a02721 100644 --- a/src/surf/surf_routing_floyd.cpp +++ b/src/surf/surf_routing_floyd.cpp @@ -15,14 +15,17 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf"); AS_t model_floyd_create(void) { - return new AsFloyd(); + return new simgrid::surf::AsFloyd(); } void model_floyd_end(AS_t current_routing) { - static_cast(current_routing)->end(); + static_cast(current_routing)->end(); } +namespace simgrid { +namespace surf { + AsFloyd::AsFloyd(): AsGeneric() { p_predecessorTable = NULL; p_costTable = NULL; @@ -319,3 +322,6 @@ void AsFloyd::end(){ } } } + +} +} diff --git a/src/surf/surf_routing_floyd.hpp b/src/surf/surf_routing_floyd.hpp index 592e0d5f24..761969747d 100644 --- a/src/surf/surf_routing_floyd.hpp +++ b/src/surf/surf_routing_floyd.hpp @@ -12,6 +12,9 @@ #include "surf_routing_generic.hpp" +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -47,6 +50,7 @@ public: sg_platf_route_cbarg_t *p_linkTable; }; - +} +} #endif /* SURF_ROUTING_FLOYD_HPP_ */ diff --git a/src/surf/surf_routing_full.cpp b/src/surf/surf_routing_full.cpp index bcbcbe27e8..2855d52f10 100644 --- a/src/surf/surf_routing_full.cpp +++ b/src/surf/surf_routing_full.cpp @@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf"); AS_t model_full_create(void) { - return new AsFull(); + return new simgrid::surf::AsFull(); } void model_full_end(AS_t _routing) @@ -22,7 +22,7 @@ void model_full_end(AS_t _routing) sg_platf_route_cbarg_t e_route; /* set utils vars */ - AsFull *routing = static_cast(_routing); + simgrid::surf::AsFull *routing = static_cast(_routing); int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm); /* Create table if necessary */ @@ -45,6 +45,9 @@ void model_full_end(AS_t _routing) } } +namespace simgrid { +namespace surf { + AsFull::AsFull(){ p_routingTable = 0; } @@ -264,6 +267,5 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route) xbt_dynar_free(&route->link_list); } - - - +} +} diff --git a/src/surf/surf_routing_full.hpp b/src/surf/surf_routing_full.hpp index 1a0a01168e..e9b747492d 100644 --- a/src/surf/surf_routing_full.hpp +++ b/src/surf/surf_routing_full.hpp @@ -11,6 +11,9 @@ #include "surf_routing_generic.hpp" +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -41,5 +44,7 @@ public: //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; }; +} +} #endif /* SURF_ROUTING_FULL_HPP_ */ diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index fc14c8f323..84bbba4f90 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -17,6 +17,7 @@ #include "simgrid/platf_interface.h" // platform creation API internal interface #include "surf_routing_generic.hpp" +#include "surf_routing_private.hpp" #include "network_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing"); @@ -31,6 +32,9 @@ void generic_free_route(sg_platf_route_cbarg_t route) } } +namespace simgrid { +namespace surf { + void AsGeneric::parseRoute(sg_platf_route_cbarg_t /*route*/){ THROW_IMPOSSIBLE; } @@ -98,14 +102,12 @@ void AsGeneric::parseBypassroute(sg_platf_route_cbarg_t e_route) xbt_free(route_name); } +} +} + /* ************************************************************************** */ /* *********************** GENERIC BUSINESS METHODS ************************* */ -xbt_dynar_t AsGeneric::getOneLinkRoutes() { // FIXME: kill that stub - xbt_die("\"generic_get_onelink_routes\" not implemented yet"); - return NULL; -} - static const char *instr_node_name(xbt_node_t node) { void *data = xbt_graph_node_get_data(node); @@ -151,6 +153,14 @@ xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, return ret; } +namespace simgrid { +namespace surf { + +xbt_dynar_t AsGeneric::getOneLinkRoutes() { // FIXME: kill that stub + xbt_die("\"generic_get_onelink_routes\" not implemented yet"); + return NULL; +} + void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) { int src, dst; @@ -188,7 +198,8 @@ void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } xbt_dynar_foreach(route->link_list, cpt, link) { - const char *link_name = static_cast(link)->getName(); + const char *link_name = static_cast( + link)->getName(); current = new_xbt_graph_node(graph, link_name, nodes); current_name = link_name; new_xbt_graph_edge(graph, previous, current, edges); @@ -469,3 +480,6 @@ void AsGeneric::srcDstCheck(RoutingEdge *src, RoutingEdge *dst) dst_as->p_name, p_name); } + +} +} diff --git a/src/surf/surf_routing_generic.hpp b/src/surf/surf_routing_generic.hpp index d397ae19b9..f01fdd9767 100644 --- a/src/surf/surf_routing_generic.hpp +++ b/src/surf/surf_routing_generic.hpp @@ -11,9 +11,10 @@ #ifndef SURF_ROUTING_GENERIC_HPP_ #define SURF_ROUTING_GENERIC_HPP_ -class XBT_PRIVATE AsGeneric; +namespace simgrid { +namespace surf { -void generic_free_route(sg_platf_route_cbarg_t route); +class XBT_PRIVATE AsGeneric; class XBT_PRIVATE AsGeneric : public AsNone { public: @@ -42,4 +43,7 @@ public: virtual void srcDstCheck(RoutingEdge *src, RoutingEdge *dst); }; +} +} + #endif /* SURF_ROUTING_GENERIC_HPP_ */ diff --git a/src/surf/surf_routing_none.cpp b/src/surf/surf_routing_none.cpp index 4652b56490..190604762a 100644 --- a/src/surf/surf_routing_none.cpp +++ b/src/surf/surf_routing_none.cpp @@ -10,9 +10,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf"); AS_t model_none_create(void) { - return new AsNone(); + return new simgrid::surf::AsNone(); } +namespace simgrid { +namespace surf { + xbt_dynar_t AsNone::getOneLinkRoutes() { return NULL; } @@ -70,3 +73,5 @@ AsNone::~AsNone() { xbt_dynar_free(&p_linkUpDownList); } +} +} diff --git a/src/surf/surf_routing_none.hpp b/src/surf/surf_routing_none.hpp index e69fade8d5..472aa08605 100644 --- a/src/surf/surf_routing_none.hpp +++ b/src/surf/surf_routing_none.hpp @@ -11,6 +11,9 @@ #ifndef SURF_ROUTING_NONE_HPP_ #define SURF_ROUTING_NONE_HPP_ +namespace simgrid { +namespace surf { + class XBT_PRIVATE AsNone : public As { public: AsNone(); @@ -32,5 +35,7 @@ public: void parseBypassroute(sg_platf_route_cbarg_t e_route); }; +} +} #endif /* SURF_ROUTING_NONE_HPP_ */ diff --git a/src/surf/surf_routing_private.hpp b/src/surf/surf_routing_private.hpp index 4f10bc16e8..b6aee9fa38 100644 --- a/src/surf/surf_routing_private.hpp +++ b/src/surf/surf_routing_private.hpp @@ -67,9 +67,9 @@ XBT_PRIVATE void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route); /* ************************************************** */ /* ************** Cluster ROUTING **************** */ -XBT_PRIVATE As *model_cluster_create(void); /* create structures for cluster routing model */ -XBT_PRIVATE As *model_torus_cluster_create(void); -XBT_PRIVATE As *model_fat_tree_cluster_create(void); +XBT_PRIVATE surf_As *model_cluster_create(void); /* create structures for cluster routing model */ +XBT_PRIVATE surf_As *model_torus_cluster_create(void); +XBT_PRIVATE surf_As *model_fat_tree_cluster_create(void); /* ************************************************** */ /* ************** Vivaldi ROUTING **************** */ diff --git a/src/surf/surf_routing_vivaldi.cpp b/src/surf/surf_routing_vivaldi.cpp index bb993082df..b0ae9c2ea6 100644 --- a/src/surf/surf_routing_vivaldi.cpp +++ b/src/surf/surf_routing_vivaldi.cpp @@ -20,9 +20,12 @@ static XBT_INLINE double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dyn AS_t model_vivaldi_create(void) { - return new AsVivaldi(); + return new simgrid::surf::AsVivaldi(); } +namespace simgrid { +namespace surf { + void AsVivaldi::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat) { s_surf_parsing_link_up_down_t info; @@ -106,3 +109,6 @@ int AsVivaldi::parsePU(RoutingEdge *elm) { xbt_dynar_push_as(p_indexNetworkElm, sg_routing_edge_t, elm); return xbt_dynar_length(p_indexNetworkElm)-1; } + +} +} diff --git a/src/surf/surf_routing_vivaldi.hpp b/src/surf/surf_routing_vivaldi.hpp index 6d1094c3d2..0ebfef3ef5 100644 --- a/src/surf/surf_routing_vivaldi.hpp +++ b/src/surf/surf_routing_vivaldi.hpp @@ -18,6 +18,9 @@ XBT_PRIVATE AS_t model_vivaldi_create(void); /* create structures for vival #define ROUTER_PEER(peername) bprintf("router_%s", peername) #define LINK_PEER(peername) bprintf("link_%s", peername) +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -44,5 +47,7 @@ public: //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; }; +} +} #endif /* SURF_ROUTING_VIVALDI_HPP_ */ diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index 0f2de4d551..8b5946ecb6 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -10,15 +10,18 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf, "Logging specific to the SURF VM module"); -VMModel *surf_vm_model = NULL; +simgrid::surf::VMModel *surf_vm_model = NULL; + +namespace simgrid { +namespace surf { /************* * Callbacks * *************/ -surf_callback(void, VirtualMachine*) VMCreatedCallbacks; -surf_callback(void, VirtualMachine*) VMDestructedCallbacks; -surf_callback(void, VirtualMachine*) VMStateChangedCallbacks; +surf_callback(void, simgrid::surf::VirtualMachine*) VMCreatedCallbacks; +surf_callback(void, simgrid::surf::VirtualMachine*) VMDestructedCallbacks; +surf_callback(void, simgrid::surf::VirtualMachine*) VMStateChangedCallbacks; /********* * Model * @@ -69,3 +72,5 @@ surf_resource_t VirtualMachine::getPm() //FIME:: handle action cancel +} +} diff --git a/src/surf/virtual_machine.hpp b/src/surf/virtual_machine.hpp index 0dbf8e7617..795ae2ef8e 100644 --- a/src/surf/virtual_machine.hpp +++ b/src/surf/virtual_machine.hpp @@ -14,6 +14,9 @@ #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM // It corresponds to the cost of a VM running no tasks. +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -28,17 +31,17 @@ class XBT_PRIVATE VirtualMachine; /** @ingroup SURF_callbacks * @brief Callbacks fired after VM creation. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMCreatedCallbacks; +extern XBT_PRIVATE surf_callback(void, simgrid::surf::VirtualMachine*) VMCreatedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks fired after VM destruction. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMDestructedCallbacks; +extern XBT_PRIVATE surf_callback(void, simgrid::surf::VirtualMachine*) VMDestructedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks after VM State changes. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMStateChangedCallbacks; +extern XBT_PRIVATE surf_callback(void, simgrid::surf::VirtualMachine*) VMStateChangedCallbacks; /************ * Resource * @@ -59,7 +62,7 @@ public: * @param netElm The RoutingEdge associated to this VM * @param cpu The Cpu associated to this VM */ - VirtualMachine(Model *model, const char *name, xbt_dict_t props, + VirtualMachine(simgrid::surf::Model *model, const char *name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu); /** @brief Destructor */ @@ -130,4 +133,7 @@ public: * Action * **********/ +} +} + #endif /* VM_INTERFACE_HPP_ */ diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 09eefddd1d..295421bbdf 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -13,13 +13,15 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_vm); void surf_vm_model_init_HL13(void){ if (surf_cpu_model_vm) { - surf_vm_model = new VMHL13Model(); - Model *model = surf_vm_model; - + surf_vm_model = new simgrid::surf::VMHL13Model(); + simgrid::surf::Model *model = surf_vm_model; xbt_dynar_push(all_existing_models, &model); } } +namespace simgrid { +namespace surf { + /********* * Model * *********/ @@ -356,3 +358,6 @@ Action *VMHL13::execute(double size) Action *VMHL13::sleep(double duration) { return p_cpu->sleep(duration); } + +} +} diff --git a/src/surf/vm_hl13.hpp b/src/surf/vm_hl13.hpp index 894d7429de..411620d99b 100644 --- a/src/surf/vm_hl13.hpp +++ b/src/surf/vm_hl13.hpp @@ -15,6 +15,9 @@ #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM // It corresponds to the cost of a VM running no tasks. +namespace simgrid { +namespace surf { + /*********** * Classes * ***********/ @@ -78,4 +81,7 @@ public: * Action * **********/ +} +} + #endif /* SURF_VM_HPP_ */