/usr/share/doc/libucommon-dev/a00190_source.html is in libucommon-doc 3.2.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>UCommon: ucommon/counter.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</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>Globals</span></a></li>
</ul>
</div>
<h1>ucommon/counter.h</h1><a href="a00190.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published </span>
<a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.</span>
<a name="l00017"></a>00017
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _UCOMMON_COUNTER_H_</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_COUNTER_H_</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#ifndef _UCOMMON_CONFIG_H_</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00201.html" title="Various miscelanous platform specific headers and defines.">ucommon/platform.h</a>></span>
<a name="l00031"></a>00031 <span class="preprocessor">#endif</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 NAMESPACE_UCOMMON
<a name="l00034"></a>00034
<a name="l00042"></a><a class="code" href="a00044.html">00042</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00044.html" title="Automatic integer counting class.">counter</a>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keyword">private</span>:
<a name="l00045"></a>00045 <span class="keywordtype">unsigned</span> value, cycle;
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00051"></a>00051 <a class="code" href="a00044.html" title="Automatic integer counting class.">counter</a>();
<a name="l00052"></a>00052
<a name="l00057"></a>00057 <a class="code" href="a00044.html" title="Automatic integer counting class.">counter</a>(<span class="keywordtype">unsigned</span> limit);
<a name="l00058"></a>00058
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keyword">get</span>(void);
<a name="l00064"></a>00064
<a name="l00069"></a><a class="code" href="a00044.html#a3c0301be35aeb632cf6eea921b2614ce">00069</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> range(<span class="keywordtype">void</span>)
<a name="l00070"></a>00070 {<span class="keywordflow">return</span> cycle;};
<a name="l00071"></a>00071
<a name="l00076"></a><a class="code" href="a00044.html#aba86ea63fcf9c4116dec6658d6b40670">00076</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> operator*()
<a name="l00077"></a>00077 {<span class="keywordflow">return</span> <span class="keyword">get</span>();};
<a name="l00078"></a>00078
<a name="l00083"></a><a class="code" href="a00044.html#af55807f889e554886eeaa7111a6206ea">00083</a> <span class="keyword">inline</span> operator unsigned()
<a name="l00084"></a>00084 {<span class="keywordflow">return</span> <span class="keyword">get</span>();};
<a name="l00085"></a>00085
<a name="l00090"></a>00090 <span class="keywordtype">void</span> operator=(<span class="keywordtype">unsigned</span> value);
<a name="l00091"></a>00091 };
<a name="l00092"></a>00092
<a name="l00100"></a><a class="code" href="a00133.html">00100</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00133.html" title="Automatically return a sequence of untyped objects.">SeqCounter</a> : <span class="keyword">protected</span> <a class="code" href="a00044.html" title="Automatic integer counting class.">counter</a>
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102 <span class="keyword">private</span>:
<a name="l00103"></a>00103 <span class="keywordtype">void</span> *item;
<a name="l00104"></a>00104 <span class="keywordtype">size_t</span> offset;
<a name="l00105"></a>00105
<a name="l00106"></a>00106 <span class="keyword">protected</span>:
<a name="l00107"></a>00107 <a class="code" href="a00133.html" title="Automatically return a sequence of untyped objects.">SeqCounter</a>(<span class="keywordtype">void</span> *<a class="code" href="a00214.html#a190c5597b1e578ec9c7b85e0b6705e48" title="Convenience function to start a joinable thread.">start</a>, <span class="keywordtype">size_t</span> size, <span class="keywordtype">unsigned</span> count);
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <span class="keywordtype">void</span> *<span class="keyword">get</span>(void);
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <span class="keywordtype">void</span> *<span class="keyword">get</span>(<span class="keywordtype">unsigned</span> idx);
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="keyword">public</span>:
<a name="l00118"></a><a class="code" href="a00133.html#a7738e422e207213ecad0ad07511e04bb">00118</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00044.html#a3a3257238aacea56cf02492a440e79ed" title="Assign the value of the counter.">operator=</a>(<span class="keywordtype">unsigned</span> inc_offset)
<a name="l00119"></a>00119 {counter::operator=(inc_offset);};
<a name="l00120"></a>00120 };
<a name="l00121"></a>00121
<a name="l00126"></a><a class="code" href="a00172.html">00126</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00172.html" title="Automatically toggle a bool on each reference.">toggle</a>
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128 <span class="keyword">private</span>:
<a name="l00129"></a>00129 <span class="keywordtype">bool</span> value;
<a name="l00130"></a>00130
<a name="l00131"></a>00131 <span class="keyword">public</span>:
<a name="l00132"></a>00132 <span class="keyword">inline</span> <a class="code" href="a00172.html" title="Automatically toggle a bool on each reference.">toggle</a>()
<a name="l00133"></a>00133 {value = <span class="keyword">false</span>;};
<a name="l00134"></a>00134
<a name="l00135"></a>00135 <span class="keywordtype">bool</span> <span class="keyword">get</span>(void);
<a name="l00136"></a>00136
<a name="l00137"></a>00137 <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator*()
<a name="l00138"></a>00138 {<span class="keywordflow">return</span> <span class="keyword">get</span>();};
<a name="l00139"></a>00139
<a name="l00140"></a>00140 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keywordtype">bool</span> v)
<a name="l00141"></a>00141 {value = v;};
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="keyword">inline</span> operator bool()
<a name="l00144"></a>00144 {<span class="keywordflow">return</span> <span class="keyword">get</span>();};
<a name="l00145"></a>00145
<a name="l00146"></a>00146 };
<a name="l00147"></a>00147
<a name="l00154"></a>00154 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<a name="l00155"></a><a class="code" href="a00134.html">00155</a> <span class="keyword">class </span><a class="code" href="a00134.html" title="A template to return a sequence of objects of a specified type.">sequence</a> : <span class="keyword">public</span> <a class="code" href="a00133.html" title="Automatically return a sequence of untyped objects.">SeqCounter</a>
<a name="l00156"></a>00156 {
<a name="l00157"></a>00157 <span class="keyword">protected</span>:
<a name="l00158"></a>00158 <span class="keyword">inline</span> T *<span class="keyword">get</span>(<span class="keywordtype">unsigned</span> idx)
<a name="l00159"></a>00159 {<span class="keywordflow">return</span> <span class="keyword">static_cast<</span>T *<span class="keyword">></span>(SeqCounter::get(idx));};
<a name="l00160"></a>00160
<a name="l00161"></a>00161 <span class="keyword">public</span>:
<a name="l00167"></a><a class="code" href="a00134.html#a29a0338207c601bae6522ef380622ba2">00167</a> <span class="keyword">inline</span> <a class="code" href="a00134.html" title="A template to return a sequence of objects of a specified type.">sequence</a>(T *array, <span class="keywordtype">unsigned</span> size) :
<a name="l00168"></a>00168 <a class="code" href="a00133.html" title="Automatically return a sequence of untyped objects.">SeqCounter</a>(array, sizeof(T), size) {};
<a name="l00169"></a>00169
<a name="l00174"></a><a class="code" href="a00134.html#a079baf7abab8e81858f78e476208388c">00174</a> <span class="keyword">inline</span> T* <span class="keyword">get</span>(void)
<a name="l00175"></a>00175 {<span class="keywordflow">return</span> <span class="keyword">static_cast<</span>T *<span class="keyword">></span>(SeqCounter::get());};
<a name="l00176"></a>00176
<a name="l00181"></a><a class="code" href="a00134.html#aedd0a5ac46dfaa4648665efa606a7e8b">00181</a> <span class="keyword">inline</span> T& operator*()
<a name="l00182"></a>00182 {<span class="keywordflow">return</span> *<span class="keyword">get</span>();};
<a name="l00183"></a>00183
<a name="l00188"></a><a class="code" href="a00134.html#a01f1fadc147ebd9123b9fa479f4fcb5f">00188</a> <span class="keyword">inline</span> operator T&()
<a name="l00189"></a>00189 {<span class="keywordflow">return</span> *<span class="keyword">get</span>();};
<a name="l00190"></a>00190
<a name="l00196"></a><a class="code" href="a00134.html#ac0530bda4dc927aa460a24ad39bbb11d">00196</a> <span class="keyword">inline</span> T& operator[](<span class="keywordtype">unsigned</span> offset)
<a name="l00197"></a>00197 {<span class="keywordflow">return</span> *<span class="keyword">get</span>(offset);};
<a name="l00198"></a>00198 };
<a name="l00199"></a>00199
<a name="l00203"></a><a class="code" href="a00214.html#aa9f73bc9ec0fc59dc61c71ae9c6efb6f">00203</a> <span class="keyword">typedef</span> <a class="code" href="a00044.html" title="Automatic integer counting class.">counter</a> <a class="code" href="a00044.html" title="Automatic integer counting class.">counter_t</a>;
<a name="l00204"></a>00204
<a name="l00208"></a><a class="code" href="a00214.html#a24751e3b97bbae6f3d26e016895bd18b">00208</a> <span class="keyword">typedef</span> <a class="code" href="a00172.html" title="Automatically toggle a bool on each reference.">toggle</a> <a class="code" href="a00172.html" title="Automatically toggle a bool on each reference.">toggle_t</a>;
<a name="l00209"></a>00209
<a name="l00210"></a>00210 END_NAMESPACE
<a name="l00211"></a>00211
<a name="l00212"></a>00212 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 6 08:22:01 2010 for UCommon by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
|