Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
50f0fd6055d632fd8331441acaff0714dfaf75ab
[simgrid.git] / src / bindings / java / org / simgrid / surf / CpuAction.java
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 2.0.11
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8
9 package org.simgrid.surf;
10
11 /**
12   * An cpu action created by a Cpu
13   * @see CpuModel
14   * @see Cpu
15   */
16 public class CpuAction extends Action {
17   private long swigCPtr;
18
19   protected CpuAction(long cPtr, boolean cMemoryOwn) {
20     super(SurfJNI.CpuAction_SWIGUpcast(cPtr), cMemoryOwn);
21     swigCPtr = cPtr;
22   }
23
24   protected static long getCPtr(CpuAction obj) {
25     return (obj == null) ? 0 : obj.swigCPtr;
26   }
27
28   protected void finalize() {
29     delete();
30   }
31
32   public synchronized void delete() {
33     if (swigCPtr != 0) {
34       if (swigCMemOwn) {
35         swigCMemOwn = false;
36         SurfJNI.delete_CpuAction(swigCPtr);
37       }
38       swigCPtr = 0;
39     }
40     super.delete();
41   }
42
43   protected void swigDirectorDisconnect() {
44     swigCMemOwn = false;
45     delete();
46   }
47
48   public void swigReleaseOwnership() {
49     swigCMemOwn = false;
50     SurfJNI.CpuAction_change_ownership(this, swigCPtr, false);
51   }
52
53   public void swigTakeOwnership() {
54     swigCMemOwn = true;
55     SurfJNI.CpuAction_change_ownership(this, swigCPtr, true);
56   }
57
58   
59   /**
60     * CpuAction constructor
61     * @param model The model associated
62     * @param cost The cost of the action (e.g., flops, bytes)
63     * @param failed If the action has failed
64     */
65   public CpuAction(Model model, double cost, boolean failed) {
66     this(SurfJNI.new_CpuAction(Model.getCPtr(model), model, cost, failed), true);
67     SurfJNI.CpuAction_director_connect(this, swigCPtr, swigCMemOwn, true);
68   }
69
70   
71   /**
72     * @return The associated cpu
73     */
74   public Cpu getCpu() {
75   long cPtr = SurfJNI.CpuAction_getCpu(swigCPtr, this);
76   return (Cpu)Surf.getCpuDirector(cPtr);
77 }
78
79 }