-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreferences.h
More file actions
65 lines (52 loc) · 1.59 KB
/
references.h
File metadata and controls
65 lines (52 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @author Jefferson González
*
* @license
* This file is part of wxPHP check the LICENSE file for information.
*
*/
#ifndef WXPHP_REFERENCES_H_GUARD
#define WXPHP_REFERENCES_H_GUARD
#include "common.h"
#include <vector>
/**
* Used internally by each php wrapper class to keep track of
* zval references used by them
*/
class wxPHPObjectReferences
{
public:
wxPHPObjectReferences();
~wxPHPObjectReferences();
/**
* To turn on the flag that indicates that the php class using
* this object was initialized by the php user space and not internally
* by wxWidgets
*/
void Initialize();
/**
* Checks if the class using this object was initialized by the php
* user space.
*
* @return true if initialized by user otherwise false
*/
bool IsUserInitialized();
/**
* Increments the refcount of a zval and stores it on an internal
* vector. This method should be used when the php class wrapper
* using this object uses a zval resource as pointer or reference.
*
* @param var Pointer of zval to increment its refcount
*/
void AddReference(zval* var);
/**
* Decreases the refcount of all registered zvals on the internal
* in order for php to garbage collect them. This method should
* be called when the php wrapper using this object is destroyed.
*/
void RemoveReferences();
private:
long m_userInitialized; /**< Flag that stores the initialization status of the class using this object. */
std::vector<zval*> m_references; /**< Vector that keeps a registry of all zvals* which refcount was incremented */
};
#endif //WXPHP_REFERENCES_H_GUARD