Open Files 5.3.0
Multi-Platform Event-Driven Application Framework
queue.h File Reference
#include "ofc/core.h"
#include "ofc/types.h"
#include "ofc/handle.h"
Include dependency graph for queue.h:

Go to the source code of this file.

Functions

OFC_CORE_LIB OFC_HANDLE ofc_queue_create (OFC_VOID)
 
OFC_CORE_LIB OFC_VOID ofc_queue_destroy (OFC_HANDLE qHead)
 
OFC_CORE_LIB OFC_VOID ofc_enqueue (OFC_HANDLE qHead, OFC_VOID *qElement)
 
OFC_CORE_LIB OFC_VOIDofc_dequeue (OFC_HANDLE qHead)
 
OFC_CORE_LIB OFC_BOOL ofc_queue_empty (OFC_HANDLE qHead)
 
OFC_CORE_LIB OFC_VOIDofc_queue_first (OFC_HANDLE qHead)
 
OFC_CORE_LIB OFC_VOIDofc_queue_next (OFC_HANDLE qHead, OFC_VOID *qElement)
 
OFC_CORE_LIB OFC_VOID ofc_queue_unlink (OFC_HANDLE qHead, OFC_VOID *qElement)
 
OFC_CORE_LIB OFC_VOID ofc_queue_clear (OFC_HANDLE qHandle)
 

Function Documentation

◆ ofc_dequeue()

OFC_CORE_LIB OFC_VOID* ofc_dequeue ( OFC_HANDLE  qHead)

Remove an element from the front of the list

Parameters
qHeadPointer to list header
Returns
Item at the front or OFC_NULL
Examples
smbcp.c, test_dg.c, test_file.c, and test_stream.c.

◆ ofc_enqueue()

OFC_CORE_LIB OFC_VOID ofc_enqueue ( OFC_HANDLE  qHead,
OFC_VOID qElement 
)

Add an element to the end of the list

Parameters
qHeadPointer to list header
qElementPointer to element to add to list
Examples
smbcp.c, test_dg.c, test_file.c, and test_stream.c.

◆ ofc_queue_clear()

OFC_CORE_LIB OFC_VOID ofc_queue_clear ( OFC_HANDLE  qHandle)

Clear the contents of a linked list

Parameters
qHandleHandle to the linked list
Remarks
All items on the list will be removed. If those items contain elements allocated from the heap, or if the items themselves were allocated from the heap, a leak will likely occur. Care should be taken to insure that either only static information is contained in the list, or the dynamic information is freed someother way.

◆ ofc_queue_create()

OFC_CORE_LIB OFC_HANDLE ofc_queue_create ( OFC_VOID  )

Create a linked list

Returns
Handle to the linked list
Examples
smbcp.c, test_dg.c, test_file.c, and test_stream.c.

◆ ofc_queue_destroy()

OFC_CORE_LIB OFC_VOID ofc_queue_destroy ( OFC_HANDLE  qHead)

Destroy a queue

Parameters
qHeadHead of queue
Examples
test_dg.c, test_file.c, and test_stream.c.

◆ ofc_queue_empty()

OFC_CORE_LIB OFC_BOOL ofc_queue_empty ( OFC_HANDLE  qHead)

See if queue is empty

Parameters
qHeadQueue Head
Returns
OFC_TRUE if empty, OFC_FALSE otherwise

◆ ofc_queue_first()

OFC_CORE_LIB OFC_VOID* ofc_queue_first ( OFC_HANDLE  qHead)

Return the head of the linked list

Parameters
qHeadPointer to the head of the list
Returns
Element that was at the front of the list
Examples
smbcp.c, test_dg.c, test_file.c, and test_stream.c.

◆ ofc_queue_next()

OFC_CORE_LIB OFC_VOID* ofc_queue_next ( OFC_HANDLE  qHead,
OFC_VOID qElement 
)

Return the next element on the list

Parameters
qHeadPointer to the head of the list
qElementPointer to the current element
Returns
Pointer to the next element
Examples
smbcp.c, test_dg.c, test_file.c, and test_stream.c.

◆ ofc_queue_unlink()

OFC_CORE_LIB OFC_VOID ofc_queue_unlink ( OFC_HANDLE  qHead,
OFC_VOID qElement 
)

Unlink the current element from the list

Parameters
qHeadPointer to the head of the list
qElementPointer to the current element
Examples
test_dg.c, and test_stream.c.