buf_size,
void* del_ptr);
76IOS_BASE::openmode which);
87 virtual int sync(
void);
111 static void x_Callback(IOS_BASE::event, IOS_BASE&,
int);
127 if(event == IOS_BASE::erase_event) {
129 delete static_cast<streambuf*
>(ios.pword(index));
138: m_Is(is), m_Next(0), m_Buf(
buf), m_BufSize(buf_size), m_DelPtr(del_ptr)
146 autoindex =
sm_Index.load(memory_order_relaxed);
151index =
sm_Index.load(memory_order_acquire);
153index = IOS_BASE::xalloc();
154 sm_Index.store(index, memory_order_release);
160 m_Is.pword(index) =
this;
163 "CPushback_Streambuf::CPushback_Streambuf"));
169 autoindex =
sm_Index.load(memory_order_relaxed);
170 if(
m_Is.pword(index) ==
this) {
171 m_Is.pword(index) = 0;
179IOS_BASE::seekdir whence,
180IOS_BASE::openmode which)
182 if(whence == IOS_BASE::cur && (which &
IOS_BASE::in)) {
196 return m_Sb->PUBSEEKOFF(off, whence, which);
201IOS_BASE::openmode which)
204 return m_Sb->PUBSEEKPOS(pos, which);
227 _ASSERT(gptr() && gptr() >= egptr());
229 #ifdef NCBI_COMPILER_MIPSPRO 230 if(m_MIPSPRO_ReadsomeGptrSetLevel && m_MIPSPRO_ReadsomeGptr != gptr())
242streamsize n_total = 0;
244 if(gptr() < egptr()) {
245 size_t n=
sizeof(m) >
sizeof(
size_t)
249 size_tn_avail = (size_t)(egptr() - gptr());
250 size_tn_read =
n< n_avail ?
n: n_avail;
251 if(
buf!= gptr()) {
252memcpy(
buf, gptr(), n_read);
254gbump((
int) n_read);
255m -= (streamsize) n_read;
257n_total += (streamsize) n_read;
260 if(gptr() >= egptr()) {
272 _ASSERT(gptr() && gptr() >= egptr());
273 return m_Sb->in_avail();
291 return m_Sb->PUBSYNC();
300 "CPushback_Streambuf::setbuf: not allowed");
322streamsize
r= (streamsize)(buf_size < max_size ? buf_size : max_size);
345 if(sb->gptr() >= sb->egptr()) {
355setg(sb->gptr(), sb->gptr(), sb->egptr());
381streamsize x_buf_size,
388 if(
sizeof(x_buf_size) >
sizeof(
size_t)
391 "Pushback data size too large");
393 size_tbuf_size = (size_t) x_buf_size;
397 if(sb && buf_size) {
405&& sb->
m_Buf<=
buf&&
buf+ buf_size == sb->gptr()) {
407sb->setg(
buf,
buf, sb->egptr());
415&& buf_size <= (del_ptr
419 size_tavail = bp - sb->
m_Buf;
420 size_ttake = avail < buf_size ? avail : buf_size;
427sb->setg(bp, bp, sb->egptr());
451 #ifdef NCBI_NO_READSOME 452 # undef NCBI_NO_READSOME 455 #if defined(NCBI_COMPILER_MSVC) 461 #elif defined(NCBI_COMPILER_MIPSPRO) 467 # define NCBI_NO_READSOME 1 471 #ifndef NCBI_NO_READSOME 476 # ifdef NCBI_COMPILER_WORKSHOP 486streamsize
n= is.readsome(
buf, buf_size);
487 return n? is.gcount() : 0;
489 returnis.readsome(
buf, buf_size);
500 #ifdef NCBI_NO_READSOME 507streamsize avail = is.rdbuf()->in_avail();
510 else if(buf_size < avail)
513IOS_BASE::iostate save = is.exceptions();
516is.read(
buf, avail);
517streamsize
count= is.gcount();
521 if(
count&& is.eof() && !is.bad())
536 if(
n!= 0 || !is.good())
539IOS_BASE::iostate save = is.exceptions();
543streamsize
count= is.gcount();
546 if(
count&& buf_size > 1) {
550 if(!is.good() && !is.bad())
564 # ifdef NCBI_COMPILER_MIPSPRO 565CMIPSPRO_ReadsomeTolerantStreambuf* sb =
566 dynamic_cast<CMIPSPRO_ReadsomeTolerantStreambuf*
>(is.rdbuf());
568sb->MIPSPRO_ReadsomeBegin();
571 # ifdef NCBI_COMPILER_MIPSPRO 573sb->MIPSPRO_ReadsomeEnd();
606streamsize
r=
ok? sb->sgetn(
static_cast<char*
>(
buf),
count) : 0;
607 #ifdef NCBI_COMPILER_WORKSHOP 614*bytes_read = (size_t)
r;
615}
else if((
size_t)
r<
count) {
631IOS_BASE::iostate iostate =
m_Stream->rdstate();
636*
count= (size_t) sb->in_avail();
661 size_t* bytes_written)
665streamsize w =
ok? sb->sputn(
static_cast<const char*
>(
buf),
count) : 0;
667 if( bytes_written ) {
668*bytes_written = (size_t) w;
669}
else if((
size_t) w <
count) {
698 if(s.size() <= pos + 1024) {
699s.resize(s.size() * 2);
702status = reader.
Read(&s[pos], s.size() - pos, &
n);
virtual CT_INT_TYPE pbackfail(CT_INT_TYPE c=CT_EOF)
virtual streambuf * setbuf(CT_CHAR_TYPE *buf, streamsize buf_size)
virtual CT_INT_TYPE overflow(CT_INT_TYPE c)
virtual ~CPushback_Streambuf()
void x_FillBuffer(size_t max_size)
static atomic< int > sm_Index
CPushback_Streambuf * m_Next
virtual streamsize xsgetn(CT_CHAR_TYPE *buf, streamsize n)
static void x_Callback(IOS_BASE::event, IOS_BASE &, int)
static const size_t kMinBufSize
CPushback_Streambuf(istream &istream, CT_CHAR_TYPE *buf, size_t buf_size, void *del_ptr)
virtual streamsize _Xsgetn_s(CT_CHAR_TYPE *buf, size_t, streamsize n)
virtual streamsize showmanyc(void)
virtual CT_INT_TYPE underflow(void)
virtual CT_POS_TYPE seekpos(CT_POS_TYPE pos, IOS_BASE::openmode which)
virtual CT_POS_TYPE seekoff(CT_OFF_TYPE off, IOS_BASE::seekdir whence, IOS_BASE::openmode which)
virtual streamsize xsputn(const CT_CHAR_TYPE *buf, streamsize n)
A very basic data-read interface.
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define STD_CATCH_ALL_X(err_subcode, message)
Standard handling of "exception"-derived exceptions; catches non-standard exceptions and generates "u...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read)
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
ERW_Result
Result codes for I/O operations.
void g_ExtractReaderContents(IReader &reader, string &s)
Append all IReader contents to a given string.
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 st...
AutoPtr< CNcbiIstream > m_Stream
AutoPtr< CNcbiOstream > m_Stream
static void Pushback(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size, void *del_ptr)
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read)
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
virtual ERW_Result Flush(void)
Flush pending data (if any) down to the output device.
virtual ERW_Result PendingCount(size_t *count)
Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that a...
virtual ERW_Result Pushback(const void *buf, size_t count, void *del_ptr)
This method gets called by RStream buffer destructor to return buffered yet still unread (from the st...
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)=0
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static streamsize Readsome(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size)
virtual ERW_Result Write(const void *buf, size_t count, size_t *bytes_written)
Write up to "count" bytes from the buffer pointed to by the "buf" argument onto the output device.
virtual ERW_Result PendingCount(size_t *count)
Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that a...
static void x_Pushback(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size, void *del_ptr=0, EPushback_How how=ePushback_Copy)
@ eRW_NotImplemented
Action / information is not available.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Error
Unrecoverable error, no retry possible.
@ eRW_Success
Everything is okay, I/O completed.
NCBI_NS_STD::string::size_type SIZE_TYPE
#define DEFINE_STATIC_FAST_MUTEX(id)
Define static fast mutex and initialize it.
Definition of all error codes used in corelib (xncbi.lib).
Multi-threading â mutexes; rw-locks; semaphore.
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
#define CPushback_StreambufBase
static streamsize s_Readsome(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size)
static streamsize x_Readsome(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size)
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