You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2006/05/08 11:21:21 UTC

svn commit: r404980 - in /webservices/axis2/trunk/c/modules/wsdl/woden: include/woden/util/axis2_woden_generic_obj.h src/util/Makefile.am src/util/generic_obj.c

Author: damitha
Date: Mon May  8 02:21:19 2006
New Revision: 404980

URL: http://svn.apache.org/viewcvs?rev=404980&view=rev
Log:
Added new files

Added:
    webservices/axis2/trunk/c/modules/wsdl/woden/include/woden/util/axis2_woden_generic_obj.h
    webservices/axis2/trunk/c/modules/wsdl/woden/src/util/generic_obj.c
Modified:
    webservices/axis2/trunk/c/modules/wsdl/woden/src/util/Makefile.am

Added: webservices/axis2/trunk/c/modules/wsdl/woden/include/woden/util/axis2_woden_generic_obj.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/woden/include/woden/util/axis2_woden_generic_obj.h?rev=404980&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/woden/include/woden/util/axis2_woden_generic_obj.h (added)
+++ webservices/axis2/trunk/c/modules/wsdl/woden/include/woden/util/axis2_woden_generic_obj.h Mon May  8 02:21:19 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_GENERIC_OBJ_H
+#define AXIS2_GENERIC_OBJ_H
+
+#include <axis2_defines.h>
+#include <axis2_error.h>
+#include <axis2_env.h>
+#include <axis2_const.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    
+typedef struct axis2_generic_obj axis2_generic_obj_t;
+typedef struct axis2_generic_obj_ops axis2_generic_obj_ops_t;
+    
+/**
+ * @defgroup axis2_generic_obj Generic Obj
+ * @ingroup axis2_woden_util 
+ * @{
+ */
+
+/** 
+ * @brief Generic Obj ops struct
+ * Encapsulator struct for ops of axis2_woden_generic_obj
+ */
+AXIS2_DECLARE_DATA struct axis2_generic_obj_ops
+{
+
+    axis2_status_t (AXIS2_CALL *
+    free) (
+            axis2_generic_obj_t *generic_obj, 
+            axis2_env_t **env);
+
+    axis2_status_t (AXIS2_CALL *
+    set_scope) (
+            axis2_generic_obj_t *generic_obj,
+            axis2_env_t **env,
+            axis2_scope_t scope);
+
+    axis2_status_t (AXIS2_CALL *
+    set_free_func) (
+            axis2_generic_obj_t *generic_obj,
+            axis2_env_t **env,
+            AXIS2_FREE_VOID_ARG free_func);
+
+    axis2_status_t (AXIS2_CALL *
+    set_value) (
+            axis2_generic_obj_t *generic_obj,
+            axis2_env_t **env,
+            void *value);
+    
+    void *(AXIS2_CALL *
+    get_value) (
+            axis2_generic_obj_t *generic_obj,
+            axis2_env_t **env);
+
+};
+    
+     
+/** 
+     * @brief
+     */ 
+AXIS2_DECLARE_DATA struct axis2_generic_obj
+{
+	axis2_generic_obj_ops_t *ops;
+};
+
+/**
+ * create new generic_obj
+ * @return generic_obj newly created generic_obj
+ */
+AXIS2_DECLARE(axis2_generic_obj_t *)
+axis2_generic_obj_create(axis2_env_t **env);
+
+/*************************** Function macros **********************************/
+
+#define AXIS2_GENERIC_OBJ_FREE(generic_obj, env) \
+		((generic_obj)->ops->free (generic_obj, env))
+
+#define AXIS2_GENERIC_OBJ_SET_FREE_FUNC(generic_obj, env, free_func) \
+		((generic_obj)->ops->set_free_func (generic_obj, env, free_func))  
+
+#define AXIS2_GENERIC_OBJ_SET_SCOPE(generic_obj, env, scope) \
+		((generic_obj)->ops->set_scope (generic_obj, env, scope)) 
+
+#define AXIS2_GENERIC_OBJ_SET_VALUE(generic_obj, env, value) \
+		((generic_obj)->ops->set_value (generic_obj, env, value))
+
+#define AXIS2_GENERIC_OBJ_GET_VALUE(generic_obj, env) \
+        ((generic_obj)->ops->get_value(generic_obj, env))
+                                        
+/*************************** End of function macros ***************************/
+
+
+
+/** @} */
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* AXIS2_GENERIC_OBJ_H */

Modified: webservices/axis2/trunk/c/modules/wsdl/woden/src/util/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/woden/src/util/Makefile.am?rev=404980&r1=404979&r2=404980&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/woden/src/util/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/wsdl/woden/src/util/Makefile.am Mon May  8 02:21:19 2006
@@ -2,7 +2,8 @@
 lib_LTLIBRARIES = libaxis2_woden_util.la
 
 libaxis2_woden_util_la_SOURCES = \
-								 om_util.c
+								 om_util.c \
+								 generic_obj.c
 
-INCLUDES = -I$(top_builddir)/include/woden \
+INCLUDES = -I$(top_builddir)/include \
             -I$(AXIS2C_HOME)/include

Added: webservices/axis2/trunk/c/modules/wsdl/woden/src/util/generic_obj.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/woden/src/util/generic_obj.c?rev=404980&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/woden/src/util/generic_obj.c (added)
+++ webservices/axis2/trunk/c/modules/wsdl/woden/src/util/generic_obj.c Mon May  8 02:21:19 2006
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <woden/util/axis2_woden_generic_obj.h>
+
+typedef struct axis2_generic_obj_impl
+{
+    axis2_generic_obj_t generic_obj;
+    axis2_scope_t scope;
+    AXIS2_FREE_VOID_ARG free_func;
+    void *value;
+    
+}axis2_generic_obj_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(generic_obj) \
+    ((axis2_generic_obj_impl_t *) generic_obj)
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_free (
+        axis2_generic_obj_t *generic_obj, 
+        axis2_env_t **env); 
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_scope(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        axis2_scope_t scope);
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_free_func(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        AXIS2_FREE_VOID_ARG free_func);
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_value(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        void *value);
+
+void *AXIS2_CALL
+axis2_generic_obj_get_value(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env);
+
+/************************** End of function prototypes ************************/
+
+axis2_generic_obj_t *AXIS2_CALL 
+axis2_generic_obj_create(
+        axis2_env_t **env)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+    
+	AXIS2_ENV_CHECK(env, NULL);
+	
+	generic_obj_impl = (axis2_generic_obj_impl_t *) AXIS2_MALLOC((*env)->allocator, 
+        sizeof(axis2_generic_obj_impl_t));
+	
+	if(NULL == generic_obj_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    generic_obj_impl->value= NULL;
+    generic_obj_impl->scope = AXIS2_SCOPE_REQUEST;
+    generic_obj_impl->free_func = 0;
+    
+    generic_obj_impl->generic_obj.ops = 
+		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_generic_obj_ops_t));
+	if(NULL == generic_obj_impl->generic_obj.ops)
+    {
+        axis2_generic_obj_free(&(generic_obj_impl->generic_obj), env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    generic_obj_impl->generic_obj.ops->free =  axis2_generic_obj_free;
+    generic_obj_impl->generic_obj.ops->set_free_func = axis2_generic_obj_set_free_func;
+    generic_obj_impl->generic_obj.ops->set_scope = axis2_generic_obj_set_scope;
+    generic_obj_impl->generic_obj.ops->set_value = axis2_generic_obj_set_value;
+	generic_obj_impl->generic_obj.ops->get_value = axis2_generic_obj_get_value;
+	return &(generic_obj_impl->generic_obj);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+axis2_generic_obj_free (
+        axis2_generic_obj_t *generic_obj, 
+        axis2_env_t **env)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    generic_obj_impl = AXIS2_INTF_TO_IMPL(generic_obj);
+    
+    if(generic_obj_impl->value)
+    {
+        if(generic_obj_impl->scope != AXIS2_SCOPE_APPLICATION)
+        {
+            if(generic_obj_impl->free_func)
+            {
+                generic_obj_impl->free_func(generic_obj_impl->value, env);
+            }
+            else
+            {
+                AXIS2_FREE((*env)->allocator, generic_obj_impl->value);
+            }
+            generic_obj_impl->value = NULL;
+        }
+    }
+    
+    if(generic_obj_impl->generic_obj.ops)
+    {
+        AXIS2_FREE((*env)->allocator, generic_obj_impl->generic_obj.ops);
+        generic_obj_impl->generic_obj.ops = NULL;
+    }
+    
+    if(generic_obj_impl)
+    {
+        AXIS2_FREE((*env)->allocator, generic_obj_impl);
+        generic_obj_impl = NULL;
+    }
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_scope(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        axis2_scope_t scope)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    generic_obj_impl = AXIS2_INTF_TO_IMPL(generic_obj);
+   
+    generic_obj_impl->scope = scope;
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_free_func(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        AXIS2_FREE_VOID_ARG free_func)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    generic_obj_impl = AXIS2_INTF_TO_IMPL(generic_obj);
+   
+    generic_obj_impl->free_func = free_func;
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_generic_obj_set_value(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env,
+        void *value)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    generic_obj_impl = AXIS2_INTF_TO_IMPL(generic_obj);
+   
+    generic_obj_impl->value = value;
+    return AXIS2_SUCCESS;
+}
+
+void *AXIS2_CALL
+axis2_generic_obj_get_value(
+        axis2_generic_obj_t *generic_obj,
+        axis2_env_t **env)
+{
+    axis2_generic_obj_impl_t *generic_obj_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    generic_obj_impl = AXIS2_INTF_TO_IMPL(generic_obj);
+
+    return generic_obj_impl->value;
+}