PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/intrusive_ptr.i

#
Swig | 82 lines | 70 code | 12 blank | 0 comment | 0 complexity | 844b9dc8d8bc44fef5e38939b5abe69a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // Allow for different namespaces for shared_ptr / intrusive_ptr - they could be boost or std or std::tr1
  2. // For example for std::tr1, use:
  3. // #define SWIG_SHARED_PTR_NAMESPACE std
  4. // #define SWIG_SHARED_PTR_SUBNAMESPACE tr1
  5. // #define SWIG_INTRUSIVE_PTR_NAMESPACE boost
  6. // #define SWIG_INTRUSIVE_PTR_SUBNAMESPACE
  7. #if !defined(SWIG_INTRUSIVE_PTR_NAMESPACE)
  8. # define SWIG_INTRUSIVE_PTR_NAMESPACE boost
  9. #endif
  10. #if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
  11. # define SWIG_INTRUSIVE_PTR_QNAMESPACE SWIG_INTRUSIVE_PTR_NAMESPACE::SWIG_INTRUSIVE_PTR_SUBNAMESPACE
  12. #else
  13. # define SWIG_INTRUSIVE_PTR_QNAMESPACE SWIG_INTRUSIVE_PTR_NAMESPACE
  14. #endif
  15. namespace SWIG_INTRUSIVE_PTR_NAMESPACE {
  16. #if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
  17. namespace SWIG_INTRUSIVE_PTR_SUBNAMESPACE {
  18. #endif
  19. template <class T> class intrusive_ptr {
  20. };
  21. #if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
  22. }
  23. #endif
  24. }
  25. %fragment("SWIG_intrusive_deleter", "header") {
  26. template<class T> struct SWIG_intrusive_deleter {
  27. void operator()(T *p) {
  28. if (p)
  29. intrusive_ptr_release(p);
  30. }
  31. };
  32. }
  33. %fragment("SWIG_null_deleter", "header") {
  34. struct SWIG_null_deleter {
  35. void operator() (void const *) const {
  36. }
  37. };
  38. %#define SWIG_NO_NULL_DELETER_0 , SWIG_null_deleter()
  39. %#define SWIG_NO_NULL_DELETER_1
  40. }
  41. // Workaround empty first macro argument bug
  42. #define SWIGEMPTYHACK
  43. // Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
  44. %define %intrusive_ptr(TYPE...)
  45. %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
  46. SWIG_INTRUSIVE_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
  47. SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
  48. %enddef
  49. %define %intrusive_ptr_no_wrap(TYPE...)
  50. %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
  51. SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(SWIGEMPTYHACK, TYPE)
  52. SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
  53. %enddef
  54. // Legacy macros
  55. %define SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE...)
  56. #warning "SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
  57. %intrusive_ptr(TYPE)
  58. %enddef
  59. %define SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...)
  60. #warning "SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
  61. %intrusive_ptr(TYPE)
  62. %enddef
  63. %define SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE...)
  64. #warning "SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
  65. %intrusive_ptr_no_wrap(TYPE)
  66. %enddef
  67. %define SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE...)
  68. #warning "SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
  69. %intrusive_ptr_no_wrap(TYPE)
  70. %enddef