}
-
+%typemap(out) disown_helper {
+#ifdef SWIGRUBY
+ SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
+#endif
+#ifdef SWIGPYTHON
+ SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
+#endif
+#ifdef SWIGPERL
+ SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
+#endif
+ $result = SWIG_From_int((int)(0));
+}
%include "typemaps.i"
typedef Dataiterator Datamatch;
+typedef int disown_helper;
+
%}
#ifdef SWIGRUBY
Pool *pool = pool_create();
return pool;
}
- ~Pool() {
- }
void set_debuglevel(int level) {
pool_setdebuglevel($self, level);
}
}
#endif
- void free() {
+ ~Pool() {
Pool_set_loadcallback($self, 0);
pool_free($self);
}
+ disown_helper free() {
+ Pool_set_loadcallback($self, 0);
+ pool_free($self);
+ return 0;
+ }
+ disown_helper disown() {
+ return 0;
+ }
Id str2id(const char *str, bool create=1) {
return pool_str2id($self, str, create);
}
.\" Title: Libsolv-Bindings
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\" Date: 04/03/2014
+.\" Date: 04/04/2014
.\" Manual: LIBSOLV
.\" Source: libsolv
.\" Language: English
.\"
-.TH "LIBSOLV\-BINDINGS" "3" "04/03/2014" "libsolv" "LIBSOLV"
+.TH "LIBSOLV\-BINDINGS" "3" "04/04/2014" "libsolv" "LIBSOLV"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.RE
.\}
.sp
-Create a new pool instance\&. In most cases you just need one pool\&.
+Create a new pool instance\&. In most cases you just need one pool\&. Note that the returned object "owns" the pool, i\&.e\&. if the object is freed, the pool is also freed\&. You can use the disown method to break this ownership relation\&.
.SS "ATTRIBUTES"
.sp
.if n \{\
.RE
.\}
.sp
-Free a pool\&. This is currently done with a method instead of relying on reference counting or garbage collection because it\(cqs hard to track every reference to a pool\&.
+Force a free of the pool\&. After this call, you must not access any object that still references the pool\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+\fBvoid disown()\fR
+\fI$pool\fR\fB\->disown()\fR;
+\fIpool\fR\fB\&.disown()\fR
+\fIpool\fR\fB\&.disown()\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Break the ownership relation betwen the binding object and the pool\&. After this call, the pool will not get freed even if the object goes out of scope\&. This also means that you must manually call the free method to free the pool data\&.
.sp
.if n \{\
.RS 4
pool = solv.Pool()
pool = Solv::Pool.new()
-Create a new pool instance. In most cases you just need
-one pool.
+Create a new pool instance. In most cases you just need one pool.
+Note that the returned object "owns" the pool, i.e. if the object is
+freed, the pool is also freed. You can use the disown method to
+break this ownership relation.
=== ATTRIBUTES ===
pool.free()
pool.free()
-Free a pool. This is currently done with a method instead of relying on
-reference counting or garbage collection because it's hard to track every
-reference to a pool.
+Force a free of the pool. After this call, you must not access any object
+that still references the pool.
+
+ void disown()
+ $pool->disown();
+ pool.disown()
+ pool.disown()
+
+Break the ownership relation betwen the binding object and the pool. After
+this call, the pool will not get freed even if the object goes out of
+scope. This also means that you must manually call the free method to free
+the pool data.
void setdebuglevel(int level)
$pool->setdebuglevel($level);