ImplConnect.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_DETAIL_IMPLCONNECT_H
00013 #define ZYPP_DETAIL_IMPLCONNECT_H
00014 
00015 #include "zypp/detail/ResObjectImplIf.h"
00016 
00018 namespace zypp
00019 { 
00020 
00021   namespace detail
00022   { 
00023 
00025     //
00026     //  CLASS NAME : ImplConnect
00027     //
00047     struct ImplConnect
00048     {
00049       template<class _Res>
00050         static typename ResImplTraits<typename _Res::Impl>::Ptr resimpl( const intrusive_ptr<_Res> & obj )
00051         { return dynamic_pointer_cast<typename _Res::Impl>(getImpl( obj )); }
00052 
00053       template<class _Res>
00054         static typename ResImplTraits<typename _Res::Impl>::constPtr resimpl( const intrusive_ptr<const _Res> & obj )
00055         { return dynamic_pointer_cast<const typename _Res::Impl>(getConstImpl( obj )); }
00056 
00057     private:
00058       static ResImplTraits<ResObject::Impl>::Ptr getImpl( const ResObject::Ptr & obj )
00059       { return( obj ? &obj->pimpl() : NULL ); }
00060 
00061       static ResImplTraits<ResObject::Impl>::constPtr getConstImpl( const ResObject::constPtr & obj )
00062       { return( obj ? &obj->pimpl() : NULL ); }
00063      };
00065 
00067   } // namespace detail
00070 } // namespace zypp
00072 #endif // ZYPP_DETAIL_IMPLCONNECT_H

Generated on Thu Jul 6 00:07:20 2006 for zypp by  doxygen 1.4.6