Changeset 29
- Timestamp:
- 04/04/2007 08:12:01 PM (5 years ago)
- File:
-
- 1 edited
-
nrEngine/include/ResourcePtr.h (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nrEngine/include/ResourcePtr.h
r28 r29 24 24 25 25 namespace nrEngine{ 26 26 27 27 //! Base untemplated class for resource pointers 28 28 /** … … 39 39 class _NRExport IResourcePtr{ 40 40 public: 41 41 42 42 /** 43 43 * Copy constructor 44 44 **/ 45 45 IResourcePtr(const IResourcePtr& resPtr); 46 46 47 47 /** 48 48 * Virtual destructor … … 52 52 mHolder.reset(); 53 53 }; 54 54 55 55 /** 56 56 * Check if the given pointer is the same as this one. 57 57 * @note Two pointers are the same, if they showing to the same resource, and 58 * if their holders are the same or if 58 * if their holders are the same or if 59 59 * both pointers points to NULL. If one of the pointers is an empty pointer, 60 60 * so also false will be returned. 61 61 **/ 62 62 virtual bool operator==(IResourcePtr& res) const; 63 64 63 64 65 65 /** 66 66 * Check equality to normal pointers. 67 67 **/ 68 68 virtual bool operator==(const IResource* p) const; 69 70 69 70 71 71 /** 72 72 * Check whenver two pointers are not the same. … … 74 74 **/ 75 75 virtual bool operator!=(IResourcePtr& res) const; 76 77 76 77 78 78 /** 79 79 * Check whenver two pointers are not the same. … … 81 81 **/ 82 82 virtual bool operator!=(const IResource* res) const; 83 84 83 84 85 85 /** 86 86 * Check whenever this pointer is NULL - does not contain data … … 89 89 return (mHolder.get() == NULL); 90 90 } 91 92 inline bool valid() const { 91 92 /** 93 * Check whenever the pointer contains valid data. The method 94 * if opossite to isNull() 95 **/ 96 inline bool valid()const { 93 97 return (mHolder.get() != NULL); 94 98 } 95 99 96 100 /** 97 101 * Lock the resource to which one this pointer points, to prevent using … … 104 108 **/ 105 109 virtual Result lockPure(); 106 107 110 111 108 112 /** 109 113 * Unlock the resource to which one this pointer points, to prevent using … … 113 117 **/ 114 118 virtual Result unlockPure(); 115 116 119 120 117 121 /** 118 122 * Access to the resource to which one this pointer points. This access need … … 121 125 **/ 122 126 virtual IResource* getBase() const; 123 124 127 128 125 129 /** 126 130 * Access to the resource to which one this pointer points. This access need … … 129 133 **/ 130 134 //virtual IResource& operator*() const; 131 135 132 136 protected: 133 137 134 138 //! Resource Manager is a friend, so it can freely work with this pointers 135 139 friend class IResourceLoader; … … 137 141 //! Also resource manager is a friend 138 142 friend class ResourceManager; 139 143 140 144 //! Shared pointer holding the holder of the resource 141 145 SharedPtr<ResourceHolder> mHolder; 142 146 143 147 /** 144 148 * Get the holder to which one this pointer shows … … 148 152 return mHolder; 149 153 } 150 154 151 155 /** 152 156 * Create an instance of the resource pointer. This pointer is pointing … … 158 162 mHolder = holder; 159 163 } 160 164 161 165 /** 162 166 * Simple constructor that is declared as protected/private, so that this … … 167 171 mHolder.reset(); 168 172 } 169 173 170 174 }; 171 172 173 175 176 177 174 178 //! Resource pointer is a smart pointer pointing to the resource 175 179 /** … … 199 203 class _NRExport ResourcePtr: public IResourcePtr{ 200 204 public: 201 205 202 206 /** 203 207 * Create an empty resource pointer. Such a pointer … … 206 210 **/ 207 211 ResourcePtr() : IResourcePtr() {} 208 212 209 213 /** 210 214 * Copy constructor to allow copying from base class 211 215 **/ 212 216 ResourcePtr(const IResourcePtr& res) : IResourcePtr(res){} 217 <<<<<<< .mine 218 219 220 ======= 213 221 222 >>>>>>> .r28 214 223 /** 215 224 * Access to the resource to which one this pointer points. This access need … … 223 232 return ptr; 224 233 } 225 234 226 235 /** 227 236 * Get the object stored by this pointer. 228 237 * NOTE: The instance is controlled by the pointer, so do not delete it 229 238 **/ 230 NR_FORCEINLINE ResType* get() 239 NR_FORCEINLINE ResType* get() 231 240 { 232 241 return operator->(); 233 } 234 242 } 243 235 244 /** 236 245 * Access to the resource to which one this pointer points. This access need … … 245 254 } 246 255 }; 247 256 248 257 }; 249 258 #endif
Note: See TracChangeset
for help on using the changeset viewer.
