- Timestamp:
- 10/20/07 18:11:52 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork/Source/System/FieldContainer/Base/OSGParentPointer.inl
r973 r976 47 47 48 48 /*-------------------------------------------------------------------------*/ 49 /* ParentPointer< ContainerT>*/49 /* ParentPointer<ObjectT, RootObjectT> */ 50 50 /*-------------------------------------------------------------------------*/ 51 51 … … 53 53 /* Internal Helpers */ 54 54 55 template <class ContainerT> 56 inline FieldContainerPtr 57 ParentPointer<ContainerT, RefCountPolicyT>::castPtrUp( 58 ContainerPtrConstArg pContainer) const 59 { 60 return static_cast<FieldContainerPtr>(static_cast<void *>(pContainer)); 61 } 62 63 template <class ContainerT> 64 inline typename 65 ParentPointer<ContainerT, RefCountPolicyT>::ContainerPtr 66 ParentPointer<ContainerT, RefCountPolicyT>::castPtrDown( 67 FieldContainerPtrConstArg pContainer) const 68 { 69 return static_cast<ContainerPtr>(static_cast<void *>(pContainer)); 55 template <class ObjectT, class RootObjectT> 56 inline typename ParentPointer<ObjectT, RootObjectT>::RootObjectPtr 57 ParentPointer<ObjectT, RootObjectT>::castPtrUp(ObjectPtrConstArg objectPtr) 58 { 59 return static_cast<RootObjectPtr>(static_cast<void *>(objectPtr)); 60 } 61 62 template <class ObjectT, class RootObjectT> 63 inline typename ParentPointer<ObjectT, RootObjectT>::ObjectPtr 64 ParentPointer<ObjectT, RootObjectT>::castPtrDown( 65 RootObjectPtrConstArg rootObjectPtr) 66 { 67 return static_cast<ObjectPtr>(static_cast<void *>(rootObjectPtr)); 70 68 } 71 69 … … 73 71 /* Constructors */ 74 72 75 template <class ContainerT>76 inline 77 ParentPointer< ContainerT>::ParentPointer(void)73 template <class ObjectT, class RootObjectT> 74 inline 75 ParentPointer<ObjectT, RootObjectT>::ParentPointer(void) 78 76 : _pointer (NullFC), 79 77 _parentFieldId(0xFFFF) … … 81 79 } 82 80 83 template <class ContainerT>84 inline 85 ParentPointer< ContainerT>::ParentPointer(Self const &other)81 template <class ObjectT, class RootObjectT> 82 inline 83 ParentPointer<ObjectT, RootObjectT>::ParentPointer(Self const &other) 86 84 : _pointer (other._pointer ), 87 85 _parentFieldId(other._parentFieldId) … … 90 88 91 89 92 template <class ContainerT>93 inline 94 ParentPointer< ContainerT>::ParentPointer(95 ContainerPtrConstArg pContainer,90 template <class ObjectT, class RootObjectT> 91 inline 92 ParentPointer<ObjectT, RootObjectT>::ParentPointer( 93 ObjectPtrConstArg pObject, 96 94 UInt16 const fieldId = 0xFFFF) 97 95 : _pointer (pContainer), … … 100 98 } 101 99 102 template <class PointerTypeT > 103 template <class OtherContainerT, class OtherPointerTypeT> 104 inline 105 ParentPointer<ContainerT>::ParentPointer( 106 ParentPointer<OtherContainerT, 107 OtherPointerTypeT> const &parentPtr) 100 template <class ObjectT, class RootObjectT> 101 template <class OtherObjectT > 102 inline 103 ParentPointer<ObjectT, RootObjectT>::ParentPointer( 104 ParentPointer<OtherObjectT, RootObjectT> const &parentPtr) 108 105 : _pointer (Self::castPtrUp(parentPtr.get())), 109 106 _parentFieldId(parentPtr.getFieldId() ) … … 111 108 } 112 109 113 template <class ContainerT, class PointerTypeT > 114 template <class OtherContainerT, class OtherRefCountPolicyT> 115 inline 116 ParentPointer<ContainerT>::ParentPointer( 117 ReferenceCountPointer<OtherContainerT, 118 OtherRefCountPolicyT> const &refPtr, 119 UInt16 const fieldId = 0xFFFF) 110 template <class ObjectT, class RootObjectT > 111 template <class OtherObjectT, class OtherRefCountPolicyT> 112 inline 113 ParentPointer<ObjectT, RootObjectT>::ParentPointer( 114 ReferenceCountPointer<OtherObjectT, 115 OtherRefCountPolicyT, 116 RootObjectT > const &refPtr, 117 UInt16 const fieldId = 0xFFFF) 120 118 : _pointer (Self::castPtrUp(refPtr.get())), 121 119 _parentFieldId(fieldId ) … … 126 124 /* Destructor */ 127 125 128 template <class ContainerT>129 inline 130 ParentPointer< ContainerT>::~ParentPointer(void)126 template <class ObjectT, class RootObjectT> 127 inline 128 ParentPointer<ObjectT, RootObjectT>::~ParentPointer(void) 131 129 { 132 130 } … … 135 133 /* Assignment */ 136 134 137 template <class ContainerT>138 inline typename ParentPointer< ContainerT>::Self &139 ParentPointer< ContainerT>::operator=(Self const &other)135 template <class ObjectT, class RootObjectT> 136 inline typename ParentPointer<ObjectT, RootObjectT>::Self & 137 ParentPointer<ObjectT, RootObjectT>::operator=(Self const &other) 140 138 { 141 139 _pointer = other._pointer; … … 145 143 } 146 144 147 template <class ContainerT>148 inline typename ParentPointer< ContainerT>::Self &149 ParentPointer< ContainerT>::operator=(150 ContainerPtrConstArg pContainer)145 template <class ObjectT, class RootObjectT> 146 inline typename ParentPointer<ObjectT, RootObjectT>::Self & 147 ParentPointer<ObjectT, RootObjectT>::operator=( 148 ObjectPtrConstArg pContainer) 151 149 { 152 150 _pointer = Self::castPtrUp(pContainer); … … 156 154 } 157 155 158 template <class ContainerT, class PointerTypeT > 159 template <class OtherContainerT, class OtherPointerTypeT> 160 inline typename ParentPointer<ContainerT>::Self & 161 ParentPointer<ContainerT>::operator=( 162 ParentPointer<OtherContainerT, 163 OtherPointerTypeT> const &parentPtr) 156 template <class ObjectT, class RootObjectT> 157 template <class OtherObjectT> 158 inline typename ParentPointer<ObjectT, RootObjectT>::Self & 159 ParentPointer<ObjectT, RootObjectT>::operator=( 160 ParentPointer<OtherObjectT, RootObjectT> const &parentPtr) 164 161 { 165 162 _pointer = Self::castPtrUp(parentPtr.get()); … … 169 166 } 170 167 171 template < class ContainerT, class PointerTypeT > 172 template <class OtherContainerT, class OtherRefCountPolicyT> 173 inline 174 ParentPointer<ContainerT>::operator=( 175 ReferenceCountPointer<OtherContainerT, 176 OtherRefCountPolicyT> const &refPtr) 168 template <class ObjectT, class RootObjectT > 169 template <class OtherObjectT, class OtherRefCountPolicyT> 170 inline 171 ParentPointer<ObjectT, RootObjectT>::operator=( 172 ReferenceCountPointer<OtherObjectT, 173 OtherRefCountPolicyT, 174 RootObjectT > const &refPtr) 177 175 { 178 176 _pointer = Self::castPtrUp(refPtr.get()); … … 185 183 /* Conversion */ 186 184 187 template <class ContainerT>188 inline 189 ParentPointer< ContainerT>::operator ContainerPtr(void) const185 template <class ObjectT, class RootObjectT> 186 inline 187 ParentPointer<ObjectT, RootObjectT>::operator ObjectPtr(void) const 190 188 { 191 189 return Self::castPtrDown(_pointer.get()); … … 195 193 /* Access */ 196 194 197 template <class ContainerT>198 inline typename ParentPoiner< ContainerT>::ContainerPtr199 ParentPointer< ContainerT>::operator->(void) const195 template <class ObjectT, class RootObjectT> 196 inline typename ParentPoiner<ObjectT, RootObjectT>::ObjectPtr 197 ParentPointer<ObjectT, RootObjectT>::operator->(void) const 200 198 { 201 199 return Self::castPtrDown(_pointer.get()); 202 200 } 203 201 204 template <class ContainerT>205 inline typename ParentPoiner< ContainerT>::Container&206 ParentPointer< ContainerT>::operator*(void) const202 template <class ObjectT, class RootObjectT> 203 inline typename ParentPoiner<ObjectT, RootObjectT>::Object & 204 ParentPointer<ObjectT, RootObjectT>::operator*(void) const 207 205 { 208 206 return *(Self::castPtrDown(_pointer.get())); 209 207 } 210 208 211 template <class ContainerT>212 inline typename ParentPoiner< ContainerT>::ContainerPtr213 ParentPointer< ContainerT>::get(void) const209 template <class ObjectT, class RootObjectT> 210 inline typename ParentPoiner<ObjectT, RootObjectT>::ObjectPtr 211 ParentPointer<ObjectT, RootObjectT>::get(void) const 214 212 { 215 213 return Self::castPtrDown(_pointer.get()); 216 214 } 217 215 218 template <class ContainerT>216 template <class ObjectT, class RootObjectT> 219 217 inline void 220 ParentPointer< ContainerT>::set(221 ContainerPtrConstArg pContainer)218 ParentPointer<ObjectT, RootObjectT>::set( 219 ObjectPtrConstArg pContainer) 222 220 { 223 221 _pointer = Self::castPtrUp(pContainer); 224 222 } 225 223 226 template <class ContainerT>224 template <class ObjectT, class RootObjectT> 227 225 inline UInt16 228 ParentPointer< ContainerT>::getFieldId(void) const226 ParentPointer<ObjectT, RootObjectT>::getFieldId(void) const 229 227 { 230 228 return _parentFieldId; 231 229 } 232 230 233 template <class ContainerT>231 template <class ObjectT, class RootObjectT> 234 232 inline void 235 ParentPointer< ContainerT>::setFieldId(UInt16 const fieldId)233 ParentPointer<ObjectT, RootObjectT>::setFieldId(UInt16 const fieldId) 236 234 { 237 235 _parentFieldId = fieldId; 238 236 } 239 237 240 template <class ContainerT>238 template <class ObjectT, class RootObjectT> 241 239 inline void 242 ParentPointer< ContainerT>::swap(Self &other)240 ParentPointer<ObjectT, RootObjectT>::swap(Self &other) 243 241 { 244 242 _pointer.swap(other._pointer);
