track total size of static array and Unit/Class/Func
[hiphop-php.git] / hphp / runtime / base / array-common.h
blobc3c35d007d0c725fe9084e287d66e79f8f44c3e2
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_ARRAY_COMMON_H_
17 #define incl_HPHP_ARRAY_COMMON_H_
19 #include <sys/types.h>
21 namespace HPHP {
23 //////////////////////////////////////////////////////////////////////
25 struct ArrayData;
26 struct ObjectData;
27 struct Variant;
29 //////////////////////////////////////////////////////////////////////
32 * This contains shared stubs used for multiple purposes in the
33 * ArrayData vtable. Most of the functions used by more than one
34 * kind, or for more than one purpose should be collected here.
36 * Note: if you have entry points on an array kind that should never
37 * be called, it's generaelly preferable to give them their own unique
38 * functions so it will be obvious which kind was involved in core
39 * files. We only try to consolidate the common array functions that
40 * should actually be called.
42 struct ArrayCommon {
43 static ssize_t ReturnInvalidIndex(const ArrayData*);
46 * Generic Pop and Dequeue implementations in terms of other functions.
48 static ArrayData* Pop(ArrayData*, Variant&);
49 static ArrayData* Dequeue(ArrayData*, Variant&);
51 static ArrayData* ToVec(ArrayData*, bool);
52 static ArrayData* ToDict(ArrayData*, bool);
53 static ArrayData* ToKeyset(ArrayData*, bool);
55 static ArrayData* ToVArray(ArrayData*, bool);
56 static ArrayData* ToDArray(ArrayData*, bool);
59 //////////////////////////////////////////////////////////////////////
61 ArrayData* castObjToVec(ObjectData*);
62 ArrayData* castObjToDict(ObjectData*);
63 ArrayData* castObjToKeyset(ObjectData*);
64 ArrayData* castObjToVArray(ObjectData*);
65 ArrayData* castObjToDArray(ObjectData*);
67 //////////////////////////////////////////////////////////////////////
71 #endif