Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > f00c83953c7eb23ee3c18f4f35d8eb6b > files > 108

sfml2-doc-2.0-0.1mdv2010.2.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="tabs.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="logo">
            <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
        </div>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.htm"><span>Modules</span></a></li>
      <li><a href="annotated.htm"><span>Classes</span></a></li>
      <li class="current"><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.htm"><span>File&nbsp;List</span></a></li>
    </ul>
  </div>
<h1>Resource.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment">// This software is provided &#39;as-is&#39;, without any express or implied warranty.</span>
<a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span>
<a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span>
<a name="l00014"></a>00014 <span class="comment">//    you must not claim that you wrote the original software.</span>
<a name="l00015"></a>00015 <span class="comment">//    If you use this software in a product, an acknowledgment</span>
<a name="l00016"></a>00016 <span class="comment">//    in the product documentation would be appreciated but is not required.</span>
<a name="l00017"></a>00017 <span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span>
<a name="l00019"></a>00019 <span class="comment">//    and must not be misrepresented as being the original software.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef SFML_RESOURCE_HPP</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define SFML_RESOURCE_HPP</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="comment">// Headers</span>
<a name="l00031"></a>00031 <span class="comment"></span><span class="preprocessor">#include &lt;SFML/System/Lock.hpp&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;SFML/System/Mutex.hpp&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;set&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;cstddef&gt;</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="keyword">namespace </span>sf
<a name="l00038"></a>00038 {
<a name="l00040"></a>00040 <span class="comment">// These two classes are defined in the same header because</span>
<a name="l00041"></a>00041 <span class="comment">// they depend on each other. And as they&#39;re template classes,</span>
<a name="l00042"></a>00042 <span class="comment">// they must be entirely defined in header files, which</span>
<a name="l00043"></a>00043 <span class="comment">// prevents from proper separate compiling</span>
<a name="l00045"></a>00045 <span class="comment"></span>
<a name="l00046"></a>00046 <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>ResourcePtr;
<a name="l00047"></a>00047 
<a name="l00053"></a>00053 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
<a name="l00054"></a><a class="code" href="classsf_1_1Resource.htm">00054</a> <span class="keyword">class </span><a class="code" href="classsf_1_1Resource.htm" title="Base class for resources that need to notify dependent classes about their destruction...">Resource</a>
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <span class="keyword">protected</span> :
<a name="l00057"></a>00057 
<a name="l00062"></a>00062     <a class="code" href="classsf_1_1Resource.htm#aa044d32edfcd9b6aebd50d03658e8130" title="Default constructor.">Resource</a>();
<a name="l00063"></a>00063 
<a name="l00070"></a>00070     <a class="code" href="classsf_1_1Resource.htm#aa044d32edfcd9b6aebd50d03658e8130" title="Default constructor.">Resource</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Resource.htm" title="Base class for resources that need to notify dependent classes about their destruction...">Resource&lt;T&gt;</a>&amp; copy);
<a name="l00071"></a>00071 
<a name="l00076"></a>00076     <a class="code" href="classsf_1_1Resource.htm#a0e83e83339851d7b3246939bde3fc1ac" title="Destructor.">~Resource</a>();
<a name="l00077"></a>00077 
<a name="l00086"></a>00086     <a class="code" href="classsf_1_1Resource.htm" title="Base class for resources that need to notify dependent classes about their destruction...">Resource&lt;T&gt;</a>&amp; <a class="code" href="classsf_1_1Resource.htm#ab475bb30d25b44440c5ccb2e6a49f5f0" title="Assignment operator.">operator =</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Resource.htm" title="Base class for resources that need to notify dependent classes about their destruction...">Resource&lt;T&gt;</a>&amp; right);
<a name="l00087"></a>00087 
<a name="l00088"></a>00088 <span class="keyword">private</span> :
<a name="l00089"></a>00089 
<a name="l00090"></a>00090     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr</a>&lt;T&gt;;
<a name="l00091"></a>00091 
<a name="l00101"></a>00101     <span class="keywordtype">void</span> Connect(<a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; observer) <span class="keyword">const</span>;
<a name="l00102"></a>00102 
<a name="l00112"></a>00112     <span class="keywordtype">void</span> Disconnect(<a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; observer) <span class="keyword">const</span>;
<a name="l00113"></a>00113 
<a name="l00115"></a>00115     <span class="comment">// Member data</span>
<a name="l00117"></a>00117 <span class="comment"></span>    <span class="keyword">mutable</span> std::set&lt;ResourcePtr&lt;T&gt;*&gt; myObservers; 
<a name="l00118"></a>00118     <span class="keyword">mutable</span> <a class="code" href="classsf_1_1Mutex.htm" title="Blocks concurrent access to shared resources from multiple threads.">Mutex</a>                     myMutex;     
<a name="l00119"></a>00119 };
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 
<a name="l00126"></a>00126 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
<a name="l00127"></a><a class="code" href="classsf_1_1ResourcePtr.htm">00127</a> <span class="keyword">class </span><a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr</a>
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129 <span class="keyword">public</span> :
<a name="l00130"></a>00130 
<a name="l00137"></a>00137     <a class="code" href="classsf_1_1ResourcePtr.htm#a48ddcd15ed75e9ee3ea88e4d29402140" title="Default constructor.">ResourcePtr</a>();
<a name="l00138"></a>00138 
<a name="l00145"></a>00145     <a class="code" href="classsf_1_1ResourcePtr.htm#a48ddcd15ed75e9ee3ea88e4d29402140" title="Default constructor.">ResourcePtr</a>(<span class="keyword">const</span> T* resource);
<a name="l00146"></a>00146 
<a name="l00155"></a>00155     <a class="code" href="classsf_1_1ResourcePtr.htm#a48ddcd15ed75e9ee3ea88e4d29402140" title="Default constructor.">ResourcePtr</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; copy);
<a name="l00156"></a>00156 
<a name="l00161"></a>00161     <a class="code" href="classsf_1_1ResourcePtr.htm#a0ec69fdecccd1240030b24385f6884dd" title="Destructor.">~ResourcePtr</a>();
<a name="l00162"></a>00162 
<a name="l00171"></a>00171     <a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; <a class="code" href="classsf_1_1ResourcePtr.htm#aa106df991daa6c5c7d7c2da8464da965" title="Assignment operator for a ResourcePtr parameter.">operator =</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; right);
<a name="l00172"></a>00172 
<a name="l00181"></a>00181     <a class="code" href="classsf_1_1ResourcePtr.htm" title="Safe pointer to a sf::Resource&amp;lt;T&amp;gt;">ResourcePtr&lt;T&gt;</a>&amp; <a class="code" href="classsf_1_1ResourcePtr.htm#aa106df991daa6c5c7d7c2da8464da965" title="Assignment operator for a ResourcePtr parameter.">operator =</a>(<span class="keyword">const</span> T* resource);
<a name="l00182"></a>00182 
<a name="l00193"></a>00193     <a class="code" href="classsf_1_1ResourcePtr.htm#a7af0f407f121bff6e4dcf71c7c7955de" title="Cast operator to implicitely convert the resource pointer to its raw pointer type...">operator const T*</a>() <span class="keyword">const</span>;
<a name="l00194"></a>00194 
<a name="l00204"></a>00204     <span class="keyword">const</span> T&amp; <a class="code" href="classsf_1_1ResourcePtr.htm#a4e5401c5a07347a35cc3b9192e11b071" title="Overload of unary operator *.">operator *</a>() <span class="keyword">const</span>;
<a name="l00205"></a>00205 
<a name="l00215"></a>00215     <span class="keyword">const</span> T* <a class="code" href="classsf_1_1ResourcePtr.htm#ae58ea517eee0a97a778c3c59e4c3fe3a" title="Overload of operator -&amp;gt;">operator -&gt;</a>() <span class="keyword">const</span>;
<a name="l00216"></a>00216 
<a name="l00226"></a>00226     <span class="keywordtype">void</span> <a class="code" href="classsf_1_1ResourcePtr.htm#ae7e9d9ed819db0f541a7c22f5a28abf9" title="Function called when the observed resource is about to be destroyed.">OnResourceDestroyed</a>();
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 <span class="keyword">private</span> :
<a name="l00229"></a>00229 
<a name="l00231"></a>00231     <span class="comment">// Member data</span>
<a name="l00233"></a>00233 <span class="comment"></span>    <span class="keyword">const</span> T* myResource; 
<a name="l00234"></a>00234 };
<a name="l00235"></a>00235 
<a name="l00236"></a>00236 <span class="preprocessor">#include &lt;SFML/System/Resource.inl&gt;</span>
<a name="l00237"></a>00237 <span class="preprocessor">#include &lt;SFML/System/ResourcePtr.inl&gt;</span>
<a name="l00238"></a>00238 
<a name="l00239"></a>00239 } <span class="comment">// namespace sf</span>
<a name="l00240"></a>00240 
<a name="l00241"></a>00241 
<a name="l00242"></a>00242 <span class="preprocessor">#endif // SFML_RESOURCE_HPP</span>
<a name="l00243"></a>00243 <span class="preprocessor"></span>
<a name="l00244"></a>00244 
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 
</pre></div></div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>