axis2_linked_list.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017  
00018 #ifndef AXIS2_LINKED_LIST_H
00019 #define AXIS2_LINKED_LIST_H
00020 
00026 #include <axis2_utils_defines.h>
00027 #include <axis2_env.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C"
00031 {
00032 #endif
00033 
00034 typedef struct axis2_linked_list_s axis2_linked_list_t;
00035 typedef struct axis2_linked_list_ops_s axis2_linked_list_ops_t;
00036     
00046  typedef struct entry_s
00047 {
00049     void *data;
00050     
00052     struct entry_s *next;
00053     
00055     struct entry_s *previous;
00056     
00057 } entry_t; /* struct entry */
00058 
00062  struct axis2_linked_list_ops_s
00063 {
00064     
00065     axis2_status_t (AXIS2_CALL *
00066     free) (axis2_linked_list_t *linked_list, 
00067             const axis2_env_t *env);
00068     
00081     entry_t * (AXIS2_CALL *
00082     get_entry)(axis2_linked_list_t *linked_list, 
00083                                 const axis2_env_t *env, 
00084                                 int n);
00085                                             
00092     axis2_status_t (AXIS2_CALL *
00093     remove_entry)(axis2_linked_list_t *linked_list, 
00094                                     const axis2_env_t *env, 
00095                                     entry_t *e);
00096             
00097     
00103     axis2_bool_t (AXIS2_CALL *
00104     check_bounds_inclusive)(axis2_linked_list_t *linked_list, 
00105                                                 const axis2_env_t *env, 
00106                                                 int index);
00107     
00113     axis2_bool_t (AXIS2_CALL *
00114     check_bounds_exclusive)(axis2_linked_list_t *linked_list,
00115                                                 const axis2_env_t *env,
00116                                                 int index);
00117     
00123     void * (AXIS2_CALL *
00124     get_first)(axis2_linked_list_t *linked_list,
00125                                 const axis2_env_t *env);
00126                                 
00132     void * (AXIS2_CALL *
00133     get_last)(axis2_linked_list_t *linked_list,
00134                                 const axis2_env_t *env);
00135     
00141     void * (AXIS2_CALL *
00142     remove_first)(axis2_linked_list_t *linked_list,
00143                                     const axis2_env_t *env);
00144                                     
00150     void * (AXIS2_CALL *
00151     remove_last)(axis2_linked_list_t *linked_list,
00152                                     const axis2_env_t *env);
00153     
00159     axis2_status_t (AXIS2_CALL *
00160     add_first) (axis2_linked_list_t *linked_list,
00161                                 const axis2_env_t *env,
00162                                 void *o);
00163                                 
00169     axis2_status_t (AXIS2_CALL *
00170     add_last) (axis2_linked_list_t *linked_list,
00171                                 const axis2_env_t *env,
00172                                 void *o);
00173                     
00181     axis2_bool_t (AXIS2_CALL *
00182     contains) (axis2_linked_list_t *linked_list,
00183                                 const axis2_env_t *env,
00184                                 void *o);
00185     
00191     int (AXIS2_CALL *
00192     size) (axis2_linked_list_t *linked_list,
00193                             const axis2_env_t *env);
00194                             
00201     axis2_bool_t (AXIS2_CALL *
00202     add) (axis2_linked_list_t *linked_list, 
00203                             const axis2_env_t *env,
00204                             void *o);
00205     
00213     axis2_bool_t (AXIS2_CALL *
00214     remove) (axis2_linked_list_t *linked_list,
00215                                 const axis2_env_t *env,
00216                                 void *o);
00217                                 
00221     axis2_status_t (AXIS2_CALL *
00222     clear) (axis2_linked_list_t *linked_list,
00223                                 const axis2_env_t *env);
00224     
00231     void * (AXIS2_CALL *
00232     get) (axis2_linked_list_t *linked_list,
00233                             const axis2_env_t *env,
00234                             int index);
00235                             
00243     void * (AXIS2_CALL *
00244     set) (axis2_linked_list_t *linked_list,
00245                             const axis2_env_t *env,
00246                             int index, void *o);
00247     
00254     axis2_status_t (AXIS2_CALL *
00255     add_at_index) (axis2_linked_list_t *linked_list,
00256                             const axis2_env_t *env,
00257                             int index, 
00258                             void *o);
00259                             
00266     void * (AXIS2_CALL *
00267     remove_at_index) (axis2_linked_list_t *linked_list,
00268                                 const axis2_env_t *env,
00269                                 int index);
00270     
00277     int (AXIS2_CALL *
00278     index_of)(axis2_linked_list_t *linked_list,
00279                                 const axis2_env_t *env,
00280                                 void *o);
00281                                 
00288     int (AXIS2_CALL *
00289     last_index_of) (axis2_linked_list_t *linked_list,
00290                                     const axis2_env_t *env,
00291                                     void *o);
00292     
00298     void ** (AXIS2_CALL *
00299     to_array) (axis2_linked_list_t *linked_list,
00300                                 const axis2_env_t *env);
00301 
00302 };
00303 
00308 struct axis2_linked_list_s
00309 {
00311     axis2_linked_list_ops_t *ops;
00312 };
00313 
00317 AXIS2_EXTERN axis2_linked_list_t* AXIS2_CALL axis2_linked_list_create(const axis2_env_t *env);    
00318     
00319 #define AXIS2_LINKED_LIST_FREE(linked_list, env) \
00320         ((linked_list)->ops->free(linked_list, env))
00321 
00322 #define AXIS2_LINKED_LIST_GET_ENTRY(linked_list, env, n) \
00323         ((linked_list)->ops->get_entry(linked_list, env, n))
00324 
00325 #define AXIS2_LINKED_LIST_REMOVE_ENTRY(linked_list, env, e) \
00326         ((linked_list)->ops->remove_entry(linked_list, env, e))
00327 
00328 #define AXIS2_LINKED_LIST_CHECK_BOUNDS_INCLUSIVE(linked_list, env, index) \
00329         ((linked_list)->ops->check_bounds_inclusive(linked_list, env, index))
00330 
00331 #define AXIS2_LINKED_LIST_CHECK_BOUNDS_EXCLUSIVE(linked_list, env, index) \
00332         ((linked_list)->ops->check_bounds_exclusive(linked_list, env, index))
00333 
00334 #define AXIS2_LINKED_LIST_GET_FIRST(linked_list, env) \
00335         ((linked_list)->ops->get_first(linked_list, env))    
00336         
00337 #define AXIS2_LINKED_LIST_GET_LAST(linked_list, env) \
00338         ((linked_list)->ops->get_last(linked_list, env))
00339         
00340 #define AXIS2_LINKED_LIST_REMOVE_FIRST(linked_list, env) \
00341         ((linked_list)->ops->remove_first(linked_list, env))
00342         
00343 #define AXIS2_LINKED_LIST_REMOVE_LAST(linked_list, env) \
00344         ((linked_list)->ops->remove_last(linked_list, env))
00345 
00346 #define AXIS2_LINKED_LIST_ADD_FIRST(linked_list, env, o) \
00347         ((linked_list)->ops->add_first(linked_list, env, o))
00348 
00349 #define AXIS2_LINKED_LIST_ADD_LAST(linked_list, env, o) \
00350         ((linked_list)->ops->add_last(linked_list, env, o))
00351 
00352 #define AXIS2_LINKED_LIST_CONTAINS(linked_list, env, o) \
00353         ((linked_list)->ops->contains(linked_list, env, o))
00354 
00355 #define AXIS2_LINKED_LIST_SIZE(linked_list, env) \
00356         ((linked_list)->ops->size(linked_list, env))
00357 
00358 #define AXIS2_LINKED_LIST_ADD(linked_list, env, o) \
00359         ((linked_list)->ops->add(linked_list, env, o))
00360 
00361 #define AXIS2_LINKED_LIST_REMOVE(linked_list, env, o) \
00362         ((linked_list)->ops->remove(linked_list, env, o))
00363 
00364 #define AXIS2_LINKED_LIST_CLEAR(linked_list, env) \
00365         ((linked_list)->ops->clear(linked_list, env, index))
00366 
00367 #define AXIS2_LINKED_LIST_GET(linked_list, env, index) \
00368         ((linked_list)->ops->get(linked_list, env, index))
00369 
00370 #define AXIS2_LINKED_LIST_SET(linked_list, env, index, o) \
00371         ((linked_list)->ops->set(linked_list, env, index, o))
00372 
00373 #define AXIS2_LINKED_LIST_ADD_AT_INDEX(linked_list, env, index, o) \
00374         ((linked_list)->ops->add_at_index(linked_list, env, index, o))
00375 
00376 #define AXIS2_LINKED_LIST_REMOVE_AT_INDEX(linked_list, env, index) \
00377         ((linked_list)->ops->remove_at_index(linked_list, env, index))
00378 
00379 #define AXIS2_LINKED_LIST_INDEX_OF(linked_list, env, o) \
00380         ((linked_list)->ops->index_of(linked_list, env, o))
00381 
00382 #define AXIS2_LINKED_LIST_LAST_INDEX_OF(linked_list, env, o) \
00383         ((linked_list)->ops->last_index_of(linked_list, env, o))
00384 
00385 #define AXIS2_LINKED_LIST_TO_ARRAY(linked_list, env) \
00386         ((linked_list)->ops->to_array(linked_list, env))
00387 
00390 #ifdef __cplusplus
00391 }
00392 #endif
00393 
00394 #endif    /* AXIS2_LINKED_LIST_H */

Generated on Wed Dec 20 20:14:10 2006 for Axis2/C by  doxygen 1.5.1