Loading...
Searching...
No Matches
globus_priority_q.h
Go to the documentation of this file.
/*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_PRIORITY_Q_H
#define GLOBUS_PRIORITY_Q_H
#include "globus_types.h"
#include "globus_memory.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*globus_priority_q_cmp_func_t)(
void * priority_1,
void * priority_2);
typedef struct globus_priority_q_s
{
struct globus_l_priority_q_entry_s ** heap;
int next_slot;
size_t max_len;
globus_memory_t memory;
globus_priority_q_cmp_func_t cmp_func;
} globus_priority_q_t;
int
globus_priority_q_init(
globus_priority_q_t * priority_q,
globus_priority_q_cmp_func_t cmp_func);
int
globus_priority_q_destroy(
globus_priority_q_t * priority_q);
globus_bool_t
globus_priority_q_empty(
globus_priority_q_t * priority_q);
int
globus_priority_q_size(
globus_priority_q_t * priority_q);
int
globus_priority_q_enqueue(
globus_priority_q_t * priority_q,
void * datum,
void * priority);
void *
globus_priority_q_remove(
globus_priority_q_t * priority_q,
void * datum);
/*
* it is acceptable to modify the priority already stored within the queue
* before making this call. The old priority is not looked at
*/
void *
globus_priority_q_modify(
globus_priority_q_t * priority_q,
void * datum,
void * new_priority);
void *
globus_priority_q_dequeue(
globus_priority_q_t * priority_q);
void *
globus_priority_q_first(
globus_priority_q_t * priority_q);
void *
globus_priority_q_first_priority(
globus_priority_q_t * priority_q);
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_PRIORITY_Q_H */
globus_memory.h
Memory Pool.
globus_types.h
Common Primitive Types.
globus_bool_t
int globus_bool_t
Boolean type.
Definition globus_types.h:93
globus_priority_q_remove
void * globus_priority_q_remove(globus_priority_q_t *priority_q, void *datum)
Remove an Arbitrary Datum from a Priority Queue.
Definition globus_priority_q.c:471
globus_priority_q_destroy
int globus_priority_q_destroy(globus_priority_q_t *priority_q)
Destroy a Priority Queue.
Definition globus_priority_q.c:180
globus_priority_q_size
int globus_priority_q_size(globus_priority_q_t *priority_q)
Priority Queue Size.
Definition globus_priority_q.c:252
globus_priority_q_init
int globus_priority_q_init(globus_priority_q_t *priority_q, globus_priority_q_cmp_func_t cmp_func)
Initialize a priority queue.
Definition globus_priority_q.c:118
globus_priority_q_modify
void * globus_priority_q_modify(globus_priority_q_t *priority_q, void *datum, void *new_priority)
Modify the Priority of Datum.
Definition globus_priority_q.c:561
globus_priority_q_dequeue
void * globus_priority_q_dequeue(globus_priority_q_t *priority_q)
Remove a Datum From A Priority Queue.
Definition globus_priority_q.c:359
globus_priority_q_cmp_func_t
int(* globus_priority_q_cmp_func_t)(void *priority_1, void *priority_2)
Priority Comparison Predicate.
Definition globus_priority_q.h:86
globus_priority_q_empty
globus_bool_t globus_priority_q_empty(globus_priority_q_t *priority_q)
Priority Queue Empty Predicate.
Definition globus_priority_q.c:225
globus_priority_q_enqueue
int globus_priority_q_enqueue(globus_priority_q_t *priority_q, void *datum, void *priority)
Add a Datum to a Priority Queue.
Definition globus_priority_q.c:293
globus_priority_q_t
struct globus_priority_q_s globus_priority_q_t
Priority Queue Structure.
globus_priority_q_first_priority
void * globus_priority_q_first_priority(globus_priority_q_t *priority_q)
Get the Highest Priority in Priority Queue.
Definition globus_priority_q.c:440
globus_priority_q_first
void * globus_priority_q_first(globus_priority_q_t *priority_q)
Get the Highest-Priority Datum From a Priority Queue.
Definition globus_priority_q.c:408
globus_priority_q_s
Priority Queue Structure.
Definition globus_priority_q.h:99