guththila_buffer.h

00001 
00002 /*
00003  * Licensed to the Apache Software Foundation (ASF) under one or more
00004  * contributor license agreements.  See the NOTICE file distributed with
00005  * this work for additional information regarding copyright ownership.
00006  * The ASF licenses this file to You under the Apache License, Version 2.0
00007  * (the "License"); you may not use this file except in compliance with
00008  * the License.  You may obtain a copy of the License at
00009  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 #ifndef GUTHTHILA_BUFFER_H
00019 #define GUTHTHILA_BUFFER_H
00020 
00021 #include <guththila_defines.h>
00022 #include <axutil_utils.h>
00023 
00024 EXTERN_C_START()
00025 
00026 typedef enum guththila_buffer_type
00027 {
00028     GUTHTHILA_SINGLE_BUFFER = 0, /* One buffer */
00029     GUTHTHILA_MULTIPLE_BUFFER    /* Mulitple buffers in a buff array */
00030 } guththila_buffer_type_t;
00031 
00032 typedef struct guththila_buffer_s
00033 {
00034     /* Required to manupulate multiple buffers */
00035     size_t *data_size;                  /* Array containing filled sizes of buffers */
00036     size_t *buffs_size;                 /* Array containing actual sizes of buffers */
00037     guththila_char_t **buff;    /* Array of buffers */
00038     int cur_buff;                               /* Current buffer */
00039     int cur_buff_pos;                   /* Position of the current buffer */
00040     size_t pre_tot_data;                /* All the data in the previous buffers. Not include cur */
00041     unsigned int no_buffers;    /* No of buffers */
00042     short type;                                 /* Buffer type */
00043     guththila_char_t *xml;              /* All the buffers serialized together */
00044 } guththila_buffer_t;
00045 
00046 #define GUTHTHILA_BUFFER_DEF_SIZE 16384
00047 #define GUTHTHILA_BUFFER_NUMBER_OF_BUFFERS 16
00048 
00049 #ifndef GUTHTHILA_BUFFER_SIZE
00050 #define GUTHTHILA_BUFFER_SIZE(_buffer) (_buffer.size)
00051 #endif
00052 
00053 #ifndef GUTHTHILA_BUFFER_CURRENT_BUFF
00054 #define GUTHTHILA_BUFFER_CURRENT_BUFF(_buffer) ((_buffer).buff[(_buffer).cur_buff] + (_buffer).data_size[(_buffer).cur_buff])
00055 #endif
00056 
00057 #ifndef GUTHTHILA_BUFFER_CURRENT_BUFF_SIZE
00058 #define GUTHTHILA_BUFFER_CURRENT_BUFF_SIZE(_buffer) ((_buffer).buffs_size[(_buffer).cur_buff] - (_buffer).data_size[(_buffer).cur_buff])
00059 #endif
00060 
00061 #ifndef GUTHTHILA_BUFFER_CURRENT_DATA_SIZE
00062 #define GUTHTHILA_BUFFER_CURRENT_DATA_SIZE(_buffer) ((_buffer).data_size[(_buffer).cur_buff])
00063 #endif
00064 
00065 #ifndef GUTHTHILA_BUFFER_PRE_DATA_SIZE
00066 #define GUTHTHILA_BUFFER_PRE_DATA_SIZE(_buffer) ((_buffer).pre_tot_data)
00067 #endif
00068 
00069 /*We never consider tokens not in the current buffer*/
00070 #ifndef GUTHTHILA_BUF_POS
00071 #define GUTHTHILA_BUF_POS(_buffer, _pos) ((_buffer).buff[(_buffer).cur_buff] + _pos - (_buffer).pre_tot_data)
00072 #endif
00073 
00082 int GUTHTHILA_CALL 
00083 guththila_buffer_init(guththila_buffer_t * buffer,
00084                                           int size,
00085                                           const axutil_env_t * env);
00086 
00094 int GUTHTHILA_CALL 
00095 guththila_buffer_un_init(guththila_buffer_t * buffer,
00096                                            const axutil_env_t * env);
00097 
00108 int GUTHTHILA_CALL 
00109 guththila_buffer_init_for_buffer(guththila_buffer_t * mu_buff, 
00110                                                                  guththila_char_t *buffer, 
00111                                                                  int size, 
00112                                                                  const axutil_env_t * env);
00113 
00114 void *GUTHTHILA_CALL 
00115 guththila_get_position(guththila_buffer_t * buffer,
00116                                            int pos, 
00117                                            const axutil_env_t * env);
00118 
00119 int GUTHTHILA_CALL 
00120 guththila_buffer_next(guththila_buffer_t * buffer, 
00121                                           const axutil_env_t * env);
00122 
00123 
00132 void *GUTHTHILA_CALL 
00133 guththila_buffer_get(guththila_buffer_t * buffer, 
00134                                          const axutil_env_t * env);
00135 
00136 
00137 int GUTHTHILA_CALL 
00138 guththila_buffer_shift(guththila_buffer_t * buffer, 
00139                                            int no, const axutil_env_t * env);
00140 
00141 int GUTHTHILA_CALL 
00142 guththila_buffer_insert_data(guththila_buffer_t * buffer, 
00143                                                          void *buff, size_t buff_len, 
00144                                                          const axutil_env_t * env);
00145 
00146 EXTERN_C_END()
00147 #endif
00148 
00149 
00150 
00151 

Generated on Fri Apr 17 11:49:43 2009 for Axis2/C by  doxygen 1.5.3