00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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