retain count logic for ZFFramework More...
#include "ZFObjectCore.h"Go to the source code of this file.
Macros | |
| #define | zfobjAlloc(T_ZFObject, ...) |
| alloc an object, see ZFObject | |
| #define | zfunsafe_zfobjAlloc(T_ZFObject, ...) |
| no lock version of zfobjAlloc, use with caution | |
| #define | zfobjRetain(obj) |
| retain an object, see ZFObject | |
| #define | zfunsafe_zfobjRetain(obj) |
| no lock version of zfobjRetain, use with caution | |
| #define | zfobjRelease(obj) |
| release an object, see ZFObject | |
| #define | zfunsafe_zfobjRelease(obj) |
| no lock version of zfobjRelease, use with caution | |
| #define | ZFOBJECT_CACHE_RELEASE(action) |
| mark class that it should apply cache logic when alloc | |
| #define | ZFOBJECT_CACHE_RELEASE_ABSTRACT(action) |
| ZFOBJECT_CACHE_RELEASE for abstract class | |
Functions | |
| void | zfobjAllocCacheRemoveAll (void) |
| remove all object cache, see ZFOBJECT_CACHE_RELEASE | |
| template<typename T_ZFObject, typename T_ZFObject2> | |
| void | zfobjRetainChange (T_ZFObject &obj, T_ZFObject2 const &v) |
| util to release property's old value, retain new value, then set to property | |
| template<typename T_ZFObject, typename T_ZFObject2> | |
| void | zfunsafe_zfobjRetainChange (T_ZFObject &obj, T_ZFObject2 const &v) |
| no lock version of zfobjRetainChange, use with caution | |
retain count logic for ZFFramework
| #define zfobjAlloc | ( | T_ZFObject, | |
| ... ) |
alloc an object, see ZFObject
if your class has declared ZFOBJECT_CACHE_RELEASE, then zfobjAlloc would automatically has cache logic
| #define ZFOBJECT_CACHE_RELEASE | ( | action | ) |
mark class that it should apply cache logic when alloc
usage:
once declared, when you alloc object with no extra param, the cache logic would automatically take effect:
note the alloc cache logic is explicitly attached to class, parent class' ZFOBJECT_CACHE_RELEASE does not make child class cacheable, the child class must also explicitly declare ZFOBJECT_CACHE_RELEASE to enable cache logic
|
inline |
util to release property's old value, retain new value, then set to property
this macro is similar to the retain property in Object-C
typical usage: