NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SPSG_BlobReader Struct Reference

Search Toolkit Book for SPSG_BlobReader

#include "psg_client_impl.hpp"
(Private to src/objtools/pubseq_gateway/client.)

+ Inheritance diagram for SPSG_BlobReader:
+ Collaboration diagram for SPSG_BlobReader:

Public Types

using TStats = pair< bool, weak_ptr< SPSG_Stats > >
 

Public Member Functions

 SPSG_BlobReader (SPSG_Reply::SItem::TTS &src, TStats stats=TStats())
 
ERW_Result Read (void *buf, size_t count, size_t *bytes_read=0)
 Read as many as "count" bytes into a buffer pointed to by the "buf" argument. More...
 
ERW_Result PendingCount (size_t *count)
 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. More...
 
- Public Member Functions inherited from IReader
virtual ERW_Result Pushback (const void *buf, size_t count, void *del_ptr=0)
 This method gets called by RStream buffer destructor to return buffered yet still unread (from the stream) portion of data back to the device. More...
 
virtual ~IReader ()
 

Private Member Functions

void CheckForNewChunks ()
 
ERW_Result x_Read (void *buf, size_t count, size_t *bytes_read)
 

Private Attributes

SPSG_Reply::SItem::TTSm_Src
 
TStats m_Stats
 
vector< SPSG_Chunkm_Data
 
size_t m_Chunk = 0
 
size_t m_Index = 0
 

Additional Inherited Members

- Protected Member Functions inherited from array< char, 64 *1024 >
 array (alp_data *alp_data_)
 
 ~array ()
 
void increment_array_on_the_rigth ()
 
void increment_array_on_the_left ()
 
void set_elem (Int4 ind_, char elem_)
 
void increase_elem_by_1 (Int4 ind_)
 
- Protected Attributes inherited from array< char, 64 *1024 >
Int4 d_step
 
Int4 d_dim
 
Int4 d_ind0
 
Int4 d_dim_plus_d_ind0
 
char * d_elem
 
alp_datad_alp_data
 

Detailed Description

Definition at line 49 of file psg_client_impl.hpp.

Member Typedef Documentation

◆ TStats

using SPSG_BlobReader::TStats = pair<bool, weak_ptr<SPSG_Stats> >

Definition at line 51 of file psg_client_impl.hpp.

Constructor & Destructor Documentation

◆ SPSG_BlobReader()

SPSG_BlobReader::SPSG_BlobReader ( SPSG_Reply::SItem::TTS src,
TStats  stats = TStats() 
)

Definition at line 73 of file psg_client.cpp.

References stats.

Member Function Documentation

◆ CheckForNewChunks()

void SPSG_BlobReader::CheckForNewChunks ( )
private

◆ PendingCount()

ERW_Result SPSG_BlobReader::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 131 of file psg_client.cpp.

References assert, CheckForNewChunks(), count, data, eRW_Success, i, m_Chunk, m_Data, and m_Index.

◆ Read()

ERW_Result SPSG_BlobReader::Read ( void *  buf,
size_t  count,
size_t *  bytes_read = 0 
)
virtual

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 111 of file psg_client.cpp.

References buf, count, eRW_Error, eRW_Success, SPSG_Param< TParam >::GetDefault(), m_Src, NCBI_THROW_FMT, SPSG_CV< TType >::WaitUntil(), and x_Read().

◆ x_Read()

ERW_Result SPSG_BlobReader::x_Read ( void *  buf,
size_t  count,
size_t *  bytes_read 
)
private

Member Data Documentation

◆ m_Chunk

size_t SPSG_BlobReader::m_Chunk = 0
private

Definition at line 64 of file psg_client_impl.hpp.

Referenced by PendingCount(), and x_Read().

◆ m_Data

vector<SPSG_Chunk> SPSG_BlobReader::m_Data
private

Definition at line 63 of file psg_client_impl.hpp.

Referenced by CheckForNewChunks(), PendingCount(), and x_Read().

◆ m_Index

size_t SPSG_BlobReader::m_Index = 0
private

Definition at line 65 of file psg_client_impl.hpp.

Referenced by PendingCount(), and x_Read().

◆ m_Src

SPSG_Reply::SItem::TTS& SPSG_BlobReader::m_Src
private

Definition at line 61 of file psg_client_impl.hpp.

Referenced by CheckForNewChunks(), Read(), and x_Read().

◆ m_Stats

TStats SPSG_BlobReader::m_Stats
private

Definition at line 62 of file psg_client_impl.hpp.

Referenced by CheckForNewChunks().


The documentation for this struct was generated from the following files:
Modified on Wed Sep 04 15:00:30 2024 by modify_doxy.py rev. 669887