Documentation
¶
Overview ¶
Chain Of Responsibility 职责链模式:
使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系。 将这些对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它为止
个人想法:MFC的消息队列机制
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcreteHandlerA ¶
type ConcreteHandlerA struct {
Handler
}
具体处理结构体,这里简单处理int类型的请求,判断是否在[1-10]之间,是:处理,否:交给successor处理
func NewConcreteHandlerA ¶
func NewConcreteHandlerA() *ConcreteHandlerA
func (*ConcreteHandlerA) HandleRequest ¶
func (c *ConcreteHandlerA) HandleRequest(req int) int
type ConcreteHandlerB ¶
type ConcreteHandlerB struct {
Handler
}
具体处理结构体,这里简单处理int类型的请求,判断是否在[11-20]之间,是:处理,否:交给successor处理
func NewConcreteHandlerB ¶
func NewConcreteHandlerB() *ConcreteHandlerB
func (*ConcreteHandlerB) HandleRequest ¶
func (c *ConcreteHandlerB) HandleRequest(req int) int
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
实现处理请求的接口的基本结构体类型
func (*Handler) SetSuccessor ¶
Click to show internal directories.
Click to hide internal directories.