Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Linked List Utility Functions


Functions

EXTERNRT Asn1RTDListNode * rtDListAppend (ASN1CTXT *ctxt_p, Asn1RTDList *pList, void *pData)
EXTERNRT void rtDListInit (Asn1RTDList *pList)
EXTERNRT Asn1RTDListNode * rtDListInsert (ASN1CTXT *ctxt_p, Asn1RTDList *pList, int index, void *pData)
EXTERNRT Asn1RTDListNode * rtDListInsertBefore (ASN1CTXT *ctxt_p, Asn1RTDList *pList, Asn1RTDListNode *node, void *pData)
EXTERNRT Asn1RTDListNode * rtDListInsertAfter (ASN1CTXT *ctxt_p, Asn1RTDList *pList, Asn1RTDListNode *node, void *pData)
EXTERNRT Asn1RTDListNode * rtDListFindByIndex (Asn1RTDList *pList, int index)
EXTERNRT Asn1RTDListNode * rtDListFindByData (Asn1RTDList *pList, void *data)
EXTERNRT int rtDListFindIndexByData (Asn1RTDList *pList, void *data)
EXTERNRT void rtDListRemove (Asn1RTDList *pList, Asn1RTDListNode *node)
EXTERNRT void rtDListFreeNodes (ASN1CTXT *ctxt_p, Asn1RTDList *pList)
EXTERNRT void rtDListFreeAll (ASN1CTXT *ctxt_p, Asn1RTDList *pList)
EXTERNRT int rtDListToArray (ASN1CTXT *ctxt_p, Asn1RTDList *pList, void **ppArray, ASN1UINT *pElements, int elemSize)
EXTERNRT void rtDListAppendArray (ASN1CTXT *ctxt_p, Asn1RTDList *pList, ASN1ConstVoidPtr pArray, ASN1UINT numElements, int elemSize)
EXTERNRT void rtDListAppendArrayCopy (ASN1CTXT *ctxt_p, Asn1RTDList *pList, ASN1ConstVoidPtr pArray, ASN1UINT numElements, int elemSize)
EXTERNRT Asn1RTDListNode * rtDListAppendNode (ASN1CTXT *ctxt_p, Asn1RTDList *pList, void *pData)

Detailed Description

Linked list and stack utility functions are used to maintain linked lists and stacks used within the ASN.1 run-time library functions.

Function Documentation

EXTERNRT Asn1RTDListNode* rtDListAppend ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
void *  pData
 

This function appends an item to the linked list structure. The data item is passed into the function as a void pointer that can point to any object of any type. The rtMemAlloc function is used to allocated the memory for the list node structure; therefore, all internal list memory will be released whenever rtMemFree is called. The pointer to the data item itself is stored in the node structure - a copy is not made.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.
pData A pointer to a data item to be appended to the list.
Returns:
A pointer to an allocated node structure used to link the given data value into the list.

EXTERNRT void rtDListAppendArray ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
ASN1ConstVoidPtr  pArray,
ASN1UINT  numElements,
int  elemSize
 

This function appends an array items' pointers into a doublly linked list structure.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure. A pointer to an updated linked list structure. The elements from the array will be appended to the end of the list.
pArray A pointer to the source array to be converted.
numElements The number of elements in the array.
elemSize The size of one element in the array. Use sizeof() operator to pass this parameter.

EXTERNRT void rtDListAppendArrayCopy ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
ASN1ConstVoidPtr  pArray,
ASN1UINT  numElements,
int  elemSize
 

This function appends a copy of an array's items into a doubly linked list structure. This memory for copies is allocated via calls to rtMemAlloc.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure. A pointer to an updated linked list structure. The elements from the array will be appended to the end of the list.
pArray A pointer to the source array to be converted.
numElements The number of elements in the array.
elemSize The size of one element in the array. Use sizeof() operator to pass this parameter.

EXTERNRT Asn1RTDListNode* rtDListAppendNode ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
void *  pData
 

This function appends an item to a linked list structure. In cotrast to rtDListAppend, this function does not allocate the memory for the node strcture. The memory for node structure is taken by subtracting sizeof(Asn1RTDListNode) from the pData pointer. Thus, the memory for the data should be allocated using ALLOC_ASN1ELEMDNODE macro. This function works faster than rtDListAppend because one memory allocation is used.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to the updated linked list structure.
pData A pointer to the data item to be appended to the list.
Returns:
A pointer to the allocated node used to link the given data value into the list.

EXTERNRT Asn1RTDListNode* rtDListFindByData Asn1RTDList *  pList,
void *  data
 

This function gets a node from a linked list structure that contains a specific data value. The comparison is done on the pointer values, not the data objects themselves.

Parameters:
pList A pointer to a linked list structure onto which the data item is to be appended.
data A pointer to the data item to be found in the list.
Returns:
A pointer to the found node structure. NULL is returned if a matching node could be found.

EXTERNRT Asn1RTDListNode* rtDListFindByIndex Asn1RTDList *  pList,
int  index
 

This function gets a node from a linked list structure at a specified index.

Parameters:
pList A pointer to a linked list structure onto which the data item is to be appended.
index A relative zero-based index of the node in the list to be returned.
Returns:
The pointer to the found node structure. NULL, if the node is not found.

EXTERNRT int rtDListFindIndexByData Asn1RTDList *  pList,
void *  data
 

This function gets a node's index from a linked list structure that contains a specific data value. The comparison is done on the pointer values, not the data objects themselves.

Parameters:
pList A pointer to a linked list structure onto which the data item is to be appended.
data A pointer to the data item to be found in the list.
Returns:
The index of the node that contains specified data. Negative one (-1) is returned if matching node could not be found.

EXTERNRT void rtDListFreeAll ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList
 

This function removes all nodes from the linked list structure and releases the memory that was allocated for storing nodes' structures (Asn1RTDListNode) and for data. The memory for data in each node must have been previously allocated with calls to rtMemAlloc, rtMemAllocZ, or rtMemRealloc functions.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure. A pointer to an empty linked list structure.

EXTERNRT void rtDListFreeNodes ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList
 

This function removes all nodes from the linked list and releases the memory that was allocated for storing nodes' structures (Asn1RTDListNode). The data will not be released.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.

EXTERNRT void rtDListInit Asn1RTDList *  pList  ) 
 

This function initializes a doubly linked list structure. It sets the number of elements to zero and sets al internal pointer values to NULL. A doubly linked-list structure is described by the Asn1RTDList type defined in asn1type.h. Nodes of the list are of type Asn1RTDListNode.

Memory for the structures is allocated using the rtMemAlloc run-time function and is maintained within the context structure that is a required parameter to all rtDList functions. This memory is released when rtMemFree is called or the Context is released. Unless otherwise noted, all data passed into the list functions is simply stored on the list by value (i.e. a deep-copy of the data is not done).

Parameters:
pList A pointer to a linked list structure to be initialized.

EXTERNRT Asn1RTDListNode* rtDListInsert ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
int  index,
void *  pData
 

This function inserts an item into the linked list structure. The data item is passed into the function as a void pointer that can point to an object of any type. The rtMemAlloc function is used to allocate the memory for the list node structure; therefore, all internal list memory will be released whenever the rtMemFree is called.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.
index An index at which the specified item is to be inserted.
pData A pointer to a data item to be inserted to the list.
Returns:
A pointer to an allocated node structure used to link the given data value into the list.

EXTERNRT Asn1RTDListNode* rtDListInsertAfter ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
Asn1RTDListNode *  node,
void *  pData
 

This function inserts an item into a linked list structure after a specified node. The data item is passed into the function as a void pointer that can point to any type. The rtMemAlloc function is used to allocate the memory for the list structure; therefore, all internal list memory will be released whenever the rtMemFree is called.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.
node A pointer to the node after which the specified item is to be inserted. It should already be in the linked list structure.
pData A pointer to a data item to be inserted to the list.
Returns:
A pointer to an allocated node structure used to link the given data value into the list

EXTERNRT Asn1RTDListNode* rtDListInsertBefore ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
Asn1RTDListNode *  node,
void *  pData
 

This function inserts an item into a linked list structure before a specified node. The data item is passed into the function as a void pointer that can point to an object of any type. The rtMemAlloc function is used to allocate the memory for the list node structure; therefore, all internal list memory will be released whenever the rtMemFree is called.

Parameters:
ctxt_p A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.
node A pointer to the node before which the specified item is to be inserted. It should already be in the linked list structure.
pData A pointer to a data item to be inserted to the list.
Returns:
A pointer to an allocated node structure used to link the given data value into the list.

EXTERNRT void rtDListRemove Asn1RTDList *  pList,
Asn1RTDListNode *  node
 

This function removes a node from the linked list structure. The rtMemAlloc function was used to allocate the memory for the list node structure, therefore, all internal list memory will be released whenever rtMemFree or rtMemFreePtr is called.

Parameters:
pList A pointer to a linked list structure onto which the data item is to be appended. A pointer to an updated linked list structure.
node A pointer to the node that is to be removed. It should already be in the linked list structure.

EXTERNRT int rtDListToArray ASN1CTXT *  ctxt_p,
Asn1RTDList *  pList,
void **  ppArray,
ASN1UINT *  pElements,
int  elemSize
 

Create and fill (or only fill) the array from doubly-linked list


This file was last modified on 11 Jun 2003.
ASN1C Run-time Common Function, Version 5.5