📄 filters_8cpp-source.html
字号:
<a name="l00093"></a>00093 <span class="keywordflow">return</span> <span class="keyword">false</span>;<a name="l00094"></a>00094 }<a name="l00095"></a>00095 <a name="l00096"></a><a class="code" href="class_filter.html#3a24170e0e22a725ea7f0f706d9637a1">00096</a> <span class="keywordtype">void</span> <a class="code" href="class_filter.html#3a24170e0e22a725ea7f0f706d9637a1">Filter::PropagateInitialize</a>(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters, <span class="keywordtype">int</span> propagation)<a name="l00097"></a>00097 {<a name="l00098"></a>00098 <span class="keywordflow">if</span> (propagation)<a name="l00099"></a>00099 <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#0dd5456c06e0e47d901e8055b50df929" title="initialize or reinitialize this object">Initialize</a>(parameters, propagation-1);<a name="l00100"></a>00100 }<a name="l00101"></a>00101 <a name="l00102"></a><a class="code" href="class_filter.html#7efc37bf9ded7a6986f9baa17cb0ff23">00102</a> <span class="keywordtype">size_t</span> <a class="code" href="class_filter.html#7efc37bf9ded7a6986f9baa17cb0ff23">Filter::OutputModifiable</a>(<span class="keywordtype">int</span> outputSite, byte *inString, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking, <span class="keyword">const</span> std::string &channel)<a name="l00103"></a>00103 {<a name="l00104"></a>00104 <span class="keywordflow">if</span> (messageEnd)<a name="l00105"></a>00105 messageEnd--;<a name="l00106"></a>00106 <span class="keywordtype">size_t</span> result = <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#770bf11f26d4dec66423a7dc2d36843d" title="input multiple bytes that may be modified by callee for blocking or non-blocking...">PutModifiable2</a>(inString, length, messageEnd, blocking);<a name="l00107"></a>00107 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = result ? outputSite : 0;<a name="l00108"></a>00108 <span class="keywordflow">return</span> result;<a name="l00109"></a>00109 }<a name="l00110"></a>00110 <a name="l00111"></a><a class="code" href="class_filter.html#a05cdcaa161f2131cf4d5dcb8903e11f">00111</a> <span class="keywordtype">size_t</span> <a class="code" href="class_filter.html#a05cdcaa161f2131cf4d5dcb8903e11f">Filter::Output</a>(<span class="keywordtype">int</span> outputSite, <span class="keyword">const</span> byte *inString, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking, <span class="keyword">const</span> std::string &channel)<a name="l00112"></a>00112 {<a name="l00113"></a>00113 <span class="keywordflow">if</span> (messageEnd)<a name="l00114"></a>00114 messageEnd--;<a name="l00115"></a>00115 <span class="keywordtype">size_t</span> result = <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#d396dcb42260f23125a35ec0e5d17d55" title="input multiple bytes for blocking or non-blocking processing">Put2</a>(inString, length, messageEnd, blocking);<a name="l00116"></a>00116 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = result ? outputSite : 0;<a name="l00117"></a>00117 <span class="keywordflow">return</span> result;<a name="l00118"></a>00118 }<a name="l00119"></a>00119 <a name="l00120"></a><a class="code" href="class_filter.html#b4bcb84ff32215c6c31432e83419ff55">00120</a> <span class="keywordtype">bool</span> <a class="code" href="class_filter.html#b4bcb84ff32215c6c31432e83419ff55">Filter::OutputFlush</a>(<span class="keywordtype">int</span> outputSite, <span class="keywordtype">bool</span> hardFlush, <span class="keywordtype">int</span> propagation, <span class="keywordtype">bool</span> blocking, <span class="keyword">const</span> std::string &channel)<a name="l00121"></a>00121 {<a name="l00122"></a>00122 <span class="keywordflow">if</span> (propagation && <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#6b504b2694ecb5d709a9858c5b93a0f7">ChannelFlush</a>(channel, hardFlush, propagation-1, blocking))<a name="l00123"></a>00123 {<a name="l00124"></a>00124 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = outputSite;<a name="l00125"></a>00125 <span class="keywordflow">return</span> <span class="keyword">true</span>;<a name="l00126"></a>00126 }<a name="l00127"></a>00127 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = 0;<a name="l00128"></a>00128 <span class="keywordflow">return</span> <span class="keyword">false</span>;<a name="l00129"></a>00129 }<a name="l00130"></a>00130 <a name="l00131"></a><a class="code" href="class_filter.html#255f83eaddd679a61326ce05c487fd2e">00131</a> <span class="keywordtype">bool</span> <a class="code" href="class_filter.html#255f83eaddd679a61326ce05c487fd2e">Filter::OutputMessageSeriesEnd</a>(<span class="keywordtype">int</span> outputSite, <span class="keywordtype">int</span> propagation, <span class="keywordtype">bool</span> blocking, <span class="keyword">const</span> std::string &channel)<a name="l00132"></a>00132 {<a name="l00133"></a>00133 <span class="keywordflow">if</span> (propagation && <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#e0fc63d42d94958f71fc573b17469921">ChannelMessageSeriesEnd</a>(channel, propagation-1, blocking))<a name="l00134"></a>00134 {<a name="l00135"></a>00135 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = outputSite;<a name="l00136"></a>00136 <span class="keywordflow">return</span> <span class="keyword">true</span>;<a name="l00137"></a>00137 }<a name="l00138"></a>00138 <a class="code" href="class_filter.html#b57fb6112bb2cb7c018941bdcd7b4570">m_continueAt</a> = 0;<a name="l00139"></a>00139 <span class="keywordflow">return</span> <span class="keyword">false</span>;<a name="l00140"></a>00140 }<a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// *************************************************************</span><a name="l00143"></a>00143 <a name="l00144"></a><a class="code" href="class_meter_filter.html#59c4b05b453ad56ed42b6951ab986db0">00144</a> <span class="keywordtype">void</span> <a class="code" href="class_meter_filter.html#59c4b05b453ad56ed42b6951ab986db0">MeterFilter::ResetMeter</a>()<a name="l00145"></a>00145 {<a name="l00146"></a>00146 m_currentMessageBytes = m_totalBytes = m_currentSeriesMessages = m_totalMessages = m_totalMessageSeries = 0;<a name="l00147"></a>00147 m_rangesToSkip.clear();<a name="l00148"></a>00148 }<a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="class_meter_filter.html#58898a4bba38196c8432b8b5d324b671">00150</a> <span class="keywordtype">void</span> <a class="code" href="class_meter_filter.html#58898a4bba38196c8432b8b5d324b671">MeterFilter::AddRangeToSkip</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> message, lword position, lword size, <span class="keywordtype">bool</span> sortNow)<a name="l00151"></a>00151 {<a name="l00152"></a>00152 MessageRange r = {message, position, size};<a name="l00153"></a>00153 m_rangesToSkip.push_back(r);<a name="l00154"></a>00154 <span class="keywordflow">if</span> (sortNow)<a name="l00155"></a>00155 std::sort(m_rangesToSkip.begin(), m_rangesToSkip.end());<a name="l00156"></a>00156 }<a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keywordtype">size_t</span> MeterFilter::PutMaybeModifiable(byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking, <span class="keywordtype">bool</span> modifiable)<a name="l00159"></a>00159 {<a name="l00160"></a>00160 <span class="keywordflow">if</span> (!m_transparent)<a name="l00161"></a>00161 <span class="keywordflow">return</span> 0;<a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="keywordtype">size_t</span> t;<a name="l00164"></a>00164 FILTER_BEGIN;<a name="l00165"></a>00165 <a name="l00166"></a>00166 m_begin = begin;<a name="l00167"></a>00167 m_length = length;<a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="keywordflow">while</span> (m_length > 0 || messageEnd)<a name="l00170"></a>00170 {<a name="l00171"></a>00171 <span class="keywordflow">if</span> (m_length > 0 && !m_rangesToSkip.empty() && m_rangesToSkip.front().message == m_totalMessages && m_currentMessageBytes + m_length > m_rangesToSkip.front().position)<a name="l00172"></a>00172 {<a name="l00173"></a>00173 FILTER_OUTPUT_MAYBE_MODIFIABLE(1, m_begin, t = (<span class="keywordtype">size_t</span>)SaturatingSubtract(m_rangesToSkip.front().position, m_currentMessageBytes), <span class="keyword">false</span>, modifiable);<a name="l00174"></a>00174 <a name="l00175"></a>00175 assert(t < m_length);<a name="l00176"></a>00176 m_begin += t;<a name="l00177"></a>00177 m_length -= t;<a name="l00178"></a>00178 m_currentMessageBytes += t;<a name="l00179"></a>00179 m_totalBytes += t;<a name="l00180"></a>00180 <a name="l00181"></a>00181 <span class="keywordflow">if</span> (m_currentMessageBytes + m_length < m_rangesToSkip.front().position + m_rangesToSkip.front().size)<a name="l00182"></a>00182 t = m_length;<a name="l00183"></a>00183 <span class="keywordflow">else</span><a name="l00184"></a>00184 {<a name="l00185"></a>00185 t = (size_t)SaturatingSubtract(m_rangesToSkip.front().position + m_rangesToSkip.front().size, m_currentMessageBytes);<a name="l00186"></a>00186 assert(t <= m_length);<a name="l00187"></a>00187 m_rangesToSkip.pop_front();<a name="l00188"></a>00188 }<a name="l00189"></a>00189 <a name="l00190"></a>00190 m_begin += t;<a name="l00191"></a>00191 m_length -= t;<a name="l00192"></a>00192 m_currentMessageBytes += t;<a name="l00193"></a>00193 m_totalBytes += t;<a name="l00194"></a>00194 }<a name="l00195"></a>00195 <span class="keywordflow">else</span><a name="l00196"></a>00196 {<a name="l00197"></a>00197 FILTER_OUTPUT_MAYBE_MODIFIABLE(2, m_begin, m_length, messageEnd, modifiable);<a name="l00198"></a>00198 <a name="l00199"></a>00199 m_currentMessageBytes += m_length;<a name="l00200"></a>00200 m_totalBytes += m_length;<a name="l00201"></a>00201 m_length = 0;<a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="keywordflow">if</span> (messageEnd)<a name="l00204"></a>00204 {<a name="l00205"></a>00205 m_currentMessageBytes = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -