Show
Ignore:
Timestamp:
10/20/07 18:11:52 (1 year ago)
Author:
cneumann
Message:

added: RootObjectT template paremter for ReferenceCountPointer?

and ParentPointer? templates - allows use for FieldBundles?

compile fixes - but still not done

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork/Source/System/FieldContainer/Base/OSGParentPointer.h

    r973 r976  
    5454OSG_BEGIN_NAMESPACE 
    5555 
    56 template <class ContainerT
    57 class ParentPointer 
     56template <class ObjectT, class RootObjectT = FieldContainer
     57class OSG_SYSTEM_DLLMAPPING ParentPointer 
    5858{ 
    5959    /*==========================  PUBLIC  =================================*/ 
     
    6363    /*! \{                                                                 */ 
    6464   
    65     typedef          ContainerT                                   Container; 
    66     typedef typename WeakRefCountPtrBuilder<FieldContainer>::Ptr  PointerType; 
    67     typedef          ParentPointer<ContainerT, PointerTypeT>      Self; 
     65    typedef          ObjectT                                  Object; 
     66    typedef          RootObjectT                              RootObject; 
     67    typedef typename WeakRefCountPtrBuilder<ObjectT,  
     68                                            RootObject >::Ptr PointerType; 
     69    typedef          ParentPointer<ObjectT, RootObjectT>      Self; 
    6870     
    69     OSG_GEN_NAMED_CONTAINER_PTR(Container, Container) 
     71    OSG_GEN_NAMED_CONTAINER_PTR(Object,     Object    ) 
     72    OSG_GEN_NAMED_CONTAINER_PTR(RootObject, RootObject) 
     73     
     74    template <class OtherObjectT> 
     75    struct rebind 
     76    { 
     77        typedef ParentPointer<OtherObjectT, RootObject> Type; 
     78    }; 
    7079     
    7180    /*! \}                                                                 */ 
     
    7584     
    7685    ParentPointer(void                                                     ); 
    77     ParentPointer(Self                              const &other           ); 
     86    ParentPointer(Self                              const &other           ); 
    7887     
    7988    explicit 
    8089    ParentPointer( 
    81         ContainerPtrConstArg                               pContainer, 
    82         UInt16                                      const  fieldId = 0xFFFF); 
     90        ObjectPtrConstArg                                   objectPtr, 
     91        UInt16                                      const  fieldId = 0xFFFF); 
    8392                               
    84     template <class OtherContainerT, class OtherPointerTypeT> 
     93    template <class OtherObjectT> 
     94    explicit 
     95    ParentPointer(ParentPointer<OtherObjectT, 
     96                                RootObject      >    const &parentPtr       ); 
     97     
     98    template <class OtherObjectT, class OtherRefCountPolicyT> 
    8599    explicit 
    86100    ParentPointer( 
    87         ParentPointer<OtherContainerT, 
    88                       OtherPointerTypeT>            const &parentPtr       ); 
    89      
    90     template <class OtherContainerT, class OtherRefCountPolicyT> 
    91     explicit 
    92     ParentPointer( 
    93         ReferenceCountPointer<OtherContainerT, 
    94                               OtherRefCountPolicyT> const &refPtr, 
    95         UInt16                                      const  fieldId = 0xFFFF); 
     101        ReferenceCountPointer<OtherObjectT, 
     102                              OtherRefCountPolicyT, 
     103                              RootObject           > const &refPtr, 
     104        UInt16                                       const  fieldId = 0xFFFF); 
    96105     
    97106    /*! \}                                                                 */ 
     
    107116    /*! \{                                                                 */ 
    108117     
    109     Self &operator=(Self                           const &other           ); 
    110     Self &operator=(ContainerPtrConstArg                  pContainer, 
    111                     UInt16                         const  fieldId = 0xFFFF); 
     118    Self &operator=(Self                            const &other    ); 
     119    Self &operator=(ObjectPtrConstArg                      objectPtr); 
    112120     
    113     template <class OtherContainerT, class OtherPointerTypeT> 
     121    template <class OtherObjectT> 
    114122    Self &operator=( 
    115         ParentPointer<OtherContainerT, 
    116                       OtherPointerTypeT>           const &parentPtr       ); 
     123        ParentPointer<OtherObjectT, RootObject>     const &parentPtr); 
    117124     
    118     template <class OtherContainerT, class OtherRefCountPolicy> 
     125    template <class OtherObjectT, class OtherRefCountPolicy> 
    119126    Self &operator=( 
    120         ReferenceCountPointer<OtherContainerT, 
    121                               OtherRefCountPolicy> const &refPtr
    122         UInt16                                     const  fieldId = 0xFFFF); 
     127        ReferenceCountPointer<OtherObjectT, 
     128                              OtherRefCountPolicy
     129                              RootObject          > const &refPtr    ); 
    123130     
    124131    /*! \}                                                                 */ 
     
    127134    /*! \{                                                                 */ 
    128135     
    129     operator ContainerPtr (void) const; 
     136    operator ObjectPtr (void) const; 
    130137     
    131138    /*! \}                                                                 */ 
     
    134141    /*! \{                                                                 */ 
    135142     
    136     ContainerPtr  operator->(void                            ) const; 
    137     Container    &operator* (void                            ) const; 
     143    ObjectPtr  operator->(void                        ) const; 
     144    Object    &operator* (void                        ) const; 
    138145     
    139     ContainerPtr  get       (void                            ) const; 
    140     void          set       (ContainerPtrConstArg  pContainer); 
     146    ObjectPtr  get       (void                        ) const; 
     147    void       set       (ObjectPtrConstArg  objectPtr); 
    141148     
    142     UInt16        getFieldId(void                            ) const; 
    143     void          setFieldId(UInt16         const  fieldId   ); 
     149    UInt16     getFieldId(void                        ) const; 
     150    void       setFieldId(UInt16      const  fieldId  ); 
    144151     
    145     void          swap      (Self                 &other     ); 
     152    void       swap      (Self              &other    ); 
    146153     
    147154    /*! \}                                                                 */ 
     
    155162    /*! \{                                                                 */ 
    156163   
    157     static FieldContainerPtr 
    158     castPtrUp  (ContainerPtrConstArg      pContainer) const; 
    159      
    160     static ContainerPtr 
    161     castPtrDown(FieldContainerPtrConstArg pContainer) const; 
     164    static RootObjectPtr castPtrUp  (ObjectPtrConstArg     objectPtr    ); 
     165    static ObjectPtr     castPtrDown(RootObjectPtrConstArg rootObjectPtr); 
    162166   
    163167    /*! \}                                                                 */ 
     
    173177}; 
    174178 
    175  
    176  
    177 // template <class PointerTypeT = ReferenceCountPointer<FieldContainerPtr, 
    178 //                                                      WeakRefCountPolicy> > 
    179 // class ParentPointer<FieldContainer, PointerTypeT> 
    180 // { 
    181 //     /*==========================  PUBLIC  =================================*/ 
    182 //   public: 
    183 //     /*---------------------------------------------------------------------*/ 
    184 //     /*! \name Public Types                                                 */ 
    185 //     /*! \{                                                                 */ 
    186 //    
    187 //     typedef FieldContainer                              Container; 
    188 //     typedef PointerTypeT                                PointerType; 
    189 //     typedef ParentPointer<FieldContainer, PointerTypeT> Self; 
    190 //      
    191 //     OSG_GEN_NAMED_CONTAINER_PTR(FieldContainer, Container) 
    192 //      
    193 //     /*! \}                                                                 */ 
    194 //     /*---------------------------------------------------------------------*/ 
    195 //     /*! \name Constructors                                                 */ 
    196 //     /*! \{                                                                 */ 
    197 //      
    198 //     ParentPointer(void                                                     ); 
    199 //     ParentPointer(Self                              const &other           ); 
    200 //      
    201 //     explicit 
    202 //     ParentPointer( 
    203 //         FieldContainerPtrConstArg                          pContainer, 
    204 //         UInt16                                      const  fieldId = 0xFFFF); 
    205 //                                
    206 //     template <class OtherContainerT, class OtherPointerTypeT> 
    207 //     explicit 
    208 //     ParentPointer( 
    209 //         ParentPointer<OtherContainerT, 
    210 //                       OtherPointerTypeT>            const &parentPtr       ); 
    211 //      
    212 //     template <class OtherContainerT, class OtherRefCountPolicyT> 
    213 //     explicit 
    214 //     ParentPointer( 
    215 //         ReferenceCountPointer<OtherContainerT, 
    216 //                               OtherRefCountPolicyT> const &refPtr, 
    217 //         UInt16                                      const  fieldId = 0xFFFF); 
    218 //      
    219 //     /*! \}                                                                 */ 
    220 //     /*---------------------------------------------------------------------*/ 
    221 //     /*! \name Desctructor                                                  */ 
    222 //     /*! \{                                                                 */ 
    223 //                            
    224 //     ~ParentPointer(void); 
    225 //       
    226 //     /*! \}                                                                 */ 
    227 //     /*---------------------------------------------------------------------*/ 
    228 //     /*! \name Assignment                                                   */ 
    229 //     /*! \{                                                                 */ 
    230 //      
    231 //     Self &operator=(Self                           const &other     ); 
    232 //     Self &operator=(FieldContainerPtrConstArg             pContainer); 
    233 //      
    234 //     template <class OtherContainerT, class OtherPointerTypeT> 
    235 //     Self &operator=( 
    236 //         ParentPointer<OtherContainerT, 
    237 //                       OtherPointerTypeT>           const &parentPtr ); 
    238 //      
    239 //     template <class OtherContainerT, class OtherRefCountPolicy> 
    240 //     Self &operator=( 
    241 //         ReferenceCountPointer<OtherContainerT, 
    242 //                               OtherRefCountPolicy> const &refPtr    ); 
    243 //      
    244 //     /*! \}                                                                 */ 
    245 //     /*---------------------------------------------------------------------*/ 
    246 //     /*! \name Conversion                                                   */ 
    247 //     /*! \{                                                                 */ 
    248 //      
    249 //     operator FieldContainerPtr (void) const; 
    250 //      
    251 //     /*! \}                                                                 */ 
    252 //     /*---------------------------------------------------------------------*/ 
    253 //     /*! \name Access                                                       */ 
    254 //     /*! \{                                                                 */ 
    255 //      
    256 //     FieldContainerPtr  operator->(void                                 ) const; 
    257 //     FieldContainer    &operator* (void                                 ) const; 
    258 //      
    259 //     FieldContainerPtr  get       (void                                 ) const; 
    260 //     void               set       (FieldContainerPtrConstArg  pContainer); 
    261 //      
    262 //     UInt16             getFieldId(void                                 ) const; 
    263 //     void               setFieldId(UInt16              const  fieldId   ); 
    264 //      
    265 //     void               swap      (Self                      &other     ); 
    266 //      
    267 //     /*! \}                                                                 */ 
    268 //     /*=========================  PROTECTED  ===============================*/ 
    269 //   protected: 
    270 //                                                    
    271 //     /*==========================  PRIVATE  ================================*/ 
    272 //   private: 
    273 //     PointerType _pointer; 
    274 //     UInt16      _parentFieldId; 
    275 // }; 
    276  
    277  
    278179OSG_END_NAMESPACE 
    279180