스레드 간에 연관된 Future로 값 또는 오류를 전달하기 위한 비동기 채널을 제공합니다.
AI 생성미검증모델: gemini-3.8-flash-medium · 노력: medium · 온도: 제어 불가 · 프롬프트: 5c323bf911df출처열린 질문 (1)
독일어 가이드에서 번역됨gemini-3.8-flash-low · 2026-10-13 · 독일어 원문
스레드 간에 연관된 Future로 값 또는 오류를 전달하기 위한 비동기 채널을 제공합니다.
ara::core::Promise 클래스는 스레드 간에 값, 오류 또는 결과를 공유 상태(shared state)로 전송하기 위한 비동기 쓰기 엔드포인트 역할을 합니다 [SWS_CORE_00341]. 읽기 액세스는 정확히 한 번만 검색할 수 있는 Future을(를) 통해 수행되며, 이는 결과가 제공될 때 해제됩니다 [SWS_CORE_00344]. 이 클래스는 복사할 수 없으므로 이동 시맨틱을 통해 상태가 엄격하게 고유 소유권으로 유지되며, 결과를 중복 설정하거나 Future를 중복 검색하면 표준화된 위반이 발생합니다.
컨텍스트
ara::core::Promise 클래스는 C++ 표준에서 알려진 std::promise 개념의 Adaptive Platform 전용 구현체를 나타냅니다. 헤더 ara/core/future.h에 템플릿 Promise<T, E = ErrorCode>(으)로 정의되어 있으며 공유 상태(shared state)의 비동기 쓰기 엔드포인트 역할을 합니다. 이 채널을 통해 생산자는 스레드 간에 계산된 출력 값, 오류 또는 집약된 ara::core::Result을(를) 전달합니다. 연관된 수신자 측은 인스턴스 메서드 get_future을(를) 통해 조회되는 연관된 ara::core::Future을(를) 통해 결과에 액세스합니다 [SWS_CORE_00344]. 주로 예외에 의존하는 표준 C++ 메커니즘과 달리, AUTOSAR Adaptive는 오류 유형화 패러다임을 정립합니다: 오류 유형 E이(가) ara::core::ErrorCode과(와) 다르게 선택되는 경우, 사양에 따라 컴파일 오류가 발생합니다.
수명 주기
인스턴스는 std::promise의 해당 생성자처럼 동작하고 스레드 안전하며 새로운 공유 상태를 설정하는 매개변수 없는 기본 생성자를 통해 통상적으로 생성됩니다 [SWS_CORE_00341]. 이 상태에 대한 명확한 소유권을 보장하기 위해 복사 작업은 완전히 금지됩니다. 복사 생성자 [SWS_CORE_00350]와 복사 할당 연산자 [SWS_CORE_00351]은 모두 삭제(delete)(으)로 선언되어 있습니다.
Future 조회: 비동기 처리를 시작하기 전에 생산자는 get_future()을(를) 호출합니다 [SWS_CORE_00344]. Promise당 단 하나의 연관된 Future만 허용되므로, 이 호출은 정확히 한 번만 수행되어야 합니다. 반환된 Future은(는) 소비 스레드로 전달됩니다.
결과 설정: 비동기 작업이 완료된 후 생산자는 결과를 공유 상태로 전송하고 이를 ready 상태로 전환합니다. 이를 위해 복사 및 이동 작업을 위한 스레드 안전한 오버로드가 각각 제공됩니다:
사양은 공유 상태와의 모든 상호작용에 대해 엄격한 사전 조건을 정의하며, 이를 준수하지 않을 경우 표준화된 위반(Violations)이 발생합니다:
Future의 다중 조회: 동일한 공유 상태에 대해 get_future()이(가) 두 번 이상 호출되면 위반 IsoStdFutureErrcFutureAlreadyRetrievedViolation이(가) 발생합니다 [SWS_CORE_00344].
Shared State 누락: 호출된 인스턴스에 공유 상태가 없는 경우(예: 이동 작업 수행 후) get_future()은(는) IsoStdFutureErrcNoStateViolation을(를) 유발합니다 [SWS_CORE_00344]. 이 경우 set_value, SetError 및 SetResult 메서드는 위반 PromiseNoSharedStateToSetViolation을(를) 트리거합니다([SWS_CORE_00345], [SWS_CORE_00353], [SWS_CORE_00355]).
예외 안전성:set_value, SetError 및 SetResult 메서드는 조건부 예외 안전성(conditionally exception safe)을 가집니다. 타입 T 및 E의 생성자가 nothrow(으)로 선언되어 있는 경우 예외를 발생시키지 않습니다([SWS_CORE_00345], [SWS_CORE_00353], [SWS_CORE_00355]).
Return an associated Future with the same shared state as *this The returned Future is set as soon as this Promise receives the result, value, or an error. This fuction must only be called once as it is not allowed to have multiple Futures per Promise.
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
error
the error to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
error
the error to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
result
the result to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
result
the result to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
Return an associated Future with the same shared state as *this The returned Future is set as soon as this Promise receives the result, value, or an error. This fuction must only be called once as it is not allowed to have multiple Futures per Promise.
IsoStdFutureErrc- If the function is called more than once on the same shared FutureAlreadyRe- state. trievedViolation IsoStdFutureErrc- If *this has no shared state. NoStateViolation
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
value
the value to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
IsoStdFutureEr- If the shared state already has a stored value or error. rcPromiseAl- readySatisfiedVio- lation PromiseNoShared- If *this has no shared state. StateToSetViola- tion
Parameter (in)
Parameter
Beschreibung
value
the value to store
Rückgabewert
Typ
Beschreibung
None
Request a governed re-review of this record. The record is not changed immediately.
gemini-3.8-flash-low· 2026-10-13 · 독일어 원문