Main Page | Modules | Class List | Directories | File List | Class Members | File Members

axis2_env.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
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 
00017 #ifndef AXIS2_ENV_H
00018 #define AXIS2_ENV_H
00019 
00026 #include <axis2_allocator.h>
00027 #include <axis2_error.h>
00028 #include <axis2_stream.h>
00029 #include <axis2_log.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C"
00033 {
00034 #endif
00035 
00043     struct axis2_environment;
00044     struct axis2_environment_ops;
00045 
00058     typedef struct axis2_environment
00059     {
00061         axis2_allocator_t *allocator;
00063         axis2_error_t *error;
00065         axis2_stream_t *stream;
00067         axis2_log_t *log;
00069                 axis2_bool_t log_enabled;
00070                 
00071     } axis2_env_t;
00072 
00079     AXIS2_DECLARE(axis2_env_t *) axis2_env_create (axis2_allocator_t
00080                                                    *allocator);                                                   
00081         
00090     AXIS2_DECLARE(axis2_env_t *) axis2_env_create_with_error_stream 
00091                                                                                                         (axis2_allocator_t *allocator
00092                                                    , axis2_error_t *error
00093                                                    , axis2_stream_t *stream);
00094         
00104     AXIS2_DECLARE(axis2_env_t *) axis2_env_create_with_error_stream_log 
00105                                                                                                         (axis2_allocator_t *allocator
00106                                                    , axis2_error_t *error
00107                                                    , axis2_stream_t *stream
00108                                                    , axis2_log_t *log);
00109 
00119     AXIS2_DECLARE(axis2_status_t) axis2_env_free (axis2_env_t *env);
00120     
00124     AXIS2_DECLARE(axis2_status_t) axis2_env_enable_log (axis2_env_t **env, axis2_bool_t enable);
00125 
00129     AXIS2_DECLARE(axis2_status_t) axis2_env_check_status (axis2_env_t **env);
00130     
00134     AXIS2_DECLARE(axis2_status_t) axis2_env_write_log (axis2_env_t **env, const char* message);
00135     #define AXIS2_LOG(env, message) axis2_env_write_log (env,message)
00136 
00137     #define AXIS2_ENV_CHECK(env, error_return) \
00138     if(!env || !(*env))  \
00139         { \
00140                 axis2_allocator_t *allocator = axis2_allocator_init (NULL); \
00141         *env = axis2_env_create (allocator); \
00142                 AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_CRTICAL_FAILURE);  \
00143                 AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, \
00144                         AXIS2_ERROR_ENVIRONMENT_IS_NULL); \
00145                 return error_return; \
00146         } \
00147     else \
00148     { \
00149         AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_SUCCESS); \
00150     }
00151     
00152 
00163 #ifdef __cplusplus
00164 }
00165 #endif
00166 
00167 #endif                          /* AXIS2_ENV_H */

Generated on Wed Dec 7 07:58:24 2005 for Axis2/C by  doxygen 1.4.2