home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 June / PCWorld_2005-06_cd.bin / software / vyzkuste / firewally / firewally.exe / framework-2.3.exe / weakrefobject.h < prev    next >
C/C++ Source or Header  |  2003-12-30  |  1KB  |  51 lines

  1. /* Weak references objects for Python. */
  2.  
  3. #ifndef Py_WEAKREFOBJECT_H
  4. #define Py_WEAKREFOBJECT_H
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9.  
  10. typedef struct _PyWeakReference PyWeakReference;
  11.  
  12. struct _PyWeakReference {
  13.     PyObject_HEAD
  14.     PyObject *wr_object;
  15.     PyObject *wr_callback;
  16.     long hash;
  17.     PyWeakReference *wr_prev;
  18.     PyWeakReference *wr_next;
  19. };
  20.  
  21. PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
  22. PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
  23. PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
  24.  
  25. #define PyWeakref_CheckRef(op) \
  26.         ((op)->ob_type == &_PyWeakref_RefType)
  27. #define PyWeakref_CheckProxy(op) \
  28.         (((op)->ob_type == &_PyWeakref_ProxyType) || \
  29.          ((op)->ob_type == &_PyWeakref_CallableProxyType))
  30. #define PyWeakref_Check(op) \
  31.         (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
  32.  
  33.  
  34. PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,
  35.                                               PyObject *callback);
  36. PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,
  37.                                                 PyObject *callback);
  38. PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
  39.  
  40. PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
  41.  
  42. PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
  43.  
  44. #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
  45.  
  46.  
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* !Py_WEAKREFOBJECT_H */
  51.