zypp::RW_pointer< _D, _Traits > Struct Template Reference
[Smart pointer types]

Wrapper for const correct access via Smart pointer types. More...

#include <PtrTypes.h>

List of all members.

Public Types

typedef _Traits::_Ptr _Ptr
typedef
_Traits::_constPtr 
_constPtr
typedef
_Ptr::unspecified_bool_type 
unspecified_bool_type

Public Member Functions

 RW_pointer (typename _Ptr::element_type *dptr=0)
 RW_pointer (_Ptr dptr)
void reset ()
void reset (typename _Ptr::element_type *dptr)
void swap (RW_pointer &rhs)
void swap (_Ptr &rhs)
 operator unspecified_bool_type () const
const _D & operator * () const
const _D * operator-> () const
const _D * get () const
_D & operator * ()
_D * operator-> ()
_D * get ()
bool unique () const
long use_count () const
_constPtr getPtr () const
_Ptr getPtr ()

Private Attributes

_Ptr _dptr

Related Functions

(Note that these are not member functions.)

template<class _D, class _Ptr>
std::ostream & operator<< (std::ostream &str, const RW_pointer< _D, _Ptr > &obj)
 Stream output.
template<class _D, class _Ptr>
bool operator== (const RW_pointer< _D, _Ptr > &lhs, const RW_pointer< _D, _Ptr > &rhs)
template<class _D, class _Ptr>
bool operator!= (const RW_pointer< _D, _Ptr > &lhs, const RW_pointer< _D, _Ptr > &rhs)


Detailed Description

template<class _D, class _Traits = rw_pointer::Shared<_D>>
struct zypp::RW_pointer< _D, _Traits >

Wrapper for const correct access via Smart pointer types.

zypp::RW_pointer<tt><_D,_Traits> stores a Smart pointer types of type _Traits::_Ptr, which must be convertible into a _D *. Pointer style access (via -> and *) offers a const _D * in const a context, otherwise a _D *. Thus RW_ means read/write, as you get a different type, dependent on whether you're allowed to read or write.

Forwarding access from an interface to an implemantation class, an RW_pointer prevents const interface methods from accidentally calling nonconst implementation methods.

The second template argument defaults to _Traits = rw_pointer::Shared<_D> thus wraping a shared_ptr<_D>. To wrap an intrusive_ptr<_D> use rw_pointer::Intrusive<_D>.

See also:
zypp::RWCOW_pointer for 'copy on write' functionality.
 #include "zypp/base/PtrTypes.h"

 class Foo
 {
   ...
   private:
     // Implementation class
     struct Impl;
     // Pointer to implementation; actually a shared_ptr<Impl>
     RW_pointer<Impl> _pimpl;

     void baa()       { _pimpl->... } // is Impl *
     void baa() const { _pimpl->... } // is Impl const *
 };

Definition at line 249 of file PtrTypes.h.


Member Typedef Documentation

template<class _D, class _Traits = rw_pointer::Shared<_D>>
typedef _Traits::_Ptr zypp::RW_pointer< _D, _Traits >::_Ptr

Definition at line 251 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
typedef _Traits::_constPtr zypp::RW_pointer< _D, _Traits >::_constPtr

Definition at line 252 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
typedef _Ptr::unspecified_bool_type zypp::RW_pointer< _D, _Traits >::unspecified_bool_type

Definition at line 253 of file PtrTypes.h.


Constructor & Destructor Documentation

template<class _D, class _Traits = rw_pointer::Shared<_D>>
zypp::RW_pointer< _D, _Traits >::RW_pointer ( typename _Ptr::element_type *  dptr = 0  )  [inline, explicit]

Definition at line 256 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
zypp::RW_pointer< _D, _Traits >::RW_pointer ( _Ptr  dptr  )  [inline, explicit]

Definition at line 261 of file PtrTypes.h.


Member Function Documentation

template<class _D, class _Traits = rw_pointer::Shared<_D>>
void zypp::RW_pointer< _D, _Traits >::reset (  )  [inline]

Definition at line 265 of file PtrTypes.h.

Referenced by zypp::media::MediaHandler::checkAttached(), zypp::media::MediaHandler::release(), zypp::media::MediaHandler::setAttachPoint(), and zypp::media::MediaHandler::setMediaSource().

template<class _D, class _Traits = rw_pointer::Shared<_D>>
void zypp::RW_pointer< _D, _Traits >::reset ( typename _Ptr::element_type *  dptr  )  [inline]

Definition at line 268 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
void zypp::RW_pointer< _D, _Traits >::swap ( RW_pointer< _D, _Traits > &  rhs  )  [inline]

Definition at line 271 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
void zypp::RW_pointer< _D, _Traits >::swap ( _Ptr rhs  )  [inline]

Definition at line 274 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
zypp::RW_pointer< _D, _Traits >::operator unspecified_bool_type (  )  const [inline]

Definition at line 277 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
const _D& zypp::RW_pointer< _D, _Traits >::operator * (  )  const [inline]

Definition at line 280 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
const _D* zypp::RW_pointer< _D, _Traits >::operator-> (  )  const [inline]

Definition at line 283 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
const _D* zypp::RW_pointer< _D, _Traits >::get (  )  const [inline]

Definition at line 286 of file PtrTypes.h.

Referenced by zypp::RW_pointer< _D, _Traits >::operator==().

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_D& zypp::RW_pointer< _D, _Traits >::operator * (  )  [inline]

Definition at line 289 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_D* zypp::RW_pointer< _D, _Traits >::operator-> (  )  [inline]

Definition at line 292 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_D* zypp::RW_pointer< _D, _Traits >::get (  )  [inline]

Definition at line 295 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
bool zypp::RW_pointer< _D, _Traits >::unique (  )  const [inline]

Definition at line 299 of file PtrTypes.h.

Referenced by zypp::media::MediaHandler::isSharedMedia(), zypp::media::MediaHandler::release(), and zypp::media::MediaHandler::removeAttachPoint().

template<class _D, class _Traits = rw_pointer::Shared<_D>>
long zypp::RW_pointer< _D, _Traits >::use_count (  )  const [inline]

Definition at line 302 of file PtrTypes.h.

Referenced by zypp::media::MediaHandler::release().

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_constPtr zypp::RW_pointer< _D, _Traits >::getPtr (  )  const [inline]

Definition at line 305 of file PtrTypes.h.

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_Ptr zypp::RW_pointer< _D, _Traits >::getPtr (  )  [inline]

Definition at line 308 of file PtrTypes.h.


Member Data Documentation

template<class _D, class _Traits = rw_pointer::Shared<_D>>
_Ptr zypp::RW_pointer< _D, _Traits >::_dptr [private]

Definition at line 312 of file PtrTypes.h.

Referenced by zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::get(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::getPtr(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::operator *(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::operator unspecified_bool_type(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::operator->(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::reset(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::swap(), zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::unique(), and zypp::RW_pointer< zypp::parser::susetags::PackagesFileReader::Impl, zypp::rw_pointer::Scoped< zypp::parser::susetags::PackagesFileReader::Impl > >::use_count().


The documentation for this struct was generated from the following file:
Generated on Tue Sep 25 19:23:14 2007 for libzypp by  doxygen 1.5.3