1 /*
2  * hunt-proton: AMQP Protocol library for D programming language.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 
13 module hunt.proton.amqp.transport.End;
14 
15 import hunt.proton.amqp.Binary;
16 import hunt.proton.amqp.transport.FrameBody;
17 import hunt.proton.amqp.transport.ErrorCondition;
18 
19 class End : FrameBody
20 {
21     private ErrorCondition _error;
22 
23     this() {}
24 
25     this(End other)
26     {
27         if (other._error !is null)
28         {
29             this._error = new ErrorCondition();
30             this._error.copyFrom(other._error);
31         }
32     }
33 
34     public ErrorCondition getError()
35     {
36         return _error;
37     }
38 
39     public void setError(ErrorCondition error)
40     {
41         _error = error;
42     }
43 
44 
45     public void invoke(E)(FrameBodyHandler!E handler, Binary payload, E context)
46     {
47         handler.handleEnd(this, payload, context);
48     }
49 
50     //public void invoke(E)(SaslFrameBodyHandler!E handler, Binary payload, E context)
51     //{
52     //    handler.handleMechanisms(this, payload, context);
53     //}
54 
55 
56     public FrameBody copy()
57     {
58         return new End(this);
59     }
60 }