Camel.ObjectBag¶
Fields¶
None
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Camel.ObjectBag¶
-
- add(key, object)¶
- Parameters:
object (
object
orNone
) – aGObject.Object
Adds object to self. The key MUST have been previously reserved using
Camel.ObjectBag.reserve
().
- destroy()¶
Frees self. As a precaution, the function will emit a warning to standard error and return without freeing self if self still has reserved keys.
- get(key)¶
- Parameters:
- Returns:
the object corresponding to key, or
None
if not found- Return type:
Lookup an object by key. If the key is currently reserved, the function will block until another thread commits or aborts the reservation. The caller owns the reference to the returned object. Use
GObject.Object.unref
() to unreference it.
- list()¶
- Returns:
an array of objects in self
- Return type:
Returns a
GLib.PtrArray
of all the objects in the bag. The caller owns both the array and the object references, so to free the array use:g_ptr_array_foreach (array, (GFunc) g_object_unref, NULL); g_ptr_array_free (array, TRUE);
- peek(key)¶
- Parameters:
- Returns:
the object for key, or
None
if key is reserved or not found- Return type:
Returns the object for key in self, ignoring any reservations. If it isn’t committed, then it isn’t considered. This should only be used where reliable transactional-based state is not required.
Unlink other “peek” operations, the caller owns the returned object reference. Use
GObject.Object.unref
() to unreference it.
- rekey(object, new_key)¶
- Parameters:
object (
object
orNone
) – aGObject.Object
Changes the key for object to new_key, atomically.
It is considered a programming error if object is not found in self. In such case the function will emit a terminal warning and return.
- remove(object)¶
- Parameters:
object (
object
orNone
) – aGObject.Object
Removes object from self.
- reserve(key)¶
- Parameters:
- Returns:
the object for key, or
None
if key is not found- Return type:
Reserves key in self. If key is already reserved in another thread, then wait until the reservation has been committed.
After reserving key, you either get a reference to the object corresponding to key (similar to
Camel.ObjectBag.get
()) or you getNone
, signifying that you MUST call eitherCamel.ObjectBag.add
() orCamel.ObjectBag.abort
().