Package org.gnome.glib
Class TrashStack
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.glib.TrashStack
- All Implemented Interfaces:
Proxy
Deprecated.
A
GTrashStack
is an efficient way to keep a stack of unused allocated
memory chunks. Each memory chunk is required to be large enough to hold
a gpointer
. This allows the stack to be maintained without any space
overhead, since the stack pointers can be stored inside the memory chunks.
There is no function to create a GTrashStack
. A NULL
GTrashStack*
is a perfectly valid empty stack.
Each piece of memory that is pushed onto the stack is cast to a
GTrashStack*
.
There is no longer any good reason to use GTrashStack
. If you have
extra pieces of memory, free()
them and allocate them again later.
-
Constructor Summary
ConstructorDescriptionDeprecated.Allocate a new TrashStack.TrashStack
(Arena arena) Deprecated.Allocate a new TrashStack.TrashStack
(MemorySegment address) Deprecated.Create a TrashStack proxy instance for the provided memory address.TrashStack
(TrashStack next) Deprecated.Allocate a new TrashStack with the fields set to the provided values.TrashStack
(TrashStack next, Arena arena) Deprecated.Allocate a new TrashStack with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryLayout
Deprecated.The memory layout of the native struct.int
height()
Deprecated.peek()
Deprecated.pop()
Deprecated.void
push
(MemorySegment dataP) Deprecated.readNext()
Deprecated.Read the value of the fieldnext
.void
writeNext
(TrashStack next) Deprecated.Write a value in the fieldnext
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TrashStack
Deprecated.Create a TrashStack proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TrashStack
Deprecated.Allocate a new TrashStack.- Parameters:
arena
- to control the memory allocation scope
-
TrashStack
public TrashStack()Deprecated.Allocate a new TrashStack. The memory is allocated withArena.ofAuto()
. -
TrashStack
Deprecated.Allocate a new TrashStack with the fields set to the provided values.- Parameters:
next
- value for the fieldnext
arena
- to control the memory allocation scope
-
TrashStack
Deprecated.Allocate a new TrashStack with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
next
- value for the fieldnext
-
-
Method Details
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
readNext
Deprecated.Read the value of the fieldnext
.- Returns:
- The value of the field
next
-
writeNext
Deprecated.Write a value in the fieldnext
.- Parameters:
next
- The new value for the fieldnext
-
height
Deprecated.Returns the height of aGTrashStack
.Note that execution of this function is of O(N) complexity where N denotes the number of items on the stack.
- Returns:
- the height of the stack
-
peek
Deprecated.Returns the element at the top of aGTrashStack
which may benull
.- Returns:
- the element at the top of the stack
-
pop
Deprecated.Pops a piece of memory off aGTrashStack
.- Returns:
- the element at the top of the stack
-
push
Deprecated.Pushes a piece of memory onto aGTrashStack
.- Parameters:
dataP
- the piece of memory to push on the stack
-