Changeset 988 for branches/Carsten_PtrWork/Source/System/FieldContainer/Base/OSGReferenceCountPointer.h
- Timestamp:
- 10/24/07 19:30:30 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork/Source/System/FieldContainer/Base/OSGReferenceCountPointer.h
r976 r988 47 47 48 48 #include "OSGFieldContainer.h" 49 #include "OSGFieldBundle.h" 49 50 50 51 #include <boost/static_assert.hpp> 51 52 #include <boost/type_traits/is_convertible.hpp> 53 #include <boost/shared_ptr.hpp> 52 54 53 55 #ifdef OSG_DOC_FILES_IN_MODULE … … 94 96 struct OSG_SYSTEM_DLLMAPPING MTRefCountPolicy 95 97 { 96 }; 97 98 template <> 99 struct OSG_SYSTEM_DLLMAPPING MTRefCountPolicy<FieldContainer> 100 { 101 OSG_GEN_NAMED_CONTAINER_PTR(FieldContainer, RootObject) 98 OSG_GEN_NAMED_CONTAINER_PTR(RootObjectT, RootObject) 102 99 103 100 static void addRef(RootObjectPtrConstArg rootObjectPtr); … … 116 113 }; 117 114 115 118 116 /*! \ingroup GrpSystemFieldContainer 119 117 \class WeakRefCountPolicy<RootObjectT> … … 129 127 static RootObjectPtr deref (RootObjectPtrConstArg rootObjectPtr); 130 128 }; 129 130 namespace detail 131 { 132 // Internal tag type to designate that a static_cast is requested 133 struct StaticCastTag 134 { 135 }; 136 137 // Internal tag type to designate that a const_cast is requested 138 struct ConstCastTag 139 { 140 }; 141 142 // Inernal tag type to designate that a dynamic_cast is requested 143 struct DynamicCastTag 144 { 145 }; 146 } // namespace detail 147 131 148 132 149 /*! \ingroup GrpSystemFieldContainer … … 177 194 ReferenceCountPointer( 178 195 ReferenceCountPointer<OtherObjectT, 179 OtherRefCountPolicyT> const &refPtr ); 196 OtherRefCountPolicyT, 197 RootObject > const &refPtr ); 198 199 template <class OtherObjectT, class OtherRefCountPolicyT> 200 ReferenceCountPointer( 201 ReferenceCountPointer<OtherObjectT, 202 OtherRefCountPolicyT, 203 RootObject > const &refPtr, 204 detail::StaticCastTag ); 205 206 template <class OtherObjectT, class OtherRefCountPolicyT> 207 ReferenceCountPointer( 208 ReferenceCountPointer<OtherObjectT, 209 OtherRefCountPolicyT, 210 RootObject > const &refPtr, 211 detail::ConstCastTag ); 212 213 template <class OtherObjectT, class OtherRefCountPolicyT> 214 ReferenceCountPointer( 215 ReferenceCountPointer<OtherObjectT, 216 OtherRefCountPolicyT, 217 RootObject > const &refPtr, 218 detail::DynamicCastTag ); 180 219 181 220 /*! \} */ … … 197 236 Self &operator=( 198 237 ReferenceCountPointer<OtherObjectT, 199 OtherRefCountPolicy> const &refPtr ); 238 OtherRefCountPolicy, 239 RootObject > const &refPtr ); 200 240 201 241 /*! \} */ … … 288 328 class RefCountPolicyT, class RootObjectT > 289 329 OSG::ReferenceCountPointer<TargetObjectT, RefCountPolicyT, RootObjectT> 330 static_pointer_cast(OSG::ReferenceCountPointer<SourceObjectT, 331 RefCountPolicyT, 332 RootObjectT > const &source); 333 334 template <class TargetObjectT, class SourceObjectT, 335 class RefCountPolicyT, class RootObjectT > 336 OSG::ReferenceCountPointer<TargetObjectT, RefCountPolicyT, RootObjectT> 337 const_pointer_cast(OSG::ReferenceCountPointer<SourceObjectT, 338 RefCountPolicyT, 339 RootObjectT > const &source); 340 341 template <class TargetObjectT, class SourceObjectT, 342 class RefCountPolicyT, class RootObjectT > 343 OSG::ReferenceCountPointer<TargetObjectT, RefCountPolicyT, RootObjectT> 290 344 dynamic_pointer_cast(OSG::ReferenceCountPointer<SourceObjectT, 291 345 RefCountPolicyT, 292 RootObjectT > const &source) 293 { 294 TargetObjectT *targetPtr = dynamic_cast<TargetObjectT *>(source.get()); 295 OSG::ReferenceCountPointer<TargetObjectT, 296 RefCountPolicyT, 297 RootObjectT > returnValue(); 298 299 if(targetPtr != NULL) 300 { 301 returnValue.set(targetPtr); 302 } 303 304 return returnValue; 305 } 346 RootObjectT > const &source); 306 347 307 348 } // namespace boost 308 349 350 #include "OSGReferenceCountPointer.inl" 351 309 352 #endif // _OSGREFERENCECOUNTPOINTER_H_
