00001 /* 00002 * Copyright(C) OASIS(R) 2006,2010. All Rights Reserved. 00003 * OASIS trademark, IPR and other policies apply. 00004 */ 00005 00014 #ifndef _oasis_sca_RefCountingPointer_h_ 00015 #define _oasis_sca_RefCountingPointer_h_ 00016 00017 #include <cstddef> 00018 00019 namespace oasis { 00020 namespace sca { 00021 00022 template <typename T> 00023 00030 class RefCountingPointer { 00031 public: 00037 T& operator* () const{ 00038 return *ptr_; 00039 }; 00040 00041 00047 T* operator-> () const{ 00048 return 0; 00049 }; 00050 00051 00056 operator void* () const{ 00057 return 0; 00058 }; 00059 00060 00065 bool operator! () const{ 00066 return 0; 00067 }; 00068 00069 RefCountingPointer(T* ptr) : ptr_(ptr) {}; 00070 RefCountingPointer() {}; 00071 00072 template <typename U> 00073 RefCountingPointer(RefCountingPointer<U> ptr) : ptr_(dynamic_cast<T*>(ptr.ptr_)) {}; 00074 00075 T* ptr_; 00076 00077 }; 00078 00079 00080 template <typename T, typename U> 00086 RefCountingPointer<T> constCast(RefCountingPointer<U> other){ 00087 return NULL; 00088 }; 00089 00090 00091 00092 template <typename T, typename U> 00099 RefCountingPointer<T> dynamicCast(RefCountingPointer<U> other){ 00100 return RefCountingPointer<T>(dynamic_cast<T*>(other.ptr_)); 00101 }; 00102 00103 00104 00105 template <typename T, typename U> 00111 RefCountingPointer<T> reinterpretCast(RefCountingPointer<U> other){ 00112 return NULL; 00113 }; 00114 00115 00116 00117 template <typename T, typename U> 00123 RefCountingPointer<T> staticCast(RefCountingPointer<U> other){ 00124 return NULL; 00125 }; 00126 00127 00128 00129 } // namespace sca 00130 } // namespace oasis 00131 00132 #endif /* _oasis_sca_RefCountingPointer_h_ */