1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreResourceManager.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
10 | <h1>OgreResourceManager.h</h1><a href="OgreResourceManager_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 <span class="preprocessor">#ifndef _ResourceManager_H__</span> |
---|
35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define _ResourceManager_H__</span> |
---|
36 | 00027 <span class="preprocessor"></span> |
---|
37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
38 | 00029 |
---|
39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgreResource_8h.html">OgreResource.h</a>"</span> |
---|
40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreResourceGroupManager_8h.html">OgreResourceGroupManager.h</a>"</span> |
---|
41 | 00032 <span class="preprocessor">#include "<a class="code" href="OgreIteratorWrappers_8h.html">OgreIteratorWrappers.h</a>"</span> |
---|
42 | 00033 <span class="preprocessor">#include "<a class="code" href="OgreCommon_8h.html">OgreCommon.h</a>"</span> |
---|
43 | 00034 <span class="preprocessor">#include "<a class="code" href="OgreDataStream_8h.html">OgreDataStream.h</a>"</span> |
---|
44 | 00035 <span class="preprocessor">#include "<a class="code" href="OgreStringVector_8h.html">OgreStringVector.h</a>"</span> |
---|
45 | 00036 <span class="preprocessor">#include "<a class="code" href="OgreScriptLoader_8h.html">OgreScriptLoader.h</a>"</span> |
---|
46 | 00037 |
---|
47 | 00038 <span class="keyword">namespace </span>Ogre { |
---|
48 | 00039 |
---|
49 | <a name="l00064"></a><a class="code" href="classOgre_1_1ResourceManager.html">00064</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> ResourceManager : <span class="keyword">public</span> <a class="code" href="classOgre_1_1ScriptLoader.html">ScriptLoader</a> |
---|
50 | 00065 { |
---|
51 | 00066 <span class="keyword">public</span>: |
---|
52 | 00067 <a class="code" href="OgrePrerequisites_8h.html#a12">OGRE_AUTO_MUTEX</a> <span class="comment">// public to allow external locking</span> |
---|
53 | 00068 ResourceManager(); |
---|
54 | 00069 <span class="keyword">virtual</span> ~ResourceManager(); |
---|
55 | 00070 |
---|
56 | 00090 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a> create(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& group, |
---|
57 | 00091 <span class="keywordtype">bool</span> isManual = <span class="keyword">false</span>, <a class="code" href="classOgre_1_1ManualResourceLoader.html">ManualResourceLoader</a>* loader = 0, |
---|
58 | 00092 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a76">NameValuePairList</a>* createParams = 0); |
---|
59 | 00100 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setMemoryBudget( size_t bytes); |
---|
60 | 00101 |
---|
61 | 00104 <span class="keyword">virtual</span> size_t getMemoryBudget(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
62 | 00105 |
---|
63 | 00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> unload(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name); |
---|
64 | 00113 |
---|
65 | 00120 <span class="keyword">virtual</span> <span class="keywordtype">void</span> unload(<a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> handle); |
---|
66 | 00121 |
---|
67 | 00134 <span class="keyword">virtual</span> <span class="keywordtype">void</span> unloadAll(<span class="keywordtype">bool</span> reloadableOnly = <span class="keyword">true</span>); |
---|
68 | 00135 |
---|
69 | 00147 <span class="keyword">virtual</span> <span class="keywordtype">void</span> reloadAll(<span class="keywordtype">bool</span> reloadableOnly = <span class="keyword">true</span>); |
---|
70 | 00148 |
---|
71 | 00163 <span class="keyword">virtual</span> <span class="keywordtype">void</span> unloadUnreferencedResources(<span class="keywordtype">bool</span> reloadableOnly = <span class="keyword">true</span>); |
---|
72 | 00164 |
---|
73 | 00178 <span class="keyword">virtual</span> <span class="keywordtype">void</span> reloadUnreferencedResources(<span class="keywordtype">bool</span> reloadableOnly = <span class="keyword">true</span>); |
---|
74 | 00179 |
---|
75 | 00197 <span class="keyword">virtual</span> <span class="keywordtype">void</span> remove(<a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& r); |
---|
76 | 00198 |
---|
77 | 00216 <span class="keyword">virtual</span> <span class="keywordtype">void</span> remove(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name); |
---|
78 | 00217 |
---|
79 | 00235 <span class="keyword">virtual</span> <span class="keywordtype">void</span> remove(<a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> handle); |
---|
80 | 00250 <span class="keyword">virtual</span> <span class="keywordtype">void</span> removeAll(<span class="keywordtype">void</span>); |
---|
81 | 00251 |
---|
82 | 00254 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a> getByName(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name); |
---|
83 | 00257 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a> getByHandle(<a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> handle); |
---|
84 | 00258 |
---|
85 | <a name="l00260"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera29">00260</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> resourceExists(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name) |
---|
86 | 00261 { |
---|
87 | 00262 <span class="keywordflow">return</span> !getByName(name).<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra13">isNull</a>(); |
---|
88 | 00263 } |
---|
89 | <a name="l00265"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera30">00265</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> resourceExists(<a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> handle) |
---|
90 | 00266 { |
---|
91 | 00267 <span class="keywordflow">return</span> !getByHandle(handle).<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra13">isNull</a>(); |
---|
92 | 00268 } |
---|
93 | 00269 |
---|
94 | 00273 <span class="keyword">virtual</span> <span class="keywordtype">void</span> _notifyResourceTouched(<a class="code" href="classOgre_1_1Resource.html">Resource</a>* res); |
---|
95 | 00274 |
---|
96 | 00278 <span class="keyword">virtual</span> <span class="keywordtype">void</span> _notifyResourceLoaded(<a class="code" href="classOgre_1_1Resource.html">Resource</a>* res); |
---|
97 | 00279 |
---|
98 | 00283 <span class="keyword">virtual</span> <span class="keywordtype">void</span> _notifyResourceUnloaded(<a class="code" href="classOgre_1_1Resource.html">Resource</a>* res); |
---|
99 | 00284 |
---|
100 | 00298 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a> load(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name, |
---|
101 | 00299 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& group, <span class="keywordtype">bool</span> isManual = <span class="keyword">false</span>, |
---|
102 | 00300 <a class="code" href="classOgre_1_1ManualResourceLoader.html">ManualResourceLoader</a>* loader = 0, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a76">NameValuePairList</a>* loadParams = 0); |
---|
103 | 00301 |
---|
104 | <a name="l00317"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera35">00317</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a580">StringVector</a>& getScriptPatterns(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mScriptPatterns; } |
---|
105 | 00318 |
---|
106 | <a name="l00332"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera36">00332</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> parseScript(<a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& groupName) {} |
---|
107 | 00333 |
---|
108 | <a name="l00340"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera37">00340</a> <span class="keyword">virtual</span> <a class="code" href="namespaceOgre.html#a465">Real</a> getLoadingOrder(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mLoadOrder; } |
---|
109 | 00341 |
---|
110 | <a name="l00343"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera38">00343</a> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& getResourceType(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mResourceType; } |
---|
111 | 00344 |
---|
112 | 00345 <span class="keyword">protected</span>: |
---|
113 | 00346 |
---|
114 | 00348 <a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> getNextHandle(<span class="keywordtype">void</span>); |
---|
115 | 00349 |
---|
116 | 00371 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1Resource.html">Resource</a>* createImpl(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& name, <a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> handle, |
---|
117 | 00372 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& group, <span class="keywordtype">bool</span> isManual, <a class="code" href="classOgre_1_1ManualResourceLoader.html">ManualResourceLoader</a>* loader, |
---|
118 | 00373 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a76">NameValuePairList</a>* createParams) = 0; |
---|
119 | 00375 <span class="keyword">virtual</span> <span class="keywordtype">void</span> addImpl( <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& res ); |
---|
120 | 00377 <span class="keyword">virtual</span> <span class="keywordtype">void</span> removeImpl( <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& res ); |
---|
121 | 00380 <span class="keyword">virtual</span> <span class="keywordtype">void</span> checkUsage(<span class="keywordtype">void</span>); |
---|
122 | <a name="l00382"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerb5">00382</a> <span class="keyword">virtual</span> size_t getMemoryUsage(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mMemoryUsage; } |
---|
123 | 00383 |
---|
124 | 00384 |
---|
125 | 00385 <span class="keyword">public</span>: |
---|
126 | <a name="l00386"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw0">00386</a> <span class="keyword">typedef</span> HashMap< String, ResourcePtr > <a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw0">ResourceMap</a>; |
---|
127 | <a name="l00387"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw1">00387</a> <span class="keyword">typedef</span> std::map<ResourceHandle, ResourcePtr> <a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw1">ResourceHandleMap</a>; |
---|
128 | 00388 <span class="keyword">protected</span>: |
---|
129 | <a name="l00389"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp2">00389</a> <a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw1">ResourceHandleMap</a> mResourcesByHandle; |
---|
130 | <a name="l00390"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp3">00390</a> <a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw0">ResourceMap</a> mResources; |
---|
131 | <a name="l00391"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp4">00391</a> <a class="code" href="namespaceOgre.html#a529">ResourceHandle</a> mNextHandle; |
---|
132 | <a name="l00392"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp5">00392</a> size_t mMemoryBudget; <span class="comment">// In bytes</span> |
---|
133 | <a name="l00393"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp6">00393</a> size_t mMemoryUsage; <span class="comment">// In bytes</span> |
---|
134 | 00394 |
---|
135 | 00395 <span class="comment">// IMPORTANT - all subclasses must populate the fields below</span> |
---|
136 | 00396 |
---|
137 | <a name="l00398"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp7">00398</a> <a class="code" href="namespaceOgre.html#a580">StringVector</a> mScriptPatterns; |
---|
138 | <a name="l00400"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp8">00400</a> <a class="code" href="namespaceOgre.html#a465">Real</a> mLoadOrder; |
---|
139 | <a name="l00402"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerp9">00402</a> <a class="code" href="namespaceOgre.html#a471">String</a> mResourceType; |
---|
140 | 00403 |
---|
141 | 00404 <span class="keyword">public</span>: |
---|
142 | <a name="l00405"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagerw2">00405</a> <span class="keyword">typedef</span> <a class="code" href="classOgre_1_1MapIterator.html">MapIterator<ResourceHandleMap></a> <a class="code" href="classOgre_1_1MapIterator.html">ResourceMapIterator</a>; |
---|
143 | <a name="l00410"></a><a class="code" href="classOgre_1_1ResourceManager.html#Ogre_1_1TextureManagera39">00410</a> <a class="code" href="classOgre_1_1MapIterator.html">ResourceMapIterator</a> getResourceIterator(<span class="keywordtype">void</span>) |
---|
144 | 00411 { |
---|
145 | 00412 <span class="keywordflow">return</span> <a class="code" href="classOgre_1_1MapIterator.html">ResourceMapIterator</a>(mResourcesByHandle.begin(), mResourcesByHandle.end()); |
---|
146 | 00413 } |
---|
147 | 00414 |
---|
148 | 00415 |
---|
149 | 00416 |
---|
150 | 00417 }; |
---|
151 | 00418 |
---|
152 | 00419 } |
---|
153 | 00420 |
---|
154 | 00421 <span class="preprocessor">#endif</span> |
---|
155 | </pre></div><hr> |
---|
156 | <p> |
---|
157 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
158 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
159 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
160 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
161 | <Work rdf:about=""> |
---|
162 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
163 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
164 | </Work> |
---|
165 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
166 | |
---|
167 | Last modified Sun Mar 12 14:37:48 2006 |
---|
168 | </p> |
---|
169 | </body> |
---|
170 | </html> |
---|