GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> DUMP / dev > dump / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

list.c File Reference

Functions to maintain the linked list of ID handlers. More...

#include <list_p.h>
#include <stdlib.h>

Functions

LL_nodeLL_newNode (LL_node *next, unsigned int uid, void *pay)
 Create a new linked-list node.
void LL_deleteNode (LL_node *handler)
 Delete a node.
void LL_deleteNextNode (LL_node *handler)
 Delete the next node.
int LL_newNextNode (LL_node *handler, unsigned int uid, void *pay)
 Create a new node.
LL_nodeLL_findPrevNode (LL_node *head, unsigned int uid)
 Find the previous node.
int LL_registerNode (LL_node *head, unsigned int uid, void *pay)
 Create a node with a unique ID.
void * LL_unregisterNode (LL_node *head, unsigned int uid)
 Remove the spcified node.
void * LL_getPayload (LL_node *head, unsigned int uid)
 Get the payload corresponding to a give id.
int LL_isPresent (LL_node *head, unsigned int uid)
 Check if an ID exists.


Detailed Description

Functions to maintain the linked list of ID handlers.

Author:
James Swain & Owen Saxton
Id
list.c,v 1.3 2011/03/28 19:01:32 saxton Exp

Function Documentation

void LL_deleteNextNode ( LL_node handler  ) 

Delete the next node.

This routine deletes from the linked list the node after the one pointed to.

Parameters:
handler Pointer to the node on the linked list preceding the one to be deleted

References LL_deleteNode(), and LL_node_::next.

Referenced by LL_unregisterNode().

void LL_deleteNode ( LL_node handler  ) 

Delete a node.

This routine frees the memory allocated to t node

Parameters:
handler Pointer to linked-list node to free

Referenced by LL_deleteNextNode().

LL_node* LL_findPrevNode ( LL_node head,
unsigned int  uid 
)

Find the previous node.

This routine scans the linked list until either the last node is reached, or the one immediately preceding the specified node.

Parameters:
head Pointer to the start of the list of LL handlers
uid Unique id of the node being sought
Returns:
Pointer to the node immediately before the one being sought or the last node of the list

References LL_node_::next, and LL_node_::uid.

Referenced by LL_getPayload(), LL_isPresent(), LL_registerNode(), and LL_unregisterNode().

void* LL_getPayload ( LL_node head,
unsigned int  uid 
)

Get the payload corresponding to a give id.

Parameters:
head Pointer to the start of the linked list
uid Unique ID
Returns:
Pointer to payload associated with the specified ID or NULL if the ID doesn't exist.

References LL_findPrevNode(), LL_node_::next, LL_node_::pay, and LL_node_::uid.

Referenced by DUMP_process().

int LL_isPresent ( LL_node head,
unsigned int  uid 
)

Check if an ID exists.

This routine searches for a node with the given ID.

Parameters:
head Pointer to the start of the linked list
uid Unique ID
Return values:
1 If there is a node on the list with this ID
Returns:
0 If no node has this ID

References LL_findPrevNode(), LL_node_::next, and LL_node_::uid.

int LL_newNextNode ( LL_node handler,
unsigned int  uid,
void *  pay 
)

Create a new node.

This routine creates a new node on the linked list immediately following the one indicated

Parameters:
handler Pointer to the node after which the new node is to be added
uid Unique ID
pay Pointer to the payload
Return values:
0 The insertion of a new node was successful
-1 The insertion of a new node failed because of a memory allocation error

References LL_newNode(), and LL_node_::next.

Referenced by LL_registerNode().

LL_node* LL_newNode ( LL_node next,
unsigned int  uid,
void *  pay 
)

Create a new linked-list node.

Parameters:
next Pointer to use as the next node for the new node
uid Unique id for this node
pay Pointer to the payload structure associated with this node
Returns:
Pointer to the new linked-list node, or NULL if there is memory allocation failure

References LL_node_::next, LL_node_::pay, and LL_node_::uid.

Referenced by LL_newNextNode().

int LL_registerNode ( LL_node head,
unsigned int  uid,
void *  pay 
)

Create a node with a unique ID.

This routine creates a node with the specified UID and payload. It is an error if a node with the ID already exists.

Parameters:
head Pointer to the start of the list of LL handlers
uid Unique id for this node
pay Pointer to the payload.
Return values:
0 The new node was successfully created
1 The ID already existed; use replace
-1 Memory allocation failed

References LL_findPrevNode(), LL_newNextNode(), LL_node_::next, and LL_node_::uid.

Referenced by DUMP_constructAstream().

void* LL_unregisterNode ( LL_node head,
unsigned int  uid 
)

Remove the spcified node.

This routine removes the node with the specified ID from a list, and returns its payload pointer.

Parameters:
head Pointer to the start of the list of LL handlers
uid Unique id for the node to remove
Returns:
Pointer to the payload of the unregistered node, or NULL if the node does not exist

References LL_deleteNextNode(), LL_findPrevNode(), LL_node_::next, LL_node_::pay, and LL_node_::uid.


Generated on Mon Mar 28 12:08:20 2011 by  doxygen 1.5.8