]> gerrit.simantics Code Review - simantics/3d.git/blob - vtk/src/vtk/vtkJavaMemoryManager.java
Include old 64-bit versions of org.jcae.opencascade and vtk bundles
[simantics/3d.git] / vtk / src / vtk / vtkJavaMemoryManager.java
1 package vtk;
2
3 /**
4  * This interface provide all the methods needed for the management of vtkObject
5  * in the Java world. They are used internally inside the generated Java code of
6  * the VTK objects to keep track of the reference count of the corresponding VTK
7  * C++ object and therefore allow to release memory when it became possible.
8  *
9  * Only the 3 following methods should be called by the user: - gc(boolean) : to
10  * run the garbage collection - getAutoGarbageCollector() : to get the EDT
11  * garbage collection scheduler - deleteAll() : to free any remaining VTK
12  * object.
13  *
14  * @author sebastien jourdain - sebastien.jourdain@kitware.com
15  */
16 public interface vtkJavaMemoryManager {
17     /**
18      * Create or return an existing instance of the vtkObject that corresponds
19      * to the pointer id vtkId.
20      *
21      * @param vtkId
22      *            is used to uniquely identify a vtkObject inside the C++ layer.
23      *
24      * @return a java object that map its underlying C++ instance.
25      */
26     vtkObjectBase getJavaObject(Long vtkId);
27
28     /**
29      * Store the Java instance of a vtkObject inside a weak pointer map.
30      *
31      * @param id
32      *            is used to uniquely identify a vtkObject inside the C++ layer.
33      * @param obj
34      *            is the Java instance that is stored inside a WeakPointer of
35      *            the map.
36      */
37     void registerJavaObject(Long id, vtkObjectBase obj);
38
39     /**
40      * If found the Java object is removed from the map and we decrease the
41      * reference count of the underneath C++ instance.
42      *
43      * @param id
44      */
45     void unRegisterJavaObject(Long id);
46
47     /**
48      * Execute the garbage collection in the Java + VTK context to release Java
49      * instance that are not used anymore which keep holding a C++ instance
50      * around.
51      *
52      * @param debug
53      *            allow to add extra information inside the return object such
54      *            as the class name of the objects lefts as well as their
55      *            numbers.
56      *
57      * @return an information object that provide useful informations for
58      *         statistic or debuging purpose.
59      */
60     vtkReferenceInformation gc(boolean debug);
61
62     /**
63      * @return an helper class that allow to trigger the garbage collector at a
64      *         given frequency inside the EDT.
65      */
66     vtkJavaGarbageCollector getAutoGarbageCollector();
67
68     /**
69      * This method will clean up the Map of the Java objects and will release
70      * any vtkObject that was held by a Java one. This will prevent you from
71      * using any existing VTK Java object.
72      *
73      * @return the size of the map that we cleared
74      */
75     int deleteAll();
76
77     /**
78      * @return the number of vtkObject that are currently used inside the Java
79      *         world.
80      */
81     int getSize();
82
83     /**
84      * @return the vtkReferenceInformation object generated by the last gc() call
85      */
86     vtkReferenceInformation getLastReferenceInformation();
87 }