target_block 클래스

target_block 클래스는 대상 전용 블록에 대해 기본 링크 관리 기능 및 오류 검사를 제공하는 추상 기본 클래스입니다.

구문

template<class _SourceLinkRegistry, class _MessageProcessorType = ordered_message_processor<typename _SourceLinkRegistry::type::source_type>>
class target_block : public ITarget<typename _SourceLinkRegistry::type::source_type>;

매개 변수

_SourceLinkRegistry
원본 링크를 보유하는 데 사용할 링크 레지스트리입니다.

_MessageProcessorType
메시지 처리를 위한 프로세서 유형입니다.

멤버

공용 Typedefs

이름 설명
source_iterator target_block 개체에 대한 source_link_manager 반복기의 형식입니다.

공용 생성자

속성 설명
target_block target_block 개체를 생성합니다.
~target_block 소멸자 개체를 target_block 삭제합니다.

공용 메서드

이름 설명
전파 소스 블록에서 이 대상 블록으로 메시지를 비동기적으로 전달합니다.
send 원본 블록에서 이 대상 블록으로 메시지를 동기적으로 전달합니다.

보호된 메서드

속성 설명
async_send 처리를 위해 메시지를 비동기적으로 보냅니다.
decline_incoming_messages 블록에 새 메시지를 거부해야 했음을 나타냅니다.
enable_batched_processing 이 블록에 대한 일괄 처리를 할 수 있도록 합니다.
initialize_target 기본 개체를 초기화합니다. 특히 개체를 message_processor 초기화해야 합니다.
link_source 지정된 소스 블록을 이 target_block 개체에 연결합니다.
process_input_messages 입력으로 받은 메시지를 처리합니다.
process_message 파생 클래스에 재정의된 경우 이 target_block 개체가 수락했던 메시지를 처리합니다.
propagate_message 파생 클래스에서 재정의된 경우 이 메서드는 블록에서 ISourcetarget_block 개체로 메시지를 비동기적으로 전달합니다. 소스 블록에서 호출할 propagate 때 메서드에 의해 호출됩니다.
register_filter 받은 모든 메시지에 대해 호출될 필터 메서드를 등록합니다.
remove_sources 미해결 비동기 보내기 작업이 완료되도록 기다린 후 모든 원본의 연결을 해제합니다.
send_message 파생 클래스에서 재정의된 경우 이 메서드는 블록에서 ISourcetarget_block 개체로 메시지를 동기적으로 전달합니다. 소스 블록에서 호출할 send 때 메서드에 의해 호출됩니다.
sync_send 처리를 위해 메시지를 동기적으로 보냅니다.
unlink_source target_block 개체에서 지정된 소스 블록의 연결을 해제합니다.
unlink_sources target_block 개체에서 모든 소스 블록의 연결을 해제합니다. (재정의 ITarget::unlink_sources.)
wait_for_async_sends 모든 비동기 전파가 완료되기를 기다립니다.

상속 계층 구조

ITarget

target_block

요구 사항

헤더: agents.h

네임스페이스: 동시성

async_send

처리를 위해 메시지를 비동기적으로 보냅니다.

void async_send(_Inout_opt_ message<_Source_type>* _PMessage);

매개 변수

_PMessage
전송되는 메시지에 대한 포인터입니다.

decline_incoming_messages

블록에 새 메시지를 거부해야 했음을 나타냅니다.

void decline_incoming_messages();

설명

소멸이 진행되는 동안 새 메시지가 거부되도록 소멸자가 이 메서드를 호출합니다.

enable_batched_processing

이 블록에 대한 일괄 처리를 할 수 있도록 합니다.

void enable_batched_processing();

initialize_target

기본 개체를 초기화합니다. 특히 개체를 message_processor 초기화해야 합니다.

void initialize_target(
    _Inout_opt_ Scheduler* _PScheduler = NULL,
    _Inout_opt_ ScheduleGroup* _PScheduleGroup = NULL);

매개 변수

_PScheduler
작업 예약에 사용할 스케줄러입니다.

_PScheduleGroup
작업 예약에 사용할 일정 그룹입니다.

지정된 소스 블록을 이 target_block 개체에 연결합니다.

virtual void link_source(_Inout_ ISource<_Source_type>* _PSource);

매개 변수

_PSource
연결할 블록에 ISource 대한 포인터입니다.

설명

이 함수는 개체에서 target_block 직접 호출해서는 안 됩니다. 블록은 해당 대상에서 ISource 메서드를 link_target 호출하는 블록의 메서드를 link_source 사용하여 함께 연결되어야 합니다.

process_input_messages

입력으로 받은 메시지를 처리합니다.

virtual void process_input_messages(_Inout_ message<_Source_type>* _PMessage);

매개 변수

_PMessage
처리할 메시지에 대한 포인터입니다.

process_message

파생 클래스에 재정의된 경우 이 target_block 개체가 수락했던 메시지를 처리합니다.

virtual void process_message(message<_Source_type> *);

전파

소스 블록에서 이 대상 블록으로 메시지를 비동기적으로 전달합니다.

virtual message_status propagate(
    _Inout_opt_ message<_Source_type>* _PMessage,
    _Inout_opt_ ISource<_Source_type>* _PSource);

매개 변수

_PMessage
message 개체에 대한 포인터입니다.

_PSource
메시지를 제공하는 소스 블록에 대한 포인터입니다.

Return Value

대상이 메시지로 무엇을 하기로 결정했는지에 대한 message_상태 표시입니다.

설명

메서드는 매개 변수가 있는 경우 invalid_argument 예외를 _PMessage throw합니다NULL._PSource

propagate_message

파생 클래스에서 재정의된 경우 이 메서드는 블록에서 ISourcetarget_block 개체로 메시지를 비동기적으로 전달합니다. 소스 블록에서 호출할 propagate 때 메서드에 의해 호출됩니다.

virtual message_status propagate_message(
    _Inout_ message<_Source_type>* _PMessage,
    _Inout_ ISource<_Source_type>* _PSource) = 0;

매개 변수

_PMessage
message 개체에 대한 포인터입니다.

_PSource
메시지를 제공하는 소스 블록에 대한 포인터입니다.

Return Value

대상이 메시지로 무엇을 하기로 결정했는지에 대한 message_상태 표시입니다.

register_filter

받은 모든 메시지에 대해 호출될 필터 메서드를 등록합니다.

void register_filter(filter_method const& _Filter);

매개 변수

_필터
필터 메서드입니다.

remove_sources

미해결 비동기 보내기 작업이 완료되도록 기다린 후 모든 원본의 연결을 해제합니다.

void remove_sources();

설명

모든 대상 블록은 이 루틴을 호출하여 소멸자의 원본을 제거해야 합니다.

send

원본 블록에서 이 대상 블록으로 메시지를 동기적으로 전달합니다.

virtual message_status send(
    _Inout_ message<_Source_type>* _PMessage,
    _Inout_ ISource<_Source_type>* _PSource);

매개 변수

_PMessage
message 개체에 대한 포인터입니다.

_PSource
메시지를 제공하는 소스 블록에 대한 포인터입니다.

Return Value

대상이 메시지로 무엇을 하기로 결정했는지에 대한 message_상태 표시입니다.

설명

메서드는 매개 변수가 있는 경우 invalid_argument 예외를 _PMessage throw합니다NULL._PSource

send 메시지 시작 외부에서 메서드를 사용하고 네트워크 내에서 메시지를 전파하는 것은 위험하며 교착 상태가 발생할 수 있습니다.

반환될 때 send 메시지는 이미 수락되어 대상 블록으로 전송되었거나 대상에 의해 거부되었습니다.

send_message

파생 클래스에서 재정의된 경우 이 메서드는 블록에서 ISourcetarget_block 개체로 메시지를 동기적으로 전달합니다. 소스 블록에서 호출할 send 때 메서드에 의해 호출됩니다.

virtual message_status send_message(
    _Inout_ message<_Source_type> *,
    _Inout_ ISource<_Source_type> *);

Return Value

대상이 메시지로 무엇을 하기로 결정했는지에 대한 message_상태 표시입니다.

설명

기본적으로 이 블록은 파생 클래스로 재정의되지 않는 한 반환 declined 됩니다.

sync_send

처리를 위해 메시지를 동기적으로 보냅니다.

void sync_send(_Inout_opt_ message<_Source_type>* _PMessage);

매개 변수

_PMessage
전송되는 메시지에 대한 포인터입니다.

target_block

target_block 개체를 생성합니다.

target_block();

~target_block

개체를 target_block 삭제합니다.

virtual ~target_block();

target_block 개체에서 지정된 소스 블록의 연결을 해제합니다.

virtual void unlink_source(_Inout_ ISource<_Source_type>* _PSource);

매개 변수

_PSource
연결을 해제할 블록에 대한 포인터 ISource 입니다.

target_block 개체에서 모든 소스 블록의 연결을 해제합니다.

virtual void unlink_sources();

wait_for_async_sends

모든 비동기 전파가 완료되기를 기다립니다.

void wait_for_async_sends();

설명

이 메서드는 모든 비동기 작업이 블록을 삭제하기 전에 완료할 시간이 있는지 확인하기 위해 메시지 블록 소멸자에서 사용됩니다.

참고 항목

concurrency 네임스페이스
ITarget 클래스