globus_priority_q.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef GLOBUS_PRIORITY_Q_H
00023 #define GLOBUS_PRIORITY_Q_H
00024 
00025 #include "globus_types.h"
00026 #include "globus_memory.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00085 typedef int (*globus_priority_q_cmp_func_t)(
00086     void *                                  priority_1,
00087     void *                                  priority_2);
00088 
00097 typedef struct globus_priority_q_s
00098 {
00099     struct globus_l_priority_q_entry_s **   heap;
00100     int                                     next_slot;
00101     size_t                                  max_len;
00102     globus_memory_t                         memory;
00103     globus_priority_q_cmp_func_t            cmp_func;
00104 } globus_priority_q_t;
00105 
00106 int
00107 globus_priority_q_init(
00108     globus_priority_q_t *               priority_q,
00109     globus_priority_q_cmp_func_t        cmp_func);
00110 
00111 int
00112 globus_priority_q_destroy(
00113     globus_priority_q_t *               priority_q);
00114 
00115 globus_bool_t
00116 globus_priority_q_empty(
00117     globus_priority_q_t *               priority_q);
00118 
00119 int
00120 globus_priority_q_size(
00121     globus_priority_q_t *               priority_q);
00122 
00123 int
00124 globus_priority_q_enqueue(
00125     globus_priority_q_t *               priority_q,
00126     void *                              datum,
00127     void *                              priority);
00128 
00129 void *
00130 globus_priority_q_remove(
00131     globus_priority_q_t *               priority_q,
00132     void *                              datum);
00133 
00134 /*
00135  * it is acceptable to modify the priority already stored within the queue
00136  * before making this call.  The old priority is not looked at
00137  */
00138 void *
00139 globus_priority_q_modify(
00140     globus_priority_q_t *               priority_q,
00141     void *                              datum,
00142     void *                              new_priority);
00143 
00144 void *
00145 globus_priority_q_dequeue(
00146     globus_priority_q_t *               priority_q);
00147 
00148 void *
00149 globus_priority_q_first(
00150     globus_priority_q_t *               priority_q);
00151 
00152 void *
00153 globus_priority_q_first_priority(
00154     globus_priority_q_t *               priority_q);
00155 
00156 
00157 #ifdef __cplusplus
00158 }
00159 #endif
00160 
00161 #endif /* GLOBUS_PRIORITY_Q_H */

Generated on 17 Mar 2017 for globus_common by  doxygen 1.4.7