📄 queue_8cpp-source.html
字号:
<a name="l00456"></a>00456 i -= current->CurrentSize();<a name="l00457"></a>00457 }<a name="l00458"></a>00458 <a name="l00459"></a>00459 assert(i < m_lazyLength);<a name="l00460"></a>00460 <span class="keywordflow">return</span> m_lazyString[i];<a name="l00461"></a>00461 }<a name="l00462"></a>00462 <a name="l00463"></a><a class="code" href="class_byte_queue.html#dcf03598210a516afc86abfb51ce5eb8">00463</a> <span class="keywordtype">void</span> <a class="code" href="class_byte_queue.html#dcf03598210a516afc86abfb51ce5eb8">ByteQueue::swap</a>(<a class="code" href="class_byte_queue.html" title="Byte Queue.">ByteQueue</a> &rhs)<a name="l00464"></a>00464 {<a name="l00465"></a>00465 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_autoNodeSize, rhs.<a class="code" href="class_byte_queue.html#1d1d2b609e6ea78e420f691ff36da398">m_autoNodeSize</a>);<a name="l00466"></a>00466 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_nodeSize, rhs.<a class="code" href="class_byte_queue.html#81f36e1aedf7399bc12f3d0721c46af7">m_nodeSize</a>);<a name="l00467"></a>00467 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_head, rhs.<a class="code" href="class_byte_queue.html#68f138d2d77361886c6a1c3b094890bf">m_head</a>);<a name="l00468"></a>00468 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_tail, rhs.<a class="code" href="class_byte_queue.html#ebb15dea53aaa8c2b58e51fea635b50b">m_tail</a>);<a name="l00469"></a>00469 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_lazyString, rhs.<a class="code" href="class_byte_queue.html#c5dacd704039c50007791db1a7727a3f">m_lazyString</a>);<a name="l00470"></a>00470 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_lazyLength, rhs.<a class="code" href="class_byte_queue.html#5d9df76de6604b236e19d7e4e52122a0">m_lazyLength</a>);<a name="l00471"></a>00471 <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">std::swap</a>(m_lazyStringModifiable, rhs.<a class="code" href="class_byte_queue.html#4529b01261caeafb405aecfc0350443f">m_lazyStringModifiable</a>);<a name="l00472"></a>00472 }<a name="l00473"></a>00473 <a name="l00474"></a>00474 <span class="comment">// ********************************************************</span><a name="l00475"></a>00475 <a name="l00476"></a><a class="code" href="class_byte_queue_1_1_walker.html#b74b6b33c01b0221a24e1ba17ac7a374">00476</a> <span class="keywordtype">void</span> <a class="code" href="class_byte_queue_1_1_walker.html#b74b6b33c01b0221a24e1ba17ac7a374">ByteQueue::Walker::IsolatedInitialize</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)<a name="l00477"></a>00477 {<a name="l00478"></a>00478 m_node = m_queue.<a class="code" href="class_byte_queue.html#68f138d2d77361886c6a1c3b094890bf">m_head</a>;<a name="l00479"></a>00479 m_position = 0;<a name="l00480"></a>00480 m_offset = 0;<a name="l00481"></a>00481 m_lazyString = m_queue.<a class="code" href="class_byte_queue.html#c5dacd704039c50007791db1a7727a3f">m_lazyString</a>;<a name="l00482"></a>00482 m_lazyLength = m_queue.<a class="code" href="class_byte_queue.html#5d9df76de6604b236e19d7e4e52122a0">m_lazyLength</a>;<a name="l00483"></a>00483 }<a name="l00484"></a>00484 <a name="l00485"></a><a class="code" href="class_byte_queue_1_1_walker.html#1577996016d4fc5e644b86eb1a4f1660">00485</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#1577996016d4fc5e644b86eb1a4f1660" title="try to retrieve a single byte">ByteQueue::Walker::Get</a>(byte &outByte)<a name="l00486"></a>00486 {<a name="l00487"></a>00487 <a class="code" href="class_array_sink.html" title="Copy input to a memory buffer.">ArraySink</a> sink(&outByte, 1);<a name="l00488"></a>00488 <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>)<a class="code" href="class_buffered_transformation.html#91c4526148274ae9cb68803bb2d2a2aa" title="move transferMax bytes of the buffered output to target as input">TransferTo</a>(sink, 1);<a name="l00489"></a>00489 }<a name="l00490"></a>00490 <a name="l00491"></a><a class="code" href="class_byte_queue_1_1_walker.html#940623c7bff90ab48f1534352675f92b">00491</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#1577996016d4fc5e644b86eb1a4f1660" title="try to retrieve a single byte">ByteQueue::Walker::Get</a>(byte *outString, <span class="keywordtype">size_t</span> getMax)<a name="l00492"></a>00492 {<a name="l00493"></a>00493 <a class="code" href="class_array_sink.html" title="Copy input to a memory buffer.">ArraySink</a> sink(outString, getMax);<a name="l00494"></a>00494 <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>)<a class="code" href="class_buffered_transformation.html#91c4526148274ae9cb68803bb2d2a2aa" title="move transferMax bytes of the buffered output to target as input">TransferTo</a>(sink, getMax);<a name="l00495"></a>00495 }<a name="l00496"></a>00496 <a name="l00497"></a><a class="code" href="class_byte_queue_1_1_walker.html#f2c8cbc9323d5844d3080fd29e7cf308">00497</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#f2c8cbc9323d5844d3080fd29e7cf308" title="peek at the next byte without removing it from the output buffer">ByteQueue::Walker::Peek</a>(byte &outByte)<span class="keyword"> const</span><a name="l00498"></a>00498 <span class="keyword"></span>{<a name="l00499"></a>00499 <a class="code" href="class_array_sink.html" title="Copy input to a memory buffer.">ArraySink</a> sink(&outByte, 1);<a name="l00500"></a>00500 <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>)<a class="code" href="class_buffered_transformation.html#8d4359262c67b3e10d193ba30ef193c5" title="copy copyMax bytes of the buffered output to target as input">CopyTo</a>(sink, 1);<a name="l00501"></a>00501 }<a name="l00502"></a>00502 <a name="l00503"></a><a class="code" href="class_byte_queue_1_1_walker.html#9f72a866515e0c7a155654d5bd1c427d">00503</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#f2c8cbc9323d5844d3080fd29e7cf308" title="peek at the next byte without removing it from the output buffer">ByteQueue::Walker::Peek</a>(byte *outString, <span class="keywordtype">size_t</span> peekMax)<span class="keyword"> const</span><a name="l00504"></a>00504 <span class="keyword"></span>{<a name="l00505"></a>00505 <a class="code" href="class_array_sink.html" title="Copy input to a memory buffer.">ArraySink</a> sink(outString, peekMax);<a name="l00506"></a>00506 <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>)<a class="code" href="class_buffered_transformation.html#8d4359262c67b3e10d193ba30ef193c5" title="copy copyMax bytes of the buffered output to target as input">CopyTo</a>(sink, peekMax);<a name="l00507"></a>00507 }<a name="l00508"></a>00508 <a name="l00509"></a><a class="code" href="class_byte_queue_1_1_walker.html#b5d6312affb66b46b7fbcd7f95e0ec4d">00509</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#b5d6312affb66b46b7fbcd7f95e0ec4d" title="upon return, byteCount contains number of bytes that have finished being transfered...">ByteQueue::Walker::TransferTo2</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &target, lword &transferBytes, <span class="keyword">const</span> std::string &channel, <span class="keywordtype">bool</span> blocking)<a name="l00510"></a>00510 {<a name="l00511"></a>00511 lword bytesLeft = transferBytes;<a name="l00512"></a>00512 <span class="keywordtype">size_t</span> blockedBytes = 0;<a name="l00513"></a>00513 <a name="l00514"></a>00514 <span class="keywordflow">while</span> (m_node)<a name="l00515"></a>00515 {<a name="l00516"></a>00516 <span class="keywordtype">size_t</span> len = (size_t)STDMIN(bytesLeft, (lword)m_node-><a class="code" href="class_byte_queue_node.html#82470c9722f07c056ed0b8c095daa340">CurrentSize</a>()-m_offset);<a name="l00517"></a>00517 blockedBytes = target.<a class="code" href="class_buffered_transformation.html#825c38044d268f6d561cb7f849e04b13">ChannelPut2</a>(channel, m_node-><a class="code" href="class_byte_queue_node.html#1872d9ce267ef28d540e3353d0bf6ce9">buf</a>+m_node-><a class="code" href="class_byte_queue_node.html#9e6ccb37abf190e3cb70dbda47cf4f02">m_head</a>+m_offset, len, 0, blocking);<a name="l00518"></a>00518 <a name="l00519"></a>00519 <span class="keywordflow">if</span> (blockedBytes)<a name="l00520"></a>00520 <span class="keywordflow">goto</span> done;<a name="l00521"></a>00521 <a name="l00522"></a>00522 m_position += len;<a name="l00523"></a>00523 bytesLeft -= len;<a name="l00524"></a>00524 <a name="l00525"></a>00525 <span class="keywordflow">if</span> (!bytesLeft)<a name="l00526"></a>00526 {<a name="l00527"></a>00527 m_offset += len;<a name="l00528"></a>00528 <span class="keywordflow">goto</span> done;<a name="l00529"></a>00529 }<a name="l00530"></a>00530 <a name="l00531"></a>00531 m_node = m_node-><a class="code" href="class_byte_queue_node.html#ee1bdb525b2dd8c5d98de76949a85b1a">next</a>;<a name="l00532"></a>00532 m_offset = 0;<a name="l00533"></a>00533 }<a name="l00534"></a>00534 <a name="l00535"></a>00535 <span class="keywordflow">if</span> (bytesLeft && m_lazyLength)<a name="l00536"></a>00536 {<a name="l00537"></a>00537 <span class="keywordtype">size_t</span> len = (size_t)STDMIN(bytesLeft, (lword)m_lazyLength);<a name="l00538"></a>00538 blockedBytes = target.<a class="code" href="class_buffered_transformation.html#825c38044d268f6d561cb7f849e04b13">ChannelPut2</a>(channel, m_lazyString, len, 0, blocking);<a name="l00539"></a>00539 <span class="keywordflow">if</span> (blockedBytes)<a name="l00540"></a>00540 <span class="keywordflow">goto</span> done;<a name="l00541"></a>00541 <a name="l00542"></a>00542 m_lazyString += len;<a name="l00543"></a>00543 m_lazyLength -= len;<a name="l00544"></a>00544 bytesLeft -= len;<a name="l00545"></a>00545 }<a name="l00546"></a>00546 <a name="l00547"></a>00547 done:<a name="l00548"></a>00548 transferBytes -= bytesLeft;<a name="l00549"></a>00549 <span class="keywordflow">return</span> blockedBytes;<a name="l00550"></a>00550 }<a name="l00551"></a>00551 <a name="l00552"></a><a class="code" href="class_byte_queue_1_1_walker.html#8992f04ee0f455eba03a56b3f2f11a80">00552</a> <span class="keywordtype">size_t</span> <a class="code" href="class_byte_queue_1_1_walker.html#8992f04ee0f455eba03a56b3f2f11a80" title="upon return, begin contains the start position of data yet to be finished copying...">ByteQueue::Walker::CopyRangeTo2</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &target, lword &begin, lword end, <span class="keyword">const</span> std::string &channel, <span class="keywordtype">bool</span> blocking)<span class="keyword"> const</span><a name="l00553"></a>00553 <span class="keyword"></span>{<a name="l00554"></a>00554 <a class="code" href="class_byte_queue_1_1_walker.html">Walker</a> walker(*<span class="keyword">this</span>);<a name="l00555"></a>00555 walker.<a class="code" href="class_buffered_transformation.html#0c25529ded99db20ad35ccef3f7234e6" title="discard skipMax bytes from the output buffer">Skip</a>(begin);<a name="l00556"></a>00556 lword transferBytes = end-begin;<a name="l00557"></a>00557 <span class="keywordtype">size_t</span> blockedBytes = walker.<a class="code" href="class_byte_queue_1_1_walker.html#b5d6312affb66b46b7fbcd7f95e0ec4d" title="upon return, byteCount contains number of bytes that have finished being transfered...">TransferTo2</a>(target, transferBytes, channel, blocking);<a name="l00558"></a>00558 begin += transferBytes;<a name="l00559"></a>00559 <span class="keywordflow">return</span> blockedBytes;<a name="l00560"></a>00560 }<a name="l00561"></a>00561 <a name="l00562"></a>00562 NAMESPACE_END<a name="l00563"></a>00563 <a name="l00564"></a>00564 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Jun 1 11:11:23 2007 for Crypto++ by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -