Data Structures

sst/elements/genericProc/programs/libcprops/linked_list.h File Reference

linked list definitions More...

#include "common.h"
#include "config.h"
#include "collection.h"
#include "mempool.h"

Go to the source code of this file.

Data Structures

struct  _cp_list_entry
 Internal object that references the content and links to the neighbour entries. More...
struct  _cp_list
 doubly linked list type. More...
struct  _cp_list_iterator
 iterator helper-class of cp_list. More...



#define cp_list_rdlock(list)   cp_list_lock(list, COLLECTION_LOCK_READ)
 Set a read lock on the object.
#define cp_list_wrlock(list)   cp_list_lock(list, COLLECTION_LOCK_WRITE)
 Set a write lock on the object.
__BEGIN_DECLS typedef
CPROPS_DLL struct
_cp_list_entry 
cp_list_entry
 Internal object that references the content and links to the neighbour entries.
typedef CPROPS_DLL struct _cp_list cp_list
 doubly linked list type.
typedef CPROPS_DLL struct
_cp_list_iterator 
cp_list_iterator
 iterator helper-class of cp_list.
CPROPS_DLL cp_listcp_list_create ()
 Default constructor.
CPROPS_DLL cp_listcp_list_create_nosync ()
CPROPS_DLL cp_listcp_list_create_list (int mode, cp_compare_fn compare_fn, cp_copy_fn copy_fn, cp_destructor_fn item_destructor)
 Constructor.
CPROPS_DLL cp_listcp_list_create_view (int mode, cp_compare_fn compare_fn, cp_copy_fn copy_fn, cp_destructor_fn item_destructor, cp_lock *lock)
CPROPS_DLL void cp_list_destroy (cp_list *)
 Destroy the object with the mode stored in the list.
CPROPS_DLL void cp_list_destroy_by_option (cp_list *list, int option)
 Destroy the object with the specified mode (override default).
CPROPS_DLL void cp_list_destroy_custom (cp_list *list, cp_destructor_fn fn)
 Destroy the object and all contained elements.
CPROPS_DLL void * cp_list_insert (cp_list *list, void *item)
 Insert a new element at the beginning of the list.
CPROPS_DLL void * cp_list_remove (cp_list *list, void *item)
 Remove the element from the list.
CPROPS_DLL void * cp_list_insert_after (cp_list *list, void *item, void *existing)
 Insert the element after an existing one.
CPROPS_DLL void * cp_list_insert_before (cp_list *list, void *item, void *existing)
 Insert the element before an existing one.
CPROPS_DLL void * cp_list_search (cp_list *list, void *item)
 Get the first element that equals the parameter.
CPROPS_DLL int cp_list_callback (cp_list *l, int(*item_action)(void *, void *), void *id)
 run a callback on each item.
CPROPS_DLL void * cp_list_append (cp_list *list, void *item)
 Append the element at the end of the list.
CPROPS_DLL void * cp_list_get_head (cp_list *list)
 Returns the first element of the list.
CPROPS_DLL void * cp_list_get_tail (cp_list *list)
 Returns the last element of the list.
CPROPS_DLL void * cp_list_remove_head (cp_list *list)
 remove and release first entry
CPROPS_DLL void * cp_list_remove_tail (cp_list *list)
 remove and release last entry
CPROPS_DLL int cp_list_is_empty (cp_list *list)
 Test if object is empty.
CPROPS_DLL long cp_list_item_count (cp_list *)
 Get the number of elements in the collection.
CPROPS_DLL int cp_list_lock (cp_list *list, int mode)
 Locks the collection with the specified mode.
CPROPS_DLL int cp_list_unlock (cp_list *list)
 Unlock the object.
CPROPS_DLL int cp_list_use_mempool (cp_list *list, cp_mempool *pool)
CPROPS_DLL int cp_list_share_mempool (cp_list *list, cp_shared_mempool *pool)
CPROPS_DLL int cp_list_iterator_init (cp_list_iterator *iterator, cp_list *list, int lock_mode)
 Initialize the Iterator at the first position.
CPROPS_DLL int cp_list_iterator_init_tail (cp_list_iterator *iterator, cp_list *list, int lock_mode)
 Initialize the Iterator at the end.
CPROPS_DLL cp_list_iteratorcp_list_create_iterator (cp_list *list, int lock_mode)
 create a new iterator and initialize it at the beginning of the list.
CPROPS_DLL int cp_list_iterator_head (cp_list_iterator *iterator)
 Move the iterator to the beginning of the list.
CPROPS_DLL int cp_list_iterator_tail (cp_list_iterator *iterator)
 Move the iterator to the end of the list.
CPROPS_DLL int cp_list_iterator_destroy (cp_list_iterator *iterator)
CPROPS_DLL int cp_list_iterator_release (cp_list_iterator *iterator)
 unlock the list the iterator is operating on.
CPROPS_DLL void * cp_list_iterator_next (cp_list_iterator *iterator)
 Go to the next entry in the list and return the content.
CPROPS_DLL void * cp_list_iterator_prev (cp_list_iterator *iterator)
 Go to the previous entry in the list and return the content.
CPROPS_DLL void * cp_list_iterator_curr (cp_list_iterator *iterator)
 returns the value at the current iterator position
CPROPS_DLL void * cp_list_iterator_insert (cp_list_iterator *iterator, void *item)
 insert item to the list just before the current iterator position.
CPROPS_DLL void * cp_list_iterator_append (cp_list_iterator *iterator, void *item)
 append item to the list just after the current iterator position.
CPROPS_DLL void * cp_list_iterator_remove (cp_list_iterator *iterator)
 delete the item at the current iterator position.

Detailed Description

linked list definitions