Back to index

php5  5.3.10
zend_objects_API.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | Zend Engine                                                          |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 2.00 of the Zend license,     |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.zend.com/license/2_00.txt.                                |
00011    | If you did not receive a copy of the Zend license and are unable to  |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@zend.com so we can mail you a copy immediately.              |
00014    +----------------------------------------------------------------------+
00015    | Authors: Andi Gutmans <andi@zend.com>                                |
00016    |          Zeev Suraski <zeev@zend.com>                                |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: zend_objects_API.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef ZEND_OBJECTS_API_H
00023 #define ZEND_OBJECTS_API_H
00024 
00025 #include "zend.h"
00026 
00027 typedef void (*zend_objects_store_dtor_t)(void *object, zend_object_handle handle TSRMLS_DC);
00028 typedef void (*zend_objects_free_object_storage_t)(void *object TSRMLS_DC);
00029 typedef void (*zend_objects_store_clone_t)(void *object, void **object_clone TSRMLS_DC);
00030 
00031 typedef struct _zend_object_store_bucket {
00032        zend_bool destructor_called;
00033        zend_bool valid;
00034        union _store_bucket {
00035               struct _store_object {
00036                      void *object;
00037                      zend_objects_store_dtor_t dtor;
00038                      zend_objects_free_object_storage_t free_storage;
00039                      zend_objects_store_clone_t clone;
00040                      const zend_object_handlers *handlers;
00041                      zend_uint refcount;
00042                      gc_root_buffer *buffered;
00043               } obj;
00044               struct {
00045                      int next;
00046               } free_list;
00047        } bucket;
00048 } zend_object_store_bucket;
00049 
00050 typedef struct _zend_objects_store {
00051        zend_object_store_bucket *object_buckets;
00052        zend_uint top;
00053        zend_uint size;
00054        int free_list_head;
00055 } zend_objects_store;
00056 
00057 /* Global store handling functions */
00058 BEGIN_EXTERN_C()
00059 ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
00060 ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
00061 ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
00062 ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
00063 
00064 /* Store API functions */
00065 ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_free_object_storage_t storage, zend_objects_store_clone_t clone TSRMLS_DC);
00066 
00067 ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
00068 ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
00069 ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC);
00070 ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC);
00071 static inline void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) {
00072        zend_objects_store_del_ref_by_handle_ex(handle, NULL TSRMLS_CC);
00073 }
00074 ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC);
00075 ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
00076 ZEND_API void *zend_object_store_get_object(const zval *object TSRMLS_DC);
00077 ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC);
00078 /* See comment in zend_objects_API.c before you use this */
00079 ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
00080 ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);
00081 
00082 ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
00083 
00084 #define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_clone_obj
00085 
00086 ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
00087 
00088 ZEND_API zend_object_handlers *zend_get_std_object_handlers(void);
00089 END_EXTERN_C()
00090 
00091 #endif /* ZEND_OBJECTS_H */
00092 
00093 /*
00094  * Local variables:
00095  * tab-width: 4
00096  * c-basic-offset: 4
00097  * indent-tabs-mode: t
00098  * End:
00099  */