1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/PtrTypes.h
10 * \ingroup ZYPP_BASE_SMART_PTR
11 * \see ZYPP_BASE_SMART_PTR
13 #ifndef ZYPP_BASE_PTRTYPES_H
14 #define ZYPP_BASE_PTRTYPES_H
16 #include <boost/scoped_ptr.hpp>
17 #include <boost/shared_ptr.hpp>
18 #include <boost/weak_ptr.hpp>
19 #include <boost/intrusive_ptr.hpp>
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
28 /** \defgroup ZYPP_BASE_SMART_PTR ZYPP_BASE_SMART_PTR
29 * Smart pointer types.
31 * Namespace zypp::base provides 3 smart pointer types \b using the
32 * boostsmart pointer library.
34 * \li \c scoped_ptr Simple sole ownership of single objects. Noncopyable.
36 * \li \c shared_ptr Object ownership shared among multiple pointers
38 * \li \c weak_ptr Non-owning observers of an object owned by shared_ptr.
43 using boost::scoped_ptr;
46 using boost::shared_ptr;
49 using boost::weak_ptr;
51 /** Use boost::intrusive_ptr as Ptr type*/
52 using boost::intrusive_ptr;
53 using boost::static_pointer_cast;
54 using boost::const_pointer_cast;
55 using boost::dynamic_pointer_cast;
59 /////////////////////////////////////////////////////////////////
61 ///////////////////////////////////////////////////////////////////
62 /////////////////////////////////////////////////////////////////
64 ///////////////////////////////////////////////////////////////////
66 /** Forward declaration of Ptr types */
67 #define DEFINE_PTR_TYPE(NAME) \
69 extern void intrusive_ptr_add_ref( const NAME * ); \
70 extern void intrusive_ptr_release( const NAME * ); \
71 typedef zypp::base::intrusive_ptr<NAME> NAME##Ptr; \
72 typedef zypp::base::intrusive_ptr<const NAME> const##NAME##Ptr;
74 ///////////////////////////////////////////////////////////////////
75 #endif // ZYPP_BASE_PTRTYPES_H