OpenClovis Logo

Files | Typedefs | Functions
API Reference Pages
Queue Library

Defines, Structures, Typedefs, Functions. More...

Files

file  clQueueApi.h
 Header file of Queue Management related APIs.

Typedefs

typedef ClPtrT ClQueueDataT
 The type of the handle for the user-data.
typedef void(* ClQueueDequeueCallbackT )(CL_IN ClQueueDataT userData)
 Dequeue callback gets called, whenever a Node is getting deleted.
typedef ClHandleT ClQueueNodeT
 The type of the handle for the queue node.
typedef ClPtrT ClQueueT
 The type of the handle for the queue.
typedef ClRcT(* ClQueueWalkCallbackT )(CL_IN ClQueueDataT userData, CL_IN void *userArg)
 Walk Callback gets called, whenever traverse happens on the Queue.

Functions

ClRcT clQueueCreate (CL_IN ClUint32T maxSize, CL_IN ClQueueDequeueCallbackT fpUserDequeueCallBack, CL_IN ClQueueDequeueCallbackT fpUserDestroyCallBack, CL_OUT ClQueueT *pQueueHandle)
 Creates a queue.
ClRcT clQueueDelete (CL_IN ClQueueT *pQueueHandle)
 Destroys the queue.
ClRcT clQueueNodeDelete (CL_IN ClQueueT queueHandle, CL_OUT ClQueueDataT *userData)
 Dequeues an element from the queue.
ClRcT clQueueNodeInsert (CL_IN ClQueueT queueHandle, CL_IN ClQueueDataT userData)
 Enqueues an element (user-data) into the Queue.
ClRcT clQueueSizeGet (CL_IN ClQueueT queueHandle, CL_OUT ClUint32T *pSize)
 Retrieves the number of data elements in the queue.
ClRcT clQueueWalk (CL_IN ClQueueT queueHandle, CL_IN ClQueueWalkCallbackT fpUserWalkFunction, CL_IN void *userArg)
 Walks through the queue.

Detailed Description

Defines, Structures, Typedefs, Functions.

Typedef Documentation

typedef void(* ClQueueDequeueCallbackT)(CL_IN ClQueueDataT userData)

Dequeue callback gets called, whenever a Node is getting deleted.

Header File:
clQueueApi.h
Parameters
userData(in) Data of the node is being deleted.
Return values
none
Description:
This dequeue callback function gets called, whenever user performs node deletion on the Queue. The Data of the node will be exposed to the user on the callback. This is the place where user can cleanup their data.
Library File:
ClUtil
See Also
clQueueCreate(), clQueueDelete()
typedef ClRcT(* ClQueueWalkCallbackT)(CL_IN ClQueueDataT userData, CL_IN void *userArg)

Walk Callback gets called, whenever traverse happens on the Queue.

Header File:
clQueueApi.h
Parameters
userData(in) Data of the node is being accessed.
userArg(in) User arg of the callback function
Return values
none
Description:
This Walk callback function gets called, whenever user performs traverse on the Queue.
Library File:
ClUtil
See Also
clQueueCreate(), clQueueDelete()

Function Documentation

ClRcT clQueueCreate ( CL_IN ClUint32T  maxSize,
CL_IN ClQueueDequeueCallbackT  fpUserDequeueCallBack,
CL_IN ClQueueDequeueCallbackT  fpUserDestroyCallBack,
CL_OUT ClQueueT pQueueHandle 
)

Creates a queue.

Header File:
clQueueApi.h
Parameters
maxSize(in) Maximum size of the Queue. It specifies the maximum number of elements that can exist at any point of time in the Queue. This must be an unsigned integer. You can enqueue elements into the queue until this maximum limit is reached. If you specify this parameter as 0, then there is no limit on the size of the Queue.
fpUserDequeueCallBack(in) Pointer to the user's dequeue callback function. This function accepts a parameter of type ClQueueDataT. After dequeueing, the dequeued user-data is passed as an argument to the callback function.
fpUserDestroyCallBack(in) Pointer to the user's destroy callback function. This function accepts a parameter of type ClQueueDataT. While destroying the queue by clQueueDelete(), for each element in the queue this callback function is called.
pQueueHandle(out) Pointer to the variable of type ClQueueT in which the function returns a valid Queue handle.
Return values
CL_OKThe API executed successfully.
CL_ERR_NO_MEMORYOn memory allocation failure.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
Note
Returned error is a combination of the component Id and error code. Use CL_GET_ERROR_CODE(RC) defined in clCommonErrors.h to get the error code.
Description:
This API is used to create and initialize a queue.
Library File:
ClUtil
See Also
clQueueCreate()
ClRcT clQueueDelete ( CL_IN ClQueueT pQueueHandle)

Destroys the queue.

Header File:
clQueueApi.h
Parameters
pQueueHandle(in)Pointer to the queue handle returned by clQueueCreate API.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle
Note
Returned error is a combination of the component Id and error code. Use CL_GET_ERROR_CODE(RET_CODE) defined in clCommonErrors.h to get the error code.
description:
This API is used to delete all the elements in the queue. The destroy callback function, registered during creation is called for every element in the queue.
Library File:
ClUtil
See Also
clQueueCreate()
ClRcT clQueueNodeDelete ( CL_IN ClQueueT  queueHandle,
CL_OUT ClQueueDataT userData 
)

Dequeues an element from the queue.

Header File:
clQueueApi.h
Parameters
queueHandle(in) Handle of queue returned by clQueueCreate API.
userData(out) Handle of userData, userData of the dequeued node will be returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NULL_POINTEROn passing null pointer of userData.
CL_ERR_NOT_EXISTIf the queue is empty.
Note
Returned error is a combination of the component Id and error code. Use CL_GET_ERROR_CODE(RET_CODE) defined in clCommonErrors.h to get the error code.
Description:
This API is used to dequeue the element from the front of the queue. The user dequeue callback, registered during the creation time, is called with the element (user-data) that is dequeued.
Library File:
ClUtil
See Also
clQueueCreate()
ClRcT clQueueNodeInsert ( CL_IN ClQueueT  queueHandle,
CL_IN ClQueueDataT  userData 
)

Enqueues an element (user-data) into the Queue.

Header File:
clQueueApi.h
Parameters
queueHandle(in) Handle of queue returned by clQueueCreate API.
userData(in) User-data. Memory allocation and deallocation for user-data must be done by you. The data of the node to be stored in the queue.
Return values
CL_OKThe API executed successfully.
CL_ERR_NO_MEMORYOn memory allocation failure.
CL_ERR_MAXSIZE_REACHEDIf the maximum size is reached.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
Note
Returned error is a combination of the component Id and error code. Use CL_GET_ERROR_CODE(RET_CODE) defined in clCommonErrors.h to get the error code.
Description:
This API is used to enqueue an element (user-data) into the queue.
Library File:
ClUtil
See Also
clQueueCreate()
ClRcT clQueueSizeGet ( CL_IN ClQueueT  queueHandle,
CL_OUT ClUint32T *  pSize 
)

Retrieves the number of data elements in the queue.

Header File:
clQueueApi.h
Parameters
queueHandle(in) Handle of queue returned by the clQueueCreate API.
pSize(out) Pointer to variable of type ClUint32T, in which the size of the queue is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL value for callback function.
CL_ERR_INVALID_HANDLEOn passing an invalid handle
Note
Returned error is a combination of the component Id and error code. Use CL_GET_ERROR_CODE(RET_CODE) defined in clCommonErrors.h to get the error code.
description:
This API is used to retrieve the number of data elements in the queue.
Library File:
ClUtil
See Also
clQueueCreate()
ClRcT clQueueWalk ( CL_IN ClQueueT  queueHandle,
CL_IN ClQueueWalkCallbackT  fpUserWalkFunction,
CL_IN void *  userArg 
)

Walks through the queue.

Header File:
clQueueApi.h
Parameters
queueHandle(in) handle of queue returned by clQueueCreate Api.
fpUserWalkFunction(in) pointer to the callback function. it accepts the following two parameters:
  • ClQueueDataT
  • void * each of elements in the queue is passed one by one as the first argument to the callback function.
userArg(in) user-specified argument. this variable is passed as the second argument to the user's call back function.
Return values
CL_OKthe api executed successfully.
CL_ERR_NULL_POINTERon passing a null pointer.
CL_ERR_INVALID_HANDLEon passing an invalid handle
Note
returned error is a combination of the component id and error code. use CL_GET_ERROR_CODE(RET_CODE) defined in clCommonErrors.h to get the error code.
Description
This Api is used to perform a walk on the queue. The user-specified callback function is called with every element (user data) in the queue.
Library File
ClUtil
See Also
clQueueCreate(), clQueueDelete()

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen