X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8ab9fbef9cd17e59a43126cd5ea214f4190db39e..f60c6c67576ca97e84d781811f9076c18f183b11:/src/bindings/java/surf.i diff --git a/src/bindings/java/surf.i b/src/bindings/java/surf.i index 28b4f6ea47..1553e77060 100644 --- a/src/bindings/java/surf.i +++ b/src/bindings/java/surf.i @@ -1,3 +1,9 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + /* File : example.i */ %module(directors="1") Surf @@ -40,9 +46,14 @@ JAVA_ARRAYSOFCLASSES(NetworkLink); %typemap(out) NetworkLinkDynar { long l = xbt_dynar_length($1); $result = jenv->NewLongArray(l); - NetworkLink **lout = (NetworkLink **)xbt_dynar_to_array($1); - jenv->SetLongArrayRegion($result, 0, l, (const jlong*)lout); - free(lout); + unsigned i; + NetworkLink *link; + jlong *elts = jenv->GetLongArrayElements($result, NULL); + xbt_dynar_foreach($1, i, link) { + elts[i] = (jlong)link; + } + jenv->ReleaseLongArrayElements($result, elts, 0); + xbt_dynar_free(&$1); } /* Allow to subclass Plugin and send java object to C++ code */ @@ -82,6 +93,7 @@ public: void updateLatency(double value, double date=surf_get_clock()); }; +%nodefaultctor Action; class Action { public: Model *getModel(); @@ -90,6 +102,7 @@ public: void setBound(double bound); }; +%nodefaultctor CpuAction; class CpuAction : public Action { public: %extend {