<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>HippoDraw Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="hippoApp.ico"> </head><body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_dbaad1333373aec6813a85f4941b722b.html">pattern</a> </div> </div> <div class="contents"> <h1>Observable.h</h1><a href="Observable_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: c++ -*- */</span> <a name="l00002"></a>00002 <a name="l00014"></a>00014 <span class="preprocessor">#ifndef _Observable_H_</span> <a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#define _Observable_H_</span> <a name="l00016"></a>00016 <span class="preprocessor"></span> <a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="libhippo_8h.html">libhippo.h</a>"</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#include <msdevstudio/MSconfig.h></span> <a name="l00021"></a>00021 <span class="preprocessor">#endif</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <list></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="keyword">namespace </span>hippodraw { <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">class </span>Observer; <a name="l00028"></a>00028 <a name="l00039"></a><a class="code" href="classhippodraw_1_1Observable.html">00039</a> <span class="keyword">class </span><a class="code" href="libhippo_8h.html#a480024fd54849c743866874550153711">MDL_HIPPOPLOT_API</a> <a class="code" href="classhippodraw_1_1Observable.html" title="Part of an implementation of the Observable-Observer pattern based on the example...">Observable</a> <a name="l00040"></a>00040 { <a name="l00041"></a>00041 <span class="keyword">public</span>: <a name="l00042"></a>00042 <a name="l00045"></a><a class="code" href="classhippodraw_1_1Observable.html#acef4d8e612e178823a07dd146c0bfe57">00045</a> <span class="keyword">typedef</span> std::list < Observer * > <a class="code" href="classhippodraw_1_1Observable.html#acef4d8e612e178823a07dd146c0bfe57" title="The type of STL container to maintain list of Observer objects.">ObserverList_t</a>; <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="keyword">private</span>: <a name="l00048"></a>00048 <a name="l00051"></a><a class="code" href="classhippodraw_1_1Observable.html#a33534cc77349774516e6504fc90ab2e6">00051</a> <a class="code" href="classhippodraw_1_1Observable.html#acef4d8e612e178823a07dd146c0bfe57" title="The type of STL container to maintain list of Observer objects.">ObserverList_t</a> m_list; <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">//protected:</span> <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keyword">public</span>: <a name="l00057"></a>00057 <a class="code" href="classhippodraw_1_1Observable.html" title="Part of an implementation of the Observable-Observer pattern based on the example...">Observable</a>(); <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keyword">public</span>: <a name="l00060"></a>00060 <a name="l00066"></a>00066 <span class="keyword">virtual</span> ~<a class="code" href="classhippodraw_1_1Observable.html" title="Part of an implementation of the Observable-Observer pattern based on the example..."> Observable</a> (); <a name="l00067"></a>00067 <a name="l00069"></a>00069 <span class="keywordtype">void</span> addObserver ( <a class="code" href="classhippodraw_1_1Observer.html" title="Part of an implementation of the Observable Observer pattern based on the example...">Observer</a> * ); <a name="l00070"></a>00070 <a name="l00072"></a>00072 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Observable.html#acef4d8e612e178823a07dd146c0bfe57" title="The type of STL container to maintain list of Observer objects.">ObserverList_t</a> & getObservers () <span class="keyword">const</span>; <a name="l00073"></a>00073 <a name="l00075"></a>00075 <span class="keywordtype">void</span> removeObserver ( <a class="code" href="classhippodraw_1_1Observer.html" title="Part of an implementation of the Observable Observer pattern based on the example...">Observer</a> * ); <a name="l00076"></a>00076 <a name="l00083"></a>00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> notifyObservers () <span class="keyword">const</span>; <a name="l00084"></a>00084 <a name="l00086"></a><a class="code" href="classhippodraw_1_1Observable.html#acfda8a034b81a1a207c99ca26d4d032e">00086</a> <span class="keyword">typedef</span> void ( <a class="code" href="classhippodraw_1_1Observer.html" title="Part of an implementation of the Observable Observer pattern based on the example...">Observer</a>::*Action ) ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Observable.html" title="Part of an implementation of the Observable-Observer pattern based on the example...">Observable</a> * ); <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="keyword">protected</span>: <a name="l00089"></a>00089 <a name="l00092"></a>00092 <span class="keywordtype">void</span> notifyObservers ( Action action ) <span class="keyword">const</span>; <a name="l00093"></a>00093 <a name="l00094"></a>00094 }; <a name="l00095"></a>00095 <a name="l00096"></a>00096 } <span class="comment">// namespace hippodraw</span> <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="preprocessor">#endif // _Observable_H_</span> </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0> </a> </small></address> </body> </html>