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.codec.messaging.ReleasedType; 14 15 import hunt.collection.List; 16 import hunt.Object; 17 import hunt.Exceptions; 18 import hunt.proton.amqp.Symbol; 19 import hunt.proton.amqp.UnsignedLong; 20 import hunt.proton.amqp.messaging.Released; 21 import hunt.proton.codec.AbstractDescribedType; 22 import hunt.proton.codec.Decoder; 23 import hunt.proton.codec.DescribedTypeConstructor; 24 import hunt.proton.codec.EncoderImpl; 25 import hunt.collection.ArrayList; 26 27 import std.concurrency : initOnce; 28 import hunt.Exceptions; 29 30 class ReleasedType : AbstractDescribedType!(Released,List!Object) , DescribedTypeConstructor!(Released) 31 { 32 //private static Object[] DESCRIPTORS = 33 //{ 34 // UnsignedLong.valueOf(0x0000000000000026L), Symbol.valueOf("amqp:released:list"), 35 //}; 36 37 // private static UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000026L); 38 39 static Object[] DESCRIPTORS() { 40 __gshared Object[] inst; 41 return initOnce!inst([UnsignedLong.valueOf(0x0000000000000026L), Symbol.valueOf("amqp:released:list")]); 42 } 43 44 static UnsignedLong DESCRIPTOR() { 45 __gshared UnsignedLong inst; 46 return initOnce!inst(UnsignedLong.valueOf(0x0000000000000026L)); 47 } 48 49 50 this(EncoderImpl encoder) 51 { 52 super(encoder); 53 } 54 55 override 56 public UnsignedLong getDescriptor() 57 { 58 return DESCRIPTOR; 59 } 60 61 override 62 protected List!Object wrap(Released val) 63 { 64 65 return new ArrayList!(Object) (); 66 } 67 68 69 public Released newInstance(Object described) 70 { 71 return Released.getInstance(); 72 } 73 74 public TypeInfo getTypeClass() 75 { 76 return typeid(Released); 77 } 78 79 public static void register(Decoder decoder, EncoderImpl encoder) 80 { 81 ReleasedType type = new ReleasedType(encoder); 82 //implementationMissing(false); 83 foreach(Object descriptor ; DESCRIPTORS) 84 { 85 decoder.registerDynamic(descriptor, type); 86 } 87 encoder.register(type); 88 } 89 } 90