[353] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
| 3 | <title>mixpp: events.h Source File</title> |
---|
| 4 | <link href="tabs.css" rel="stylesheet" type="text/css"> |
---|
| 5 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
| 6 | </head><body> |
---|
| 7 | <!-- Generated by Doxygen 1.5.8 --> |
---|
| 8 | <script type="text/javascript"> |
---|
| 9 | <!-- |
---|
| 10 | function changeDisplayState (e){ |
---|
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
---|
| 12 | var button=this.firstChild; |
---|
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
---|
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
---|
| 15 | sectionDiv.style.display='block'; |
---|
| 16 | button.src='open.gif'; |
---|
| 17 | }else{ |
---|
| 18 | sectionDiv.style.display='none'; |
---|
| 19 | button.src='closed.gif'; |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | function initDynSections(){ |
---|
| 23 | var divs=document.getElementsByTagName('div'); |
---|
| 24 | var sectionCounter=1; |
---|
| 25 | for(var i=0;i<divs.length-1;i++){ |
---|
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
---|
| 27 | var header=divs[i]; |
---|
| 28 | var section=divs[i+1]; |
---|
| 29 | var button=header.firstChild; |
---|
| 30 | if (button!='IMG'){ |
---|
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
---|
| 32 | button=document.createElement('img'); |
---|
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
---|
| 34 | } |
---|
| 35 | header.style.cursor='pointer'; |
---|
| 36 | header.onclick=changeDisplayState; |
---|
| 37 | header.id='dynheader'+sectionCounter; |
---|
| 38 | button.src='closed.gif'; |
---|
| 39 | section.id='dynsection'+sectionCounter; |
---|
| 40 | section.style.display='none'; |
---|
| 41 | section.style.marginLeft='14px'; |
---|
| 42 | sectionCounter++; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | window.onload = initDynSections; |
---|
| 47 | --> |
---|
| 48 | </script> |
---|
| 49 | <div class="navigation" id="top"> |
---|
| 50 | <div class="tabs"> |
---|
| 51 | <ul> |
---|
| 52 | <li><a href="main.html"><span>Main Page</span></a></li> |
---|
| 53 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
| 54 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
| 55 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
| 56 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
| 57 | </ul> |
---|
| 58 | </div> |
---|
| 59 | <div class="tabs"> |
---|
| 60 | <ul> |
---|
| 61 | <li><a href="files.html"><span>File List</span></a></li> |
---|
| 62 | <li><a href="globals.html"><span>File Members</span></a></li> |
---|
| 63 | </ul> |
---|
| 64 | </div> |
---|
| 65 | <h1>events.h</h1><a href="events_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
| 66 | <a name="l00029"></a>00029 <span class="preprocessor">#ifndef EVENTS_H</span> |
---|
| 67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define EVENTS_H</span> |
---|
| 68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
| 69 | <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="itassert_8h.html" title="Error handling functions - header file.">itpp/base/itassert.h</a>></span> |
---|
| 70 | <a name="l00033"></a>00033 <span class="preprocessor">#include <queue></span> |
---|
| 71 | <a name="l00034"></a>00034 <span class="preprocessor">#include <deque></span> |
---|
| 72 | <a name="l00035"></a>00035 |
---|
| 73 | <a name="l00036"></a>00036 |
---|
| 74 | <a name="l00037"></a>00037 <span class="keyword">namespace </span>itpp |
---|
| 75 | <a name="l00038"></a>00038 { |
---|
| 76 | <a name="l00039"></a>00039 |
---|
| 77 | <a name="l00041"></a>00041 |
---|
| 78 | <a name="l00042"></a>00042 |
---|
| 79 | <a name="l00043"></a>00043 <span class="comment">// typedef long double Ttype; //!< 128-bit floating point time</span> |
---|
| 80 | <a name="l00044"></a><a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04">00044</a> <span class="keyword">typedef</span> <span class="keywordtype">double</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a>; |
---|
| 81 | <a name="l00045"></a>00045 <span class="comment">// typedef long unsigned int Ttype; //!< 64-bit unsigned integer time</span> |
---|
| 82 | <a name="l00046"></a>00046 |
---|
| 83 | <a name="l00047"></a>00047 <span class="keyword">class </span><a class="code" href="classitpp_1_1Event__Queue.html" title="Event Queue class.">Event_Queue</a>; |
---|
| 84 | <a name="l00048"></a>00048 <span class="keyword">class </span><a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a>; |
---|
| 85 | <a name="l00049"></a>00049 <span class="keyword">class </span>Base_Signal; |
---|
| 86 | <a name="l00050"></a>00050 |
---|
| 87 | <a name="l00058"></a><a class="code" href="classitpp_1_1Base__Event.html">00058</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> |
---|
| 88 | <a name="l00059"></a>00059 { |
---|
| 89 | <a name="l00060"></a>00060 <span class="keyword">public</span>: |
---|
| 90 | <a name="l00061"></a>00061 <span class="keyword">friend</span> <span class="keyword">class </span>Base_Signal; |
---|
| 91 | <a name="l00062"></a>00062 |
---|
| 92 | <a name="l00063"></a>00063 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classitpp_1_1Event__Queue.html" title="Event Queue class.">Event_Queue</a>; |
---|
| 93 | <a name="l00064"></a>00064 |
---|
| 94 | <a name="l00065"></a>00065 <span class="keyword">friend</span> <span class="keyword">struct </span><a class="code" href="structitpp_1_1Compare__Base__Event__Times.html" title="Compare to events, Returns true if expire time of event1 is larger than the expire...">Compare_Base_Event_Times</a>; |
---|
| 95 | <a name="l00066"></a>00066 |
---|
| 96 | <a name="l00068"></a><a class="code" href="classitpp_1_1Base__Event.html#baeabfb0a38f892224be0d6ec6382d1e">00068</a> <a class="code" href="classitpp_1_1Base__Event.html#baeabfb0a38f892224be0d6ec6382d1e" title="Schedule an event at time delta_time from now.">Base_Event</a>(<span class="keyword">const</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> delta_time) { <span class="comment">// The event will occur in 'delta_time' time units from now!</span> |
---|
| 97 | <a name="l00069"></a>00069 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(delta_time >= 0, <span class="stringliteral">"Only causal simulations are possible"</span>); |
---|
| 98 | <a name="l00070"></a>00070 <a class="code" href="classitpp_1_1Base__Event.html#05911900c8118201c58541a0c4d4522f" title="ADD DOCUMENTATION HERE.">active</a> = <span class="keyword">true</span>; |
---|
| 99 | <a name="l00071"></a>00071 <a class="code" href="classitpp_1_1Base__Event.html#1620ad79858e3690a47502639c848f71" title="ADD DOCUMENTATION HERE.">delta_t</a> = delta_time; |
---|
| 100 | <a name="l00072"></a>00072 <a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a> = 0; <span class="comment">// Will be set correctly upon calling Event_Queue::add().</span> |
---|
| 101 | <a name="l00073"></a>00073 <span class="keywordtype">id</span> = <a class="code" href="classitpp_1_1Base__Event.html#bf53c4e00e13b18a5aed1203aa5cb22b" title="ADD DOCUMENTATION HERE.">global_id</a>++; |
---|
| 102 | <a name="l00074"></a>00074 } |
---|
| 103 | <a name="l00075"></a>00075 |
---|
| 104 | <a name="l00077"></a><a class="code" href="classitpp_1_1Base__Event.html#76cc005e77cd5fd345a7eaab859e209f">00077</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Base__Event.html#76cc005e77cd5fd345a7eaab859e209f" title="Destructor.">~Base_Event</a>() {} |
---|
| 105 | <a name="l00078"></a>00078 |
---|
| 106 | <a name="l00080"></a><a class="code" href="classitpp_1_1Base__Event.html#4d007ec59181c639a4677d95d4011b70">00080</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Base__Event.html#4d007ec59181c639a4677d95d4011b70" title="Cancel an event.">cancel</a>() { <a class="code" href="classitpp_1_1Base__Event.html#05911900c8118201c58541a0c4d4522f" title="ADD DOCUMENTATION HERE.">active</a> = <span class="keyword">false</span>; } |
---|
| 107 | <a name="l00081"></a>00081 |
---|
| 108 | <a name="l00082"></a>00082 <span class="keyword">protected</span>: |
---|
| 109 | <a name="l00084"></a>00084 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Base__Event.html#d7b8e2d54a4a8f31c86dbaf8a39ad74d" title="ADD DOCUMENTATION HERE.">exec</a>(<span class="keywordtype">void</span>) = 0; |
---|
| 110 | <a name="l00086"></a><a class="code" href="classitpp_1_1Base__Event.html#1620ad79858e3690a47502639c848f71">00086</a> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> <a class="code" href="classitpp_1_1Base__Event.html#1620ad79858e3690a47502639c848f71" title="ADD DOCUMENTATION HERE.">delta_t</a>; |
---|
| 111 | <a name="l00088"></a><a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8">00088</a> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> <a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a>; |
---|
| 112 | <a name="l00090"></a><a class="code" href="classitpp_1_1Base__Event.html#05911900c8118201c58541a0c4d4522f">00090</a> <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1Base__Event.html#05911900c8118201c58541a0c4d4522f" title="ADD DOCUMENTATION HERE.">active</a>; |
---|
| 113 | <a name="l00092"></a><a class="code" href="classitpp_1_1Base__Event.html#f9afce7195120eeba4656a2c9a34480e">00092</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Base__Event.html#f9afce7195120eeba4656a2c9a34480e" title="ADD DOCUMENTATION HERE.">id</a>; |
---|
| 114 | <a name="l00094"></a><a class="code" href="classitpp_1_1Base__Event.html#bf53c4e00e13b18a5aed1203aa5cb22b">00094</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Base__Event.html#bf53c4e00e13b18a5aed1203aa5cb22b" title="ADD DOCUMENTATION HERE.">global_id</a>; |
---|
| 115 | <a name="l00095"></a>00095 }; |
---|
| 116 | <a name="l00096"></a>00096 |
---|
| 117 | <a name="l00098"></a><a class="code" href="structitpp_1_1Compare__Base__Event__Times.html">00098</a> <span class="keyword">struct </span><a class="code" href="structitpp_1_1Compare__Base__Event__Times.html" title="Compare to events, Returns true if expire time of event1 is larger than the expire...">Compare_Base_Event_Times</a> { |
---|
| 118 | <a name="l00100"></a><a class="code" href="structitpp_1_1Compare__Base__Event__Times.html#18549de408c23ecdd0b75eb454d67e28">00100</a> <span class="keywordtype">bool</span> <a class="code" href="structitpp_1_1Compare__Base__Event__Times.html#18549de408c23ecdd0b75eb454d67e28" title="ADD DOCUMENTATION HERE.">operator()</a>(<a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> *event1, <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> *event2) { |
---|
| 119 | <a name="l00101"></a>00101 <span class="keywordflow">if</span> (event1-><a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a> == event2-><a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a>) <span class="comment">// Equal expire times.</span> |
---|
| 120 | <a name="l00102"></a>00102 <span class="keywordflow">return</span> (event1-><a class="code" href="classitpp_1_1Base__Event.html#f9afce7195120eeba4656a2c9a34480e" title="ADD DOCUMENTATION HERE.">id</a> > event2-><a class="code" href="classitpp_1_1Base__Event.html#f9afce7195120eeba4656a2c9a34480e" title="ADD DOCUMENTATION HERE.">id</a>); <span class="comment">// Base comparison on the event id.</span> |
---|
| 121 | <a name="l00103"></a>00103 <span class="keywordflow">else</span> |
---|
| 122 | <a name="l00104"></a>00104 <span class="keywordflow">return</span> (event1-><a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a> > event2-><a class="code" href="classitpp_1_1Base__Event.html#e1908543c3f79105e22f89edae9c0ec8" title="ADD DOCUMENTATION HERE.">expire_t</a>); <span class="comment">// Different expire times. Regular comparison.</span> |
---|
| 123 | <a name="l00105"></a>00105 } |
---|
| 124 | <a name="l00106"></a>00106 }; |
---|
| 125 | <a name="l00107"></a>00107 |
---|
| 126 | <a name="l00116"></a><a class="code" href="classitpp_1_1Event__Queue.html">00116</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Event__Queue.html" title="Event Queue class.">Event_Queue</a> |
---|
| 127 | <a name="l00117"></a>00117 { |
---|
| 128 | <a name="l00118"></a>00118 <span class="keyword">public</span>: |
---|
| 129 | <a name="l00119"></a>00119 <span class="keyword">friend</span> <span class="keyword">class </span>Base_Signal; |
---|
| 130 | <a name="l00120"></a>00120 |
---|
| 131 | <a name="l00122"></a><a class="code" href="classitpp_1_1Event__Queue.html#6f7fdf62d13e0590f27bab0fa9b7948d">00122</a> <a class="code" href="classitpp_1_1Event__Queue.html#6f7fdf62d13e0590f27bab0fa9b7948d" title="Constructor.">Event_Queue</a>() {} |
---|
| 132 | <a name="l00124"></a><a class="code" href="classitpp_1_1Event__Queue.html#5312542514cf15448959fc9d81d15961">00124</a> <a class="code" href="classitpp_1_1Event__Queue.html#5312542514cf15448959fc9d81d15961" title="Destructor.">~Event_Queue</a>() {} |
---|
| 133 | <a name="l00125"></a>00125 |
---|
| 134 | <a name="l00127"></a>00127 <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">add</span>(<a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> *e); |
---|
| 135 | <a name="l00129"></a><a class="code" href="classitpp_1_1Event__Queue.html#ac4b417979ddc31b7588602a3c1438e6">00129</a> <span class="keyword">static</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> <a class="code" href="classitpp_1_1Event__Queue.html#ac4b417979ddc31b7588602a3c1438e6" title="Return current time.">now</a>() {<span class="keywordflow">return</span> t;} |
---|
| 136 | <a name="l00131"></a>00131 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Event__Queue.html#5bde95d04badf287fd5bc5c548f3f7f8" title="Start executing events.">start</a>(); |
---|
| 137 | <a name="l00133"></a>00133 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Event__Queue.html#a8fe88816c74d7b6b5b0ed2ad5104264" title="Stop execution of events.">stop</a>(); |
---|
| 138 | <a name="l00135"></a>00135 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Event__Queue.html#e9b152b5ec0fd6bf637df85b44dfa1e3" title="Remove all events.">clear</a>(); |
---|
| 139 | <a name="l00136"></a>00136 <span class="keyword">protected</span>: |
---|
| 140 | <a name="l00137"></a>00137 <span class="comment">//static void cancel_all(Base_Signal *s);</span> |
---|
| 141 | <a name="l00138"></a>00138 <span class="keyword">private</span>: |
---|
| 142 | <a name="l00139"></a>00139 <span class="keyword">typedef</span> std::deque<Base_Event*, std::allocator< Base_Event* > >::iterator Base_Event_Iterator; |
---|
| 143 | <a name="l00140"></a>00140 <span class="keyword">static</span> <span class="keywordtype">void</span> _run(); |
---|
| 144 | <a name="l00141"></a>00141 <span class="keyword">static</span> <span class="keywordtype">bool</span> keep_running; |
---|
| 145 | <a name="l00142"></a>00142 <span class="keyword">static</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> t; <span class="comment">// Current time.</span> |
---|
| 146 | <a name="l00143"></a>00143 <span class="keyword">static</span> std::priority_queue < <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a>*, |
---|
| 147 | <a name="l00144"></a>00144 std::deque<Base_Event*, std::allocator<Base_Event*> >, |
---|
| 148 | <a name="l00145"></a>00145 <a class="code" href="structitpp_1_1Compare__Base__Event__Times.html" title="Compare to events, Returns true if expire time of event1 is larger than the expire...">Compare_Base_Event_Times</a> > event_queue; <span class="comment">// Queue for the Events.</span> |
---|
| 149 | <a name="l00146"></a>00146 }; |
---|
| 150 | <a name="l00147"></a>00147 |
---|
| 151 | <a name="l00153"></a>00153 <span class="keyword">template</span> <<span class="keyword">class</span> ObjectType> |
---|
| 152 | <a name="l00154"></a><a class="code" href="classitpp_1_1Event.html">00154</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Event.html" title="An Event class that executes a function when the event expires.">Event</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> |
---|
| 153 | <a name="l00155"></a>00155 { |
---|
| 154 | <a name="l00156"></a>00156 <span class="keyword">public</span>: |
---|
| 155 | <a name="l00158"></a><a class="code" href="classitpp_1_1Event.html#bbade1e1f52c8189e2de5652064c3a29">00158</a> <a class="code" href="classitpp_1_1Event.html#bbade1e1f52c8189e2de5652064c3a29" title="Construct an Event to expire delta_time from now by calling the function (*object_pointer...">Event</a>(ObjectType *object_pointer, <span class="keywordtype">void</span> (ObjectType::*object_function_pointer)(), <span class="keyword">const</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> delta_time) : <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a>(delta_time) { |
---|
| 156 | <a name="l00159"></a>00159 po = object_pointer; |
---|
| 157 | <a name="l00160"></a>00160 pm = object_function_pointer; |
---|
| 158 | <a name="l00161"></a>00161 } |
---|
| 159 | <a name="l00162"></a>00162 |
---|
| 160 | <a name="l00164"></a><a class="code" href="classitpp_1_1Event.html#8c59d00b1c798cfb8d9ad29caa39c00b">00164</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Event.html#8c59d00b1c798cfb8d9ad29caa39c00b" title="Destructor.">~Event</a>() {} |
---|
| 161 | <a name="l00165"></a>00165 |
---|
| 162 | <a name="l00167"></a><a class="code" href="classitpp_1_1Event.html#e4a29630c0fc9befe3575b3b8a3b3553">00167</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Event.html#e4a29630c0fc9befe3575b3b8a3b3553" title="Execute (call) the assigned function.">exec</a>(<span class="keywordtype">void</span>) {(*po.*pm)(); } |
---|
| 163 | <a name="l00168"></a>00168 |
---|
| 164 | <a name="l00169"></a>00169 <span class="keyword">private</span>: |
---|
| 165 | <a name="l00170"></a>00170 void (ObjectType::*pm)(); <span class="comment">// Pointer to class member function to be executed on event expire.</span> |
---|
| 166 | <a name="l00171"></a>00171 ObjectType *po; <span class="comment">// Pointer to object who's member function is to be executed on event expire.</span> |
---|
| 167 | <a name="l00172"></a>00172 }; |
---|
| 168 | <a name="l00173"></a>00173 |
---|
| 169 | <a name="l00179"></a><a class="code" href="classitpp_1_1Data__Event.html">00179</a> <span class="keyword">template</span> <<span class="keyword">class</span> ObjectType, <span class="keyword">class</span> DataType> <span class="keyword">class </span><a class="code" href="classitpp_1_1Data__Event.html" title="An Event class that executes a function with some data as input when the event expires...">Data_Event</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a> |
---|
| 170 | <a name="l00180"></a>00180 { |
---|
| 171 | <a name="l00181"></a>00181 <span class="keyword">public</span>: |
---|
| 172 | <a name="l00183"></a><a class="code" href="classitpp_1_1Data__Event.html#7d9dc9d82a06e3a2cc2095e2c402af59">00183</a> <a class="code" href="classitpp_1_1Data__Event.html#7d9dc9d82a06e3a2cc2095e2c402af59" title="Construct an Event to expire delta_time from now by calling the function (*object_pointer...">Data_Event</a>(ObjectType *object_pointer, |
---|
| 173 | <a name="l00184"></a>00184 <span class="keywordtype">void</span> (ObjectType::*object_function_pointer)(DataType data), |
---|
| 174 | <a name="l00185"></a>00185 DataType data, <span class="keyword">const</span> <a class="code" href="group__protocol.html#g33cb6c41273f24dbf05adf6e7cdb1a04" title="64-bit floating point time">Ttype</a> delta_time) : <a class="code" href="classitpp_1_1Base__Event.html" title="Base Event Class.">Base_Event</a>(delta_time) { |
---|
| 175 | <a name="l00186"></a>00186 po = object_pointer; |
---|
| 176 | <a name="l00187"></a>00187 pm = object_function_pointer; |
---|
| 177 | <a name="l00188"></a>00188 u = data; |
---|
| 178 | <a name="l00189"></a>00189 } |
---|
| 179 | <a name="l00190"></a>00190 |
---|
| 180 | <a name="l00192"></a><a class="code" href="classitpp_1_1Data__Event.html#d373abc4d9300ee3ba35a7aac4b4a143">00192</a> <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Data__Event.html#d373abc4d9300ee3ba35a7aac4b4a143" title="Destructor.">~Data_Event</a>() {} |
---|
| 181 | <a name="l00193"></a>00193 |
---|
| 182 | <a name="l00195"></a><a class="code" href="classitpp_1_1Data__Event.html#671907a19eb43c5aa0b7b007adc44168">00195</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Data__Event.html#671907a19eb43c5aa0b7b007adc44168" title="Execute (call) the assigned function with user data.">exec</a>(<span class="keywordtype">void</span>) { |
---|
| 183 | <a name="l00196"></a>00196 (*po.*pm)(u); |
---|
| 184 | <a name="l00197"></a>00197 } |
---|
| 185 | <a name="l00198"></a>00198 |
---|
| 186 | <a name="l00199"></a>00199 <span class="keyword">private</span>: |
---|
| 187 | <a name="l00200"></a>00200 void (ObjectType::*pm)(DataType data); <span class="comment">// Pointer to class member function to be executed on event expire.</span> |
---|
| 188 | <a name="l00201"></a>00201 ObjectType* po; <span class="comment">// Pointer to object who's member function is to be executed on event expire.</span> |
---|
| 189 | <a name="l00202"></a>00202 DataType u; <span class="comment">// User data.</span> |
---|
| 190 | <a name="l00203"></a>00203 }; |
---|
| 191 | <a name="l00204"></a>00204 |
---|
| 192 | <a name="l00206"></a>00206 |
---|
| 193 | <a name="l00207"></a>00207 } <span class="comment">// namespace itpp</span> |
---|
| 194 | <a name="l00208"></a>00208 |
---|
| 195 | <a name="l00209"></a>00209 <span class="preprocessor">#endif // #ifndef EVENTS_H</span> |
---|
| 196 | </pre></div></div> |
---|
| 197 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by |
---|
| 198 | <a href="http://www.doxygen.org/index.html"> |
---|
| 199 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 200 | </body> |
---|
| 201 | </html> |
---|