A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__ReaderWriter.html below:

NCBI C++ ToolKit: Socket reader-writer

◆ CSocketReaderWriter() [1/2] ◆ CSocketReaderWriter() [2/2] ◆ Flush() virtual ERW_Result CSocketReaderWriter::Flush ( void  ) inlinevirtual ◆ GetTimeout() ◆ operator=() ◆ PendingCount() ERW_Result CSocketReaderWriter::PendingCount ( size_t *  count ) virtual

Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that are ready to be read from the input device without blocking.

Return eRW_Success if the number of pending bytes has been stored at the location pointed to by "count". Return eRW_NotImplemented if the number cannot be determined. Otherwise, return other eRW_... condition to reflect the problem ("*count" does not need to be updated in the case of non-eRW_Success). Note that if reporting 0 bytes ready, the method may return either both eRW_Success and zero "*count", or return eRW_NotImplemented alone.

Implements IReader.

Definition at line 54 of file ncbi_conn_reader_writer.cpp.

References count, eIO_Read, eIO_ReadPeek, eIO_Success, eIO_Timeout, eRW_Error, eRW_Success, CSocket::GetTimeout(), CSocketReaderWriter::m_Sock, CSocket::Read(), CSocket::SetTimeout(), and tmp.

Referenced by CNetCacheReader::PendingCount().

◆ Pushback() ERW_Result CSocketReaderWriter::Pushback ( const void *  buf, size_t  count, void *  del_ptr  ) virtual

This method gets called by RStream buffer destructor to return buffered yet still unread (from the stream) portion of data back to the device.

It's semantically equivalent to CStreamUtils::Pushback() with the only difference that IReader can only assume the ownership of "buf" when "del_ptr" is passed non-NULL. Return eRW_Success when data have been successfully pushed back and the ownership of the pointers has been assumed as described above. Any other error code results in pointers remained and handled within the stream buffer being deleted, with an error message suppressed for eRW_NotImplemented (default implementation).

See also
CStreamUtils::Pushback

Reimplemented from IReader.

Definition at line 40 of file ncbi_conn_reader_writer.cpp.

References buf, count, CT_CHAR_TYPE, eRW_Success, AutoPtr< X, Del >::IsOwned(), CSocketReaderWriter::m_Sock, CSocket::Pushback(), result, and CSocketReaderWriter::x_Result().

◆ Read() ERW_Result CSocketReaderWriter::Read ( void *  buf, size_t  count, size_t *  bytes_read = 0  ) inlinevirtual

Read as many as "count" bytes into a buffer pointed to by the "buf" argument.

Always store the number of bytes actually read (0 if read none) via the pointer "bytes_read", if provided non-NULL. Return non-eRW_Success code if EOF / error condition has been encountered during the operation (some data may have been read, nevertheless, and reflected in "*bytes_read"). Special case: if "count" is passed as 0, then the value of "buf" must be ignored, and no change should be made to the state of the input device (but may return non-eRW_Success to indicate that the input device has already been in an error condition).

Note
Apparently, may not return eRW_Success if hasn't been able to read "count" bytes as requested, and "bytes_read" was provided as NULL.
When returning "*bytes_read" as zero for a non-zero "count" requested, the return status should not indicate eRW_Success.
Warning
"*bytes_read" may never be returned greater than "count".
Attention
It is implementation-dependent whether the call blocks until the entire buffer is read or the call returns when at least some data are available. In general, it is advised that this call is made within a loop that checks for EOF condition and proceeds with the reading until the required amount of data has been retrieved.

Implements IReader.

Definition at line 97 of file ncbi_conn_reader_writer.hpp.

References buf, count, eIO_ReadPlain, eRW_Error, CSocketReaderWriter::m_Sock, CSocket::Read(), and CSocketReaderWriter::x_Result().

◆ SetTimeout() ◆ Write() ERW_Result CSocketReaderWriter::Write ( const void *  buf, size_t  count, size_t *  bytes_written = 0  ) inlinevirtual

Write up to "count" bytes from the buffer pointed to by the "buf" argument onto the output device.

Always store the number of bytes actually written, or 0 if "count" has been passed as 0 ("buf" must be ignored in this case), via the "bytes_written" pointer, if provided non-NULL. Note that the method can return non-eRW_Success in case of an I/O error along with indicating (some) data delivered to the output device (and reflected in "*bytes_written").

Note
Apparently, may not return eRW_Success if hasn't been able to write "count" bytes as requested, and "bytes_written" was passed as NULL.
When returning "*bytes_written" as zero for a non-zero "count" requested, the return status should not indicate eRW_Success.
Warning
"*bytes_written" may never be returned greater than "count".
Attention
It is implementation-dependent whether the call blocks until the entire buffer or only some data has been written out. In general, it is advised that this call is made within a loop that checks for errors and proceeds with the writing until the required amount of data has been sent.

Implements IWriter.

Definition at line 107 of file ncbi_conn_reader_writer.hpp.

References buf, count, eRW_Error, CSocketReaderWriter::m_Sock, CSocketReaderWriter::m_WriteMethod, CSocket::Write(), and CSocketReaderWriter::x_Result().

◆ x_Result() ◆ m_Sock ◆ m_WriteMethod

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4