#include <BufferedStreamBuffer.h>
Public Types | |
typedef std::basic_streambuf < ACE_CHAR_T, TR > | base_type |
typedef std::basic_ios < ACE_CHAR_T, TR > | ios_type |
typedef ACE_CHAR_T | char_type |
typedef TR | char_traits |
typedef base_type::int_type | int_type |
typedef base_type::pos_type | pos_type |
typedef base_type::off_type | off_type |
typedef ios_type::seekdir | seekdir |
typedef ios_type::openmode | openmode |
typedef StreamInterceptorBase < char_type, char_traits > | interceptor_type |
Public Member Functions | |
BasicBufferedStreamBuffer (std::streamsize bufsz, typename std::basic_ios< ACE_CHAR_T, TR >::openmode mode) | |
virtual | ~BasicBufferedStreamBuffer () |
virtual int_type | overflow (int_type c) |
virtual int_type | underflow () |
virtual int | sync () |
void | set_interceptor (interceptor_type &interceptor) |
Protected Member Functions | |
void | set_mode (typename std::basic_ios< ACE_CHAR_T, TR >::openmode mode) |
std::basic_ios< ACE_CHAR_T, TR > ::openmode | get_mode () const |
virtual int | read_from_stream (char_type *buffer, std::streamsize length) |
virtual int | write_to_stream (const char_type *buffer, std::streamsize length) |
void | reset_buffers () |
Private Member Functions | |
int | flush_buffer () |
BasicBufferedStreamBuffer (const BasicBufferedStreamBuffer &) | |
BasicBufferedStreamBuffer & | operator= (const BasicBufferedStreamBuffer &) |
Private Attributes | |
std::streamsize | bufsize_ |
ACE_Auto_Ptr< char_type > | buffer_ |
std::basic_ios< ACE_CHAR_T, TR > ::openmode | mode_ |
interceptor_type * | interceptor_ |
Definition at line 44 of file BufferedStreamBuffer.h.
typedef std::basic_streambuf<ACE_CHAR_T, TR> ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::base_type |
Definition at line 48 of file BufferedStreamBuffer.h.
typedef TR ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::char_traits |
Definition at line 51 of file BufferedStreamBuffer.h.
typedef ACE_CHAR_T ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::char_type |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 50 of file BufferedStreamBuffer.h.
typedef base_type::int_type ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::int_type |
Definition at line 52 of file BufferedStreamBuffer.h.
typedef StreamInterceptorBase<char_type, char_traits> ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::interceptor_type |
Definition at line 57 of file BufferedStreamBuffer.h.
typedef std::basic_ios<ACE_CHAR_T, TR> ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::ios_type |
Definition at line 49 of file BufferedStreamBuffer.h.
typedef base_type::off_type ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::off_type |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 54 of file BufferedStreamBuffer.h.
typedef ios_type::openmode ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::openmode |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 56 of file BufferedStreamBuffer.h.
typedef base_type::pos_type ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::pos_type |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 53 of file BufferedStreamBuffer.h.
typedef ios_type::seekdir ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::seekdir |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 55 of file BufferedStreamBuffer.h.
ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::BasicBufferedStreamBuffer | ( | std::streamsize | bufsz, | |
typename std::basic_ios< ACE_CHAR_T, TR >::openmode | mode | |||
) |
Definition at line 18 of file BufferedStreamBuffer.cpp.
: bufsize_ (bufsz), mode_ (mode), interceptor_ (0) { char_type* p = 0; ACE_NEW_NORETURN (p, char_type [bufsz]); this->buffer_.reset (p); this->setg (this->buffer_.get () + 4, this->buffer_.get () + 4, this->buffer_.get () + 4); this->setp (this->buffer_.get (), this->buffer_.get () + (this->bufsize_ - 1)); }
ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::~BasicBufferedStreamBuffer | ( | ) | [virtual] |
Definition at line 37 of file BufferedStreamBuffer.cpp.
{ }
ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::BasicBufferedStreamBuffer | ( | const BasicBufferedStreamBuffer< ACE_CHAR_T, TR > & | ) | [private] |
int ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::flush_buffer | ( | ) | [private] |
Definition at line 160 of file BufferedStreamBuffer.cpp.
{ int n = int (this->pptr () - this->pbase ()); if (this->interceptor_) this->interceptor_->before_write (this->pbase (), n); int n_out = this->write_to_stream (this->pbase (), n); if (this->interceptor_) this->interceptor_->after_write (n_out); if (n_out == n) { this->pbump (-n); return n; } return -1; }
std::basic_ios< ACE_CHAR_T, TR >::openmode ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::get_mode | ( | void | ) | const [protected] |
Definition at line 126 of file BufferedStreamBuffer.cpp.
{ return this->mode_; }
BasicBufferedStreamBuffer& ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::operator= | ( | const BasicBufferedStreamBuffer< ACE_CHAR_T, TR > & | ) | [private] |
BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::int_type ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::overflow | ( | int_type | c | ) | [virtual] |
Definition at line 43 of file BufferedStreamBuffer.cpp.
{ if (!(this->mode_ & ios_type::out)) return char_traits::eof (); if (c != char_traits::eof ()) { *this->pptr () = char_traits::to_char_type (c); this->pbump (1); } if (this->flush_buffer () == std::streamsize (-1)) return char_traits::eof (); return c; }
int ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::read_from_stream | ( | char_type * | buffer, | |
std::streamsize | length | |||
) | [protected, virtual] |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 133 of file BufferedStreamBuffer.cpp.
{ // to be implemented in derived class return 0; }
void ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::reset_buffers | ( | ) | [protected] |
void ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::set_interceptor | ( | interceptor_type & | interceptor | ) |
Definition at line 111 of file BufferedStreamBuffer.cpp.
{ this->interceptor_ = &interceptor; }
void ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::set_mode | ( | typename std::basic_ios< ACE_CHAR_T, TR >::openmode | mode | ) | [protected] |
Definition at line 118 of file BufferedStreamBuffer.cpp.
{ this->mode_ = mode; }
int ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::sync | ( | void | ) | [virtual] |
Reimplemented in ACE::FTP::StreamBuffer, and ACE::HTTP::StreamBuffer.
Definition at line 100 of file BufferedStreamBuffer.cpp.
{ if (this->pptr () && this->pptr () > this->pbase ()) { if (this->flush_buffer () == -1) return -1; } return 0; }
BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::int_type ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::underflow | ( | void | ) | [virtual] |
Definition at line 59 of file BufferedStreamBuffer.cpp.
{ if (!(this->mode_ & ios_type::in)) return char_traits::eof (); if (this->gptr () && (this->gptr () < this->egptr ())) return char_traits::to_int_type (*this->gptr ()); int putback = int (this->gptr () - this->eback ()); if (putback > 4) putback = 4; ACE_OS::memmove (this->buffer_.get () + (4 - putback), this->gptr (), putback * sizeof (char_type)); if (this->interceptor_) this->interceptor_->before_read (this->bufsize_ - 4); int n = this->read_from_stream (this->buffer_.get () + 4, this->bufsize_ - 4); if (this->interceptor_) this->interceptor_->after_read (this->buffer_.get () + 4, n); if (n <= 0) { if (this->interceptor_) this->interceptor_->on_eof (); return char_traits::eof (); } this->setg (this->buffer_.get () + (4 - putback), this->buffer_.get () + 4, this->buffer_.get () + 4 + n); // return next character return char_traits::to_int_type (*this->gptr ()); }
int ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::write_to_stream | ( | const char_type * | buffer, | |
std::streamsize | length | |||
) | [protected, virtual] |
Reimplemented in ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >, and ACE::IOS::String_StreamBufferBase< char_type, std::char_traits< char_type > >.
Definition at line 141 of file BufferedStreamBuffer.cpp.
{ // to be implemented in derived class return 0; }
ACE_Auto_Ptr<char_type> ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::buffer_ [private] |
Definition at line 85 of file BufferedStreamBuffer.h.
std::streamsize ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::bufsize_ [private] |
Definition at line 84 of file BufferedStreamBuffer.h.
interceptor_type* ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::interceptor_ [private] |
Definition at line 87 of file BufferedStreamBuffer.h.
std::basic_ios<ACE_CHAR_T, TR>::openmode ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >::mode_ [private] |
Definition at line 86 of file BufferedStreamBuffer.h.