Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4d69190b74ced59e1c1fbb55eff4b315567a8ed0
[simgrid.git] / src / bindings / java / surf.i
1 /* File : example.i */
2 %module(directors="1") Surf
3
4 %pragma(java) jniclassimports=%{
5 import org.simgrid.NativeLib;
6
7 %}
8 %pragma(java) jniclasscode=%{
9   static {
10     NativeLib.nativeInit("surf-java");
11   }
12 %}
13
14 %{
15 #include "src/surf/cpu_interface.hpp"
16 #include "src/surf/network_interface.hpp"
17 #include "src/bindings/java/surf_swig.hpp"
18 #include "src/xbt/dict_private.h"
19 typedef struct lmm_constraint *lmm_constraint_t;
20 %}
21
22 %feature("director") Plugin;
23
24 %include "src/bindings/java/surf_swig.hpp"
25
26 %nodefaultctor Model;
27 class Model {
28 public:
29   const char *getName();
30 };
31
32 class Resource {
33 public:
34   Resource();
35   const char *getName();
36   virtual bool isUsed()=0;
37   lmm_constraint *getConstraint();
38   s_xbt_dict *getProperties();
39 };
40
41 class Cpu : public Resource {
42 public:
43   Cpu();
44   ~Cpu();
45   double getCurrentPowerPeak();
46 };
47
48 class NetworkLink : public Resource {
49 public:
50   NetworkLink();
51   ~NetworkLink();
52 };
53
54 class Action {
55 public:
56   Model *getModel();
57 };
58
59 class CpuAction : public Action {
60 public:
61 %extend {
62   Cpu *getCpu() {return getActionCpu($self);}
63 }
64 };
65
66 %nodefaultctor NetworkAction;
67 class NetworkAction : public Action {
68 public:
69 %extend {
70   double getLatency() {return $self->m_latency;}
71 }
72 };
73
74
75 %rename lmm_constraint LmmConstraint;
76 struct lmm_constraint {
77 %extend {
78   double getUsage() {return lmm_constraint_get_usage($self);}
79 }
80 };
81
82 %rename s_xbt_dict XbtDict;
83 struct s_xbt_dict {
84 %extend {
85   char *getValue(char *key) {return (char*)xbt_dict_get_or_null($self, key);}
86 }
87 };
88