Data Structures | Files | Defines | Typedefs | Functions

Cp_priority_list

Data Structures

struct  _cp_priority_list

Files

file  priority_list.h
 

push your data on a cp_priority_list then retrieve them by priority.


Defines

#define PRIORITY_LIST_IMMEDIATE   1
#define PRIORITY_LIST_NORMAL   2
#define cp_priority_list_create(immediate, normal_priorities, weights)
 Internal destructor.
#define cp_priority_list_get_next(l)   cp_priority_list_get_next_by_option((l), (l)->mode)
 Get the "first" entry of the list with default-mode.
#define cp_priority_list_rdlock(list)   cp_priority_list_lock(list, COLLECTION_LOCK_READ)
 Lock the collection for reading.
#define cp_priority_list_wrlock(list)   cp_priority_list_lock(list, COLLECTION_LOCK_WRITE)
 Lock the collection for writing.

Typedefs

typedef CPROPS_DLL struct
_cp_priority_list 
cp_priority_list

Functions

int cp_priority_list_txlock (cp_priority_list *list, int type)
int cp_priority_list_txunlock (cp_priority_list *list)
static void cp_priority_list_destroy_internal (cp_priority_list *list)
 Internal destructor.
void cp_priority_list_destroy (cp_priority_list *list)
 Destructor.
void cp_priority_list_destroy_by_option (cp_priority_list *list, int option)
 Destructor with locking option.
cp_priority_list * cp_priority_list_create_by_option (int immediate, int normal_priority_queues, int *weights, cp_compare_fn compare_fn, cp_copy_fn copy_fn, cp_destructor_fn item_destructor, int mode)
 Constructor with all parameters.
void * cp_priority_list_insert (cp_priority_list *list, void *item, int priority)
 Inserts an entry to the list with priority and default-mode.
void * cp_priority_list_insert_by_option (cp_priority_list *list, void *item, int priority, int mode)
 Inserts an entry to the list with priority and mode.
int cp_priority_list_is_empty (cp_priority_list *list)
 Test if object is empty.
void * cp_priority_list_get_next_by_option (cp_priority_list *list, int mode)
 Get the "first" entry of the list with mode.
int cp_priority_list_lock_internal (cp_priority_list *list, int lock_mode)
int cp_priority_list_unlock_internal (cp_priority_list *list)
int cp_priority_list_lock (cp_priority_list *list, int lock_mode)
 Lock the collection with mode.
int cp_priority_list_unlock (cp_priority_list *list)
 Unlock the collection.
int cp_priority_list_get_mode (cp_priority_list *list)
int cp_priority_list_set_mode (cp_priority_list *list, int mode)
int cp_priority_list_unset_mode (cp_priority_list *list, int mode)
long cp_priority_list_item_count (cp_priority_list *list)
 Number of entries in the whole collection.

Define Documentation

#define cp_priority_list_create (   immediate,
  normal_priorities,
  weights 
)
Value:
cp_priority_list_create_by_option(immediate, normal_priorities, weights, \
                                                NULL, NULL, NULL, COLLECTION_MODE_MULTIPLE_VALUES)

Internal destructor.

Simplified constructor.

Parameters:
immediate if true, create an immediate queue
normal_priority_queues 
weights table of weight factors
#define cp_priority_list_get_next (   l  )     cp_priority_list_get_next_by_option((l), (l)->mode)

Get the "first" entry of the list with default-mode.

The internal algorithm selects one of the non-empty list and returns the first entry of that list.

#define PRIORITY_LIST_IMMEDIATE   1

Function Documentation

CPROPS_DLL cp_priority_list * cp_priority_list_create_by_option ( int  immediate,
int  normal_priority_queues,
int *  weights,
cp_compare_fn  compare_fn,
cp_copy_fn  copy_fn,
cp_destructor_fn  item_destructor,
int  mode 
)

Constructor with all parameters.

Parameters:
immediate if true, create an immediate queue
normal_priorities number of subqueues
weights table of weight factors
compare_fn compare method
copy_fn copy method
mode operation and locking mode
CPROPS_DLL void * cp_priority_list_get_next_by_option ( cp_priority_list *  list,
int  mode 
)

Get the "first" entry of the list with mode.

The internal algorithm selects one of the non-empty list and returns the first entry of that list.

CPROPS_DLL void * cp_priority_list_insert ( cp_priority_list *  list,
void *  item,
int  priority 
)

Inserts an entry to the list with priority and default-mode.

The entry is added to the list which holds the entries with given priority.

Parameters:
list the object
item the entry object
priority priority of the entry
Note:
If the priority is out of supported range, the items are added to the queue with lowest priority .
CPROPS_DLL void * cp_priority_list_insert_by_option ( cp_priority_list *  list,
void *  item,
int  priority,
int  mode 
)

Inserts an entry to the list with priority and mode.

The entry is added to the list which holds the entries with given priority.

Parameters:
list the object
item the entry object
priority priority of the entry
mode locking mode
Note:
If the priority is out of supported range, the items are added to the queue with lowest priority .
CPROPS_DLL int cp_priority_list_is_empty ( cp_priority_list *  list  ) 

Test if object is empty.

Return values:
true if no element contained.
false if at least one element is contained.
CPROPS_DLL long cp_priority_list_item_count ( cp_priority_list *  list  ) 

Number of entries in the whole collection.

Returns:
number of entries.
CPROPS_DLL int cp_priority_list_lock ( cp_priority_list *  list,
int  lock_mode 
)

Lock the collection with mode.

Parameters:
list the object
lock_mode locking mode
int cp_priority_list_txlock ( cp_priority_list *  list,
int  type 
)