Namespaces
Variants

std:: basic_syncbuf

From cppreference.net
< cpp ‎ | io
헤더 파일에 정의됨 <syncstream>
template <

class CharT,
class Traits = std:: char_traits < CharT > ,
class Allocator = std:: allocator < CharT >

> class basic_syncbuf : public std:: basic_streambuf < CharT, Traits >
(C++20부터)

std::basic_syncbuf std::basic_streambuf (생성 시 포인터로 제공됨)를 위한 래퍼입니다. 이는 자체 내부 버퍼에서 출력을 누적하며, 소멸 시와 명시적으로 요청될 때 전체 내용을 원자적으로 래핑된 버퍼로 전송하여 연속적인 문자 시퀀스로 나타나도록 합니다. 동일한 버퍼에 대한 다른 모든 출력이 (서로 다른 인스턴스일 수 있는) std::basic_syncbuf 인스턴스를 통해 이루어지는 한, 데이터 경쟁이나 래핑된 버퍼로 전송된 문자의 인터리빙이 발생하지 않음을 보장합니다.

std::basic_syncbuf 의 일반적인 구현은 래핑된 std::basic_streambuf 에 대한 포인터, 동기화(플러시) 시 버퍼가 내용을 래핑된 버퍼로 전송할지 여부를 나타내는 불리언 플래그, 동기화 시 출력하지 않는 정책일 때 대기 중인 플러시를 나타내는 불리언 플래그, Allocator 를 사용하는 내부 버퍼(예: std::string ), 그리고 동일한 래핑된 스트림 버퍼에 접근하는 여러 스레드 간의 출력 동기화에 사용되는 뮤텍스에 대한 포인터(이러한 뮤텍스는 std::basic_streambuf 객체에 대한 포인터를 키로 사용하는 해시 맵에 있을 수 있음)를 보유합니다.

다른 스트림 버퍼 클래스들처럼, std::basic_syncbuf 는 일반적으로 해당 스트림인 std::osyncstream 을 통해 접근되며, 직접적으로 접근되지 않습니다.

일반적인 문자 타입에 대한 여러 typedef가 제공됩니다:

헤더 파일에 정의됨 <syncstream>
타입 정의
std::syncbuf std :: basic_syncbuf < char >
std::wsyncbuf std :: basic_syncbuf < wchar_t >

목차

멤버 타입

멤버 타입 정의
char_type CharT
traits_type Traits ; 프로그램이 잘못된 형식입니다 만약 Traits::char_type CharT 가 아닌 경우.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
allocator_type Allocator
streambuf_type std:: basic_streambuf < CharT, Traits >

멤버 함수

Public 멤버 함수

basic_syncbuf 객체를 생성합니다
(public 멤버 함수)
basic_syncbuf 객체를 할당합니다
(public 멤버 함수)
두 개의 basic_syncbuf 객체를 교환합니다
(public 멤버 함수)
basic_syncbuf 를 파괴하고 내부 버퍼를 방출합니다
(public 멤버 함수)
내부 버퍼 전체를 래핑된 streambuf로 원자적으로 전송합니다
(public 멤버 함수)
래핑된 streambuf 포인터를 검색합니다
(public 멤버 함수)
basic_syncbuf 가 사용하는 할당자를 검색합니다
(public 멤버 함수)
현재 emit-on-sync 정책을 변경합니다
(public 멤버 함수)

Protected 멤버 함수

현재 emit-on-sync 정책에 따라 방출하거나 보류 중인 플러시를 기록합니다
(public 멤버 함수)

비멤버 함수

std::swap 알고리즘을 특수화함
(함수 템플릿)

std:: basic_streambuf 에서 상속됨

멤버 타입

멤버 타입 정의
char_type CharT
traits_type Traits ; Traits::char_type CharT 가 아닌 경우 프로그램은 ill-formed입니다.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type

멤버 함수

[virtual]
basic_streambuf 객체를 파괴함
( std::basic_streambuf<CharT,Traits> 의 virtual public 멤버 함수)
Locales
연결된 locale을 변경하고 imbue ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
연결된 locale의 사본을 얻음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
Positioning
setbuf ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
seekoff ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
seekpos ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
sync ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
Get area
get area에서 즉시 사용 가능한 문자 수를 얻음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스를 진행시킨 후, 다시 진행하지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
(C++17에서 제거됨)
입력 시퀀스에서 한 문자를 읽고 시퀀스를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스에서 시퀀스를 진행시키지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
xsgetn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
Put area
put area에 한 문자를 쓰고 다음 포인터를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
xsputn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
Putback
입력 시퀀스에 한 문자를 되돌려 놓음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스의 다음 포인터를 하나 뒤로 이동시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)

보호된 멤버 함수

basic_streambuf 객체를 생성합니다
(protected 멤버 함수)
(C++11)
basic_streambuf 객체를 대체함
(보호된 멤버 함수)
(C++11)
두 개의 basic_streambuf 객체를 교환
(보호된 멤버 함수)
로케일
[virtual]
연결된 로캘 변경에 반응함
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
포지셔닝
[virtual]
사용자 정의 배열로 버퍼를 교체합니다(허용되는 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 상대 주소 지정을 사용하여 재위치함
( std::basic_streambuf<CharT,Traits> 의 가상 protected 멤버 함수)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 절대 주소 지정을 사용하여 재위치합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 문자 시퀀스와 버퍼를 동기화합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
영역 가져오기
[virtual]
연결된 입력 시퀀스에서 사용 가능한 문자 수를 확인합니다(알려진 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected member function)
[virtual]
연관된 입력 시퀀스로부터 문자를 읽어 get 영역으로 가져옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 입력 시퀀스로부터 문자를 읽어 get 영역으로 가져오고 다음 포인터를 전진시킴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스에서 여러 문자를 읽어옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
get 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(protected 멤버 함수)
입력 시퀀스의 다음 포인터를 전진시킴
(protected member function)
입력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(protected member function)
Put 영역
[virtual]
출력 시퀀스에 여러 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 가상 protected 멤버 함수)
[virtual]
put 영역에서 연관된 출력 시퀀스로 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
출력 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(보호된 멤버 함수)
출력 시퀀스의 다음 포인터를 전진시킴
(protected member function)
출력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(보호된 멤버 함수)
Putback
[virtual]
입력 시퀀스에 문자를 다시 넣으며, 입력 시퀀스를 수정할 수 있음
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)

참고 사항

기능 테스트 매크로 표준 기능
__cpp_lib_syncbuf 201803L (C++20) 동기화된 버퍼 출력 스트림 ( std::syncbuf , std::osyncstream ) 및 조작자