BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > Class Template Reference

#include <bslstl_syncbuf.h>

Inheritance diagram for bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >:

Public Types

typedef CHAR_TYPE char_type
 
typedef CHAR_TRAITS::int_type int_type
 
typedef CHAR_TRAITS::pos_type pos_type
 
typedef CHAR_TRAITS::off_type off_type
 
typedef CHAR_TRAITS traits_type
 
typedef ALLOCATOR allocator_type
 
typedef std::basic_streambuf< CHAR_TYPE, CHAR_TRAITS > streambuf_type
 

Public Member Functions

 basic_syncbuf (const ALLOCATOR &allocator=ALLOCATOR())
 
 basic_syncbuf (streambuf_type *wrapped, const ALLOCATOR &allocator=ALLOCATOR())
 
 ~basic_syncbuf () BSLS_KEYWORD_OVERRIDE
 Call emit. Any exceptions thrown by emit are ignored.
 
bool emit ()
 
void set_emit_on_sync (bool value) BSLS_KEYWORD_NOEXCEPT
 
allocator_type get_allocator () const BSLS_KEYWORD_NOEXCEPT
 Return the allocator used to supply memory.
 
streambuf_typeget_wrapped () const BSLS_KEYWORD_NOEXCEPT
 Return the wrapped buffer supplied at construction.
 

Protected Member Functions

int_type overflow (int_type character=traits_type::eof()) BSLS_KEYWORD_OVERRIDE
 
int sync () BSLS_KEYWORD_OVERRIDE
 
std::streamsize xsputn (const char_type *inputString, std::streamsize count) BSLS_KEYWORD_OVERRIDE
 

Detailed Description

template<class CHAR_TYPE, class CHAR_TRAITS, class ALLOCATOR>
class bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >

This class implements a standard stream buffer providing an internal buffer to accumulate the written data in order to atomically transmit its entire contents to the wrapped buffer on destruction (or emit call).

Member Typedef Documentation

◆ allocator_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef ALLOCATOR bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::allocator_type

◆ char_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef CHAR_TYPE bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::char_type

◆ int_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef CHAR_TRAITS::int_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::int_type

◆ off_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef CHAR_TRAITS::off_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::off_type

◆ pos_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef CHAR_TRAITS::pos_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::pos_type

◆ streambuf_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS> bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::streambuf_type

◆ traits_type

template<class CHAR_TYPE , class CHAR_TRAITS , class ALLOCATOR >
typedef CHAR_TRAITS bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::traits_type

Constructor & Destructor Documentation

◆ basic_syncbuf() [1/2]

template<class CHAR , class TRAITS , class ALLOCATOR >
bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::basic_syncbuf ( const ALLOCATOR &  allocator = ALLOCATOR())
explicit

Create a basic_syncbuf object without a wrapped buffer. Optionally specify an allocator used to supply memory.

◆ basic_syncbuf() [2/2]

template<class CHAR , class TRAITS , class ALLOCATOR >
bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::basic_syncbuf ( streambuf_type wrapped,
const ALLOCATOR &  allocator = ALLOCATOR() 
)
explicit

Create a basic_syncbuf object. Set the specified wrapped as a wrapped buffer. Optionally specify an allocator used to supply memory.

◆ ~basic_syncbuf()

template<class CHAR , class TRAITS , class ALLOCATOR >
bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::~basic_syncbuf ( )

Member Function Documentation

◆ emit()

template<class CHAR , class TRAITS , class ALLOCATOR >
bool bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::emit ( )

Atomically transfer any characters buffered by this object to the wrapped stream buffer, so that it appears in the output stream as a contiguous sequence of characters. The wrapped stream buffer is flushed if and only if a call was made to sync since the most recent call to emit or construction. Return true if get_wrapped() != nullptr, and all of the characters in the associated output were successfully transferred, and the flush (if any) succeeded; return false otherwise.

◆ get_allocator()

template<class CHAR , class TRAITS , class ALLOCATOR >
ALLOCATOR bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::get_allocator ( ) const
inline

◆ get_wrapped()

template<class CHAR , class TRAITS , class ALLOCATOR >
basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::streambuf_type * bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::get_wrapped ( ) const
inline

◆ overflow()

template<class CHAR , class TRAITS , class ALLOCATOR >
basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::int_type bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::overflow ( int_type  character = traits_type::eof())
protected

◆ set_emit_on_sync()

template<class CHAR , class TRAITS , class ALLOCATOR >
void bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::set_emit_on_sync ( bool  value)
inline

Call the emit function by each sync call if the specified value is true.

◆ sync()

template<class CHAR , class TRAITS , class ALLOCATOR >
int bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::sync ( )
protected

Request the wrapped streambuf flush on the next emit call, then call emit if the "emit-on-sync" flag is true. Return 0 on success and -1 if the emit call has failed.

◆ xsputn()

template<class CHAR , class TRAITS , class ALLOCATOR >
std::streamsize bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::xsputn ( const char_type inputString,
std::streamsize  count 
)
protected

Write the specified inputString array of the specified count characters to the internal buffer. Return the number of characters successfully written.


The documentation for this class was generated from the following files: