Changeset 1204

Show
Ignore:
Timestamp:
05/07/08 18:37:24 (4 days ago)
Author:
cneumann
Message:

added: templated c'tor to convert from ref ptr with different ObjectT and/or

RefCountPolicyT
This is needed so that base class ref pointers can point to derived objects

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/System/FieldContainer/Base/OSGRefCountPtr.h

    r1198 r1204  
    9191    template <class OtherObjectT> 
    9292    RefCountPtr(TransitPtr<OtherObjectT> const &other); 
    93  
    94     explicit 
    95     RefCountPtr(ObjectTransitPtr         &other); 
     93     
     94    template <class OtherObjectT, class OtherRefCountPolicyT> 
     95    RefCountPtr(RefCountPtr<OtherObjectT, 
     96                            OtherRefCountPolicyT> const &other); 
    9697 
    9798    RefCountPtr(Object           * const  pObj ); 
  • trunk/Source/System/FieldContainer/Base/OSGRefCountPtr.inl

    r1198 r1204  
    5959 
    6060template <class ObjectT,  
    61           class RefCountPolicyT> inline 
    62 RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr(ObjectTransitPtr &other) 
    63 { 
    64     RefCountPolicy::convertTransitPtr(_pObj, other._pObj); 
    65 } 
    66  
    67 template <class ObjectT,  
    6861          class RefCountPolicyT> 
    6962template <class OtherObjectT   > inline 
     
    7669} 
    7770 
     71template <class ObjectT, 
     72          class RefCountPolicyT     > 
     73template <class OtherObjectT, 
     74          class OtherRefCountPolicyT> inline 
     75RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr( 
     76    RefCountPtr<OtherObjectT, OtherRefCountPolicyT> const &other) : 
     77     
     78    _pObj(NULL) 
     79{ 
     80    ObjectT *pOther = other.get(); 
     81 
     82    RefCountPolicyT::addRef(pOther); 
     83 
     84    _pObj = pOther; 
     85} 
    7886 
    7987template <class ObjectT,