public override void Add(int templateId, MessageTemplate template)
 {
     Define(template);
     _regIdMap[templateId] = template;
     _regTemplateMap[template] = templateId;
     NotifyTemplateRegistered(template, templateId);
 }
Пример #2
0
        public void TestMultipleDictionaryTypes()
        {
            var bid = new Scalar("bid", FastType.Decimal, Operator.Copy, ScalarValue.Undefined, false)
                          {Dictionary = DictionaryFields.Template};

            var quote = new MessageTemplate("quote", new Field[] {bid});

            var bidR = new Scalar("bid", FastType.Decimal, Operator.Copy, ScalarValue.Undefined, false);
            var request = new MessageTemplate("request", new Field[] {bidR});

            var quote1 = new Message(quote);
            quote1.SetFieldValue(1, new DecimalValue(10.2));

            var request1 = new Message(request);
            request1.SetFieldValue(1, new DecimalValue(10.3));

            var quote2 = new Message(quote);
            quote2.SetFieldValue(1, new DecimalValue(10.2));

            var request2 = new Message(request);
            request2.SetFieldValue(1, new DecimalValue(10.2));

            _session.MessageOutputStream.RegisterTemplate(1, request);
            _session.MessageOutputStream.RegisterTemplate(2, quote);
            _session.MessageOutputStream.WriteMessage(quote1);
            _session.MessageOutputStream.WriteMessage(request1);
            _session.MessageOutputStream.WriteMessage(quote2);
            _session.MessageOutputStream.WriteMessage(request2);

            const string expected = "11100000 10000010 11111111 00000000 11100110 " +
                                    "11100000 10000001 11111111 00000000 11100111 " +
                                    "11000000 10000010 " +
                                    "11100000 10000001 11111111 00000000 11100110";
            TestUtil.AssertBitVectorEquals(expected, TestUtil.ToByte(_output));
        }
Пример #3
0
        public void TestEncodeMessageWithAllFieldTypes()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.String, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("2", FastType.ByteVector, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("3", FastType.Decimal, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("4", FastType.I32, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("5", FastType.String, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("6", FastType.U32, Operator.Copy, ScalarValue.Undefined, false),
                    });

            var context = new Context();
            context.RegisterTemplate(113, template);

            var message = new Message(template);
            message.SetString(1, "H");
            message.SetByteVector(2, new[] {(byte) 0xFF});
            message.SetDecimal(3, 1.201);
            message.SetInteger(4, -1);
            message.SetString(5, "abc");
            message.SetInteger(6, 2);

            //               --PMAP-- --TID--- ---#1--- -------#2-------- ------------#3------------ ---#4--- ------------#5------------ ---#6---
            const string msgstr =
                "11111111 11110001 11001000 10000001 11111111 11111101 00001001 10110001 11111111 01100001 01100010 11100011 10000010";
            AssertEquals(msgstr, new FastEncoder(context).Encode(message));
        }
Пример #4
0
        public void TestDecodeMessageWithAllFieldTypes()
        {
            //   --PMAP-- --TID--- ---#1--- -------#2-------- ------------#3------------ ---#4--- ------------#5------------ ---#6---
            const string msgstr =
                "11111111 11110001 11001000 10000001 11111111 11111101 00001001 10110001 11111111 01100001 01100010 11100011 10000010";
            Stream input = ByteUtil.CreateByteStream(msgstr);

            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.Ascii, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("2", FastType.ByteVector, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("3", FastType.Decimal, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("4", FastType.I32, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("5", FastType.Ascii, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("6", FastType.U32, Operator.Copy, ScalarValue.Undefined, false),
                    });
            var context = new Context();
            context.RegisterTemplate(113, template);

            GroupValue message = new Message(template);
            message.SetString(1, "H");
            message.SetByteVector(2, new[] {(byte) 0xFF});
            message.SetDecimal(3, 1.201);
            message.SetInteger(4, -1);
            message.SetString(5, "abc");
            message.SetInteger(6, 2);
            Assert.AreEqual(message, new FastDecoder(context, input).ReadMessage());
        }
 public void TestParseStatic()
 {
     XmlElement statTempRefDef = Document("<templateRef name='base'/>");
     var baset = new MessageTemplate("base", new Field[0]);
     _context.TemplateRegistry.Define(baset);
     var statTempRef = (StaticTemplateReference) _parser.Parse(statTempRefDef, _context);
     Assert.AreEqual(baset, statTempRef.Template);
 }
 public override void Define(MessageTemplate template)
 {
     if (!templates.Contains(template))
     {
         nameMap[template.QName] = template;
         templates.Add(template);
     }
 }
Пример #7
0
        public override Message CreateTemplateDeclarationMessage(MessageTemplate messageTemplate, int templateId)
        {
            var declaration = new Message(TEMPLATE_DECLARATION);

            AbstractFieldInstructionConverter.SetName(messageTemplate, declaration);
            declaration.SetInteger("TemplateId", templateId);
            return(declaration);
        }
Пример #8
0
        public override Message CreateTemplateDefinitionMessage(MessageTemplate messageTemplate)
        {
            Message templateDefinition = GroupConverter.Convert(messageTemplate, new Message(TEMPLATE_DEFINITION), initialContext);
            int     reset = messageTemplate.HasAttribute(RESET_PROPERTY)?1:0;

            templateDefinition.SetInteger("Reset", reset);
            return(templateDefinition);
        }
Пример #9
0
        public void TestNullValue()
        {
            var scalar = new Scalar("deltaString", FastType.String, Operator.Delta, ScalarValue.Undefined, true);
            var template = new MessageTemplate("template", new Field[] {scalar});
            var bvBuilder = new BitVectorBuilder(7);
            TestUtil.AssertBitVectorEquals("10000000", scalar.Encode(null, template, new Context(), bvBuilder));

            //		assertEquals(null, scalar.decode(bitStream("10000000"), ScalarValue.UNDEFINED));
        }
Пример #10
0
        public void TestEncodeEmptyMessage()
        {
            var messageTemplate = new MessageTemplate("", new Field[0]);
            var message = new Message(messageTemplate);
            var context = new Context();
            context.RegisterTemplate(113, messageTemplate);

            byte[] encoding = new FastEncoder(context).Encode(message);
            AssertEquals("11000000 11110001", encoding);
        }
Пример #11
0
        public void TestDecodeEmptyMessage()
        {
            var messageTemplate = new MessageTemplate("", new Field[0]);
            Stream input = ByteUtil.CreateByteStream("11000000 11110001");
            var context = new Context();
            context.RegisterTemplate(113, messageTemplate);

            Message message = new FastDecoder(context, input).ReadMessage();
            Assert.AreEqual(113, message.GetInt(0));
        }
        public void TestRegister()
        {
            var mt = new MessageTemplate("Logon", new Field[0]);
            AbstractTemplateRegistry registry = new BasicTemplateRegistry {{1000, mt}};

            Assert.Contains(mt, registry.Templates);
            Assert.AreEqual(1000, registry.GetId("Logon"));
            Assert.AreEqual(1000, registry.GetId(mt));
            Assert.AreEqual(mt, registry[1000]);
            Assert.AreEqual(mt, registry["Logon"]);
        }
        public void TestDefine()
        {
            var mt = new MessageTemplate("Logon", new Field[0]);
            AbstractTemplateRegistry registry = new BasicTemplateRegistry();
            registry.Define(mt);

            //Assert.Contains(mt, registry.Templates);//dont know why it need to access when it is just defined *SM*
            Assert.AreEqual(-1, registry.GetId("Logon"));
            Assert.AreEqual(-1, registry.GetId(mt));
            Assert.AreEqual(null, registry[1000]);
            Assert.AreEqual(mt, registry["Logon"]);
        }
        public void TestExistingTemplateValueLookup()
        {
            Dictionary dictionary = new TemplateDictionary();
            Group template = new MessageTemplate("Position",
                    new Field[] {
                    new Scalar("exchange", FASTType.STRING, Operator.COPY, ScalarValue.UNDEFINED, false)
                });
            ScalarValue value = new StringValue("NYSE");
            dictionary.Store(template, FastConstants.ANY_TYPE, new QName("exchange"), value);

            Assert.AreEqual(ScalarValue.UNDEFINED, dictionary.Lookup(template, new QName("bid"), FastConstants.ANY_TYPE));
        }
Пример #15
0
        public void TestEncodeDecodeNestedSequence()
        {
            var nestedSequence = new Sequence("nested", new Field[] { new Scalar("string", FASTType.ASCII, Operator.COPY, ScalarValue.UNDEFINED, false) }, true);
            var group = new Group("group", new Field[] { nestedSequence }, true);
            var t = new MessageTemplate("template", new Field[] { group });
            var message = new Message(t);

            FastEncoder encoder = Encoder(t);
            AssertEquals("11000000 10000001", encoder.Encode(message));

            FastDecoder decoder = Decoder("11000000 10000001", t);
            Assert.AreEqual(message, decoder.ReadMessage());
        }
        public void TestExistingTemplateValueLookup()
        {
            IDictionary dictionary = new TemplateDictionary();
            Group template = new MessageTemplate(
                "Position",
                new Field[]
                    {
                        new Scalar("exchange", FastType.String, Operator.Copy, ScalarValue.Undefined, false)
                    });
            ScalarValue value = new StringValue("NYSE");
            dictionary.Store(template, new QName("exchange"), FastConstants.AnyType, value);

            Assert.AreEqual(ScalarValue.Undefined, dictionary.Lookup(template, new QName("bid"), FastConstants.AnyType));
        }
Пример #17
0
        public void TestEquals()
        {
            var template = new MessageTemplate("",
                new Field[] {
                    new Scalar("1", FASTType.U32, Operator.COPY, ScalarValue.UNDEFINED, false)
                });
            GroupValue message = new Message(template);
            message.SetInteger(1, 1);

            GroupValue other = new Message(template);
            other.SetInteger(1, 1);

            Assert.AreEqual(message, other);
        }
Пример #18
0
        public void NewSession(Session session)
        {
            //session.IsListening = true;
            session.ErrorHandler = new FastServer.ServerErrorHandler();
            session.MessageHandler = new MessageListener();

            //register a template
            var template = new MessageTemplate(
                "Arbitry",
                new Field[]
                    {
                        new Scalar("1", FastType.I32, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("2", FastType.I32, Operator.Delta, ScalarValue.Undefined, false),
                        new Scalar("3", FastType.I32, Operator.Increment, new IntegerValue(10), false),
                        new Scalar("4", FastType.I32, Operator.Increment, ScalarValue.Undefined, false),
                        new Scalar("5", FastType.I32, Operator.Constant, new IntegerValue(1), false),
                        /* NON-TRANSFERRABLE */
                        new Scalar("6", FastType.I32, Operator.Default, new IntegerValue(2), false)
                    });

            ITemplateRegistry registry = new BasicTemplateRegistry {{24, template}};
            session.MessageInputStream.RegisterTemplate(24, template);

            //send that template
            session.SendTemplates(registry);

            while (true)
            {
                DateTime startTime = DateTime.Now;
                for (int i = 0; i < 64000; i++)
                {
                    //make a message
                    var message = new Message(template);
                    message.SetInteger(1, 109);
                    message.SetInteger(2, 29470);
                    message.SetInteger(3, 10);
                    message.SetInteger(4, 3);
                    message.SetInteger(5, 1);
                    message.SetInteger(6, 2);

                    //send it to client
                    session.MessageOutputStream.WriteMessage(message);
                }
                double seconds = (DateTime.Now - startTime).TotalSeconds;
                Console.WriteLine(seconds);
                Console.WriteLine("MSG/S:" + (64000/seconds).ToString("0"));
            }
        }
        public void NewSession(Session session)
        {
            //session.Listening = true;
            session.ErrorHandler = new TCPServer.FASTServer.ServerErrorHandler();
            session.MessageHandler = new FASTMessageListener();
            //register a template
            TemplateRegistry registry = new BasicTemplateRegistry();
            var template = new MessageTemplate("Arbitry",
               new Field[] {
                    new Scalar("1", FASTType.I32, Operator.COPY, ScalarValue.UNDEFINED, false),
                    new Scalar("2", FASTType.I32, Operator.DELTA, ScalarValue.UNDEFINED, false),
                    new Scalar("3", FASTType.I32, Operator.INCREMENT,
                        new IntegerValue(10), false),
                    new Scalar("4", FASTType.I32, Operator.INCREMENT,
                        ScalarValue.UNDEFINED, false),
                    new Scalar("5", FASTType.I32, Operator.CONSTANT,
                        new IntegerValue(1), false), /* NON-TRANSFERRABLE */
                new Scalar("6", FASTType.I32, Operator.DEFAULT,
                        new IntegerValue(2), false)
                });
            registry.Register(24, template);

            session.MessageInputStream.RegisterTemplate(24, template);
            //send that template
            session.SendTemplates(registry);

            while (true)
            {
                DateTime startTime = DateTime.Now;
                for (int i = 0; i < 64000; i++)
                {
                    //make a message
                    var message = new Message(template);
                    message.SetInteger(1, 109);
                    message.SetInteger(2, 29470);
                    message.SetInteger(3, 10);
                    message.SetInteger(4, 3);
                    message.SetInteger(5, 1);
                    message.SetInteger(6, 2);

                    //send it to client
                    session.MessageOutputStream.WriteMessage(message);
                }
                double seconds = (DateTime.Now - startTime).TotalSeconds;
                Console.WriteLine(seconds);
                Console.WriteLine("MSG/S:" + (64000 / seconds).ToString("0"));
            }
        }
        public void TestLookupMultipleValuesForTemplate()
        {
            Dictionary dictionary = new TemplateDictionary();
            Group template = new MessageTemplate("Position",
                    new Field[] {
                    new Scalar("exchange", FASTType.STRING, Operator.COPY, ScalarValue.UNDEFINED, false)
                });
            ScalarValue value = new StringValue("NYSE");
            ScalarValue marketValue = new DecimalValue(100000.00);
            dictionary.Store(template, FastConstants.ANY_TYPE, new QName("exchange"), value);
            dictionary.Store(template, FastConstants.ANY_TYPE, new QName("marketValue"), marketValue);

            Assert.IsFalse(value.Equals(ScalarValue.UNDEFINED));
            Assert.AreEqual(value, dictionary.Lookup(template, new QName("exchange"), FastConstants.ANY_TYPE));
            Assert.AreEqual(marketValue, dictionary.Lookup(template, new QName("marketValue"), FastConstants.ANY_TYPE));
        }
Пример #21
0
        public void TestNotEquals()
        {
            var template = new MessageTemplate("",
                new Field[] {
                    new Scalar("1", FASTType.U32, Operator.COPY, ScalarValue.UNDEFINED, false)
                });
            var message = new Message(template);
            message.SetInteger(1, 2);

            var other = new Message(template);
            Assert.IsFalse(message.equals(other));
            Assert.IsFalse(other.equals(message));
            other.SetInteger(1, 1);

            Assert.IsFalse(message.equals(other));
            Assert.IsFalse(other.equals(message));
        }
Пример #22
0
        public void TestEquals()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.U32, Operator.Copy, ScalarValue.Undefined, false)
                    });
            GroupValue message = new Message(template);
            message.SetInteger(1, 1);

            GroupValue other = new Message(template);
            other.SetInteger(1, 1);

            Assert.AreEqual(message, other);
            //Assert.AreEqual(message.GetHashCode(), other.GetHashCode());
        }
Пример #23
0
        public static MessageTemplate AllocationInstruction()
        {
            if (_allocationInstruction == null)
            {
                _allocationInstruction = new MessageTemplate("AllocInstrctn",
                    new Field[] {
                    Allocations(),
                    Instrument(),
                    new Scalar("ID",            FASTType.ASCII,   Operator.DELTA, ScalarValue.UNDEFINED, false),
                    new Scalar("Side",          FASTType.U32,     Operator.COPY,  ScalarValue.UNDEFINED, false),
                    new Scalar("Quantity",      FASTType.DECIMAL, Operator.DELTA, ScalarValue.UNDEFINED, false),
                    new Scalar("Average Price", FASTType.DECIMAL, Operator.DELTA, ScalarValue.UNDEFINED, false)
                });
            }

            return _allocationInstruction;
        }
        public void TestLookupMultipleValuesForTemplate()
        {
            IDictionary dictionary = new TemplateDictionary();
            Group template = new MessageTemplate(
                "Position",
                new Field[]
                    {
                        new Scalar("exchange", FastType.String, Operator.Copy, ScalarValue.Undefined, false)
                    });
            ScalarValue value = new StringValue("NYSE");
            ScalarValue marketValue = new DecimalValue(100000.00);
            dictionary.Store(template, new QName("exchange"), FastConstants.AnyType, value);
            dictionary.Store(template, new QName("marketValue"), FastConstants.AnyType, marketValue);

            Assert.AreNotEqual(ScalarValue.Undefined, value);
            Assert.AreEqual(value, dictionary.Lookup(template, new QName("exchange"), FastConstants.AnyType));
            Assert.AreEqual(marketValue, dictionary.Lookup(template, new QName("marketValue"), FastConstants.AnyType));
        }
Пример #25
0
        public void TestNotEquals()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.U32, Operator.Copy, ScalarValue.Undefined, false)
                    });
            var message = new Message(template);
            var other = new Message(template);

            message.SetInteger(1, 2);
            Assert.IsFalse(message.Equals(other));
            Assert.IsFalse(other.Equals(message));

            other.SetInteger(1, 1);
            Assert.IsFalse(message.Equals(other));
            Assert.IsFalse(other.Equals(message));
        }
        public void TestLookup()
        {
            var allocationInstruction =
                new MessageTemplate(ObjectMother.AllocationInstruction)
                    {
                        TypeReference = new QName("AllocationInstruction")
                    };

            var allocations = new Sequence(ObjectMother.Allocations) {TypeReference = new QName("Allocation")};

            var context = new Context();

            context.Store(DictionaryFields.Type, allocationInstruction, new QName("ID"), String("1234"));

            Assert.AreEqual(String("1234"),
                            context.Lookup(DictionaryFields.Type, allocationInstruction, new QName("ID")));
            Assert.AreEqual(ScalarValue.Undefined,
                            context.Lookup(DictionaryFields.Type, allocations.Group, new QName("ID")));
        }
        protected void SetUp()
        {
            _nameTemplate = Template("<template>" +
                                     "  <string name='name'/>" +
                                     "</template>");
            _template = Template("<template>" +
                                 "  <uInt32 name='quantity'/>" +
                                 "  <templateRef/>" +
                                 "  <decimal name='price'/>" +
                                 "</template>");
            _message = new Message(_template);
            _message.SetInteger(1, 15);
            _message.SetDecimal(3, 102.0);

            _name = new Message(_nameTemplate);
            _name.SetString(1, "IBM");
            _message.SetFieldValue(2, _name);

            _context = new Context();
            _context.RegisterTemplate(1, _template);
            _context.RegisterTemplate(2, _nameTemplate);
        }
Пример #28
0
 public override Message CreateTemplateDeclarationMessage(MessageTemplate messageTemplate, int templateId)
 {
     return(null);
 }
Пример #29
0
        public void TestEncodeSimpleMessage()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.U32, Operator.Copy, ScalarValue.Undefined, false)
                    });

            var context = new Context();
            context.RegisterTemplate(113, template);

            var message = new Message(template);
            message.SetInteger(1, 1);

            var encoder = new FastEncoder(context);
            AssertEquals("11100000 11110001 10000001", encoder.Encode(message));
        }
Пример #30
0
        public void TestEncodeSequentialEmptyMessages()
        {
            var messageTemplate = new MessageTemplate("", new Field[0]);
            var message = new Message(messageTemplate);
            var nextMsg = new Message(messageTemplate);
            var context = new Context();
            context.RegisterTemplate(113, messageTemplate);

            var encoder = new FastEncoder(context);

            // Presence map should show that the only field present is the template id.
            AssertEquals("11000000 11110001",
                         encoder.Encode(message));
            // Presence map should be empty (except for leading stop bit)
            AssertEquals("10000000", encoder.Encode(nextMsg));
        }
Пример #31
0
 public abstract Message CreateTemplateDeclarationMessage(MessageTemplate param1, int param2);
Пример #32
0
 public abstract Message CreateTemplateDefinitionMessage(MessageTemplate param1);
Пример #33
0
 internal RESETMessageBase(MessageTemplate Param1)
     : base(Param1)
 {
 }
Пример #34
0
 static SessionControlProtocol_1_0()
 {
     FAST_ALERT_TEMPLATE = new MessageTemplate("", new Field[] { new Scalar("Severity", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Code", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Value", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, true), new Scalar("Description", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, false) });
     FAST_HELLO_TEMPLATE = new MessageTemplate("", new Field[] { new Scalar("SenderName", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, false) });
     RESET_HANDLER       = new RESETMessageHandler();
 }
 public override Message CreateTemplateDeclarationMessage(MessageTemplate messageTemplate, int templateId)
 {
     return null;
 }
Пример #36
0
 public StaticTemplateReference(StaticTemplateReference other)
     : base(other)
 {
     _template = (MessageTemplate)other._template.Clone();
 }
Пример #37
0
 public override Message CreateTemplateDefinitionMessage(MessageTemplate messageTemplate)
 {
     return(null);
 }
Пример #38
0
        public void TestEncodeMessageWithOverlongPmap()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false),
                        new Scalar("1", FastType.U32, Operator.Copy, new IntegerValue(1), false)
                    });

            var context = new Context();
            context.RegisterTemplate(113, template);

            var message = new Message(template);
            message.SetInteger(1, 1);
            message.SetInteger(2, 1);
            message.SetInteger(3, 1);
            message.SetInteger(4, 1);
            message.SetInteger(5, 1);
            message.SetInteger(6, 1);
            message.SetInteger(7, 1);

            //                     --PMAP-- --PMAP-- --PMAP-- --TID---
            //WHAT IT THINKS 01000000 00000000 10000000 11110001
            const string msgstr = "11000000 11110001";

            AssertEquals(msgstr, new FastEncoder(context).Encode(message));
        }
Пример #39
0
 static SessionControlProtocol_1_1()
 {
     FAST_ALERT_TEMPLATE = new MessageTemplate("Alert", new Field[] { new Scalar("Severity", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Code", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Value", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, true), new Scalar("Description", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, false) });
     FAST_HELLO_TEMPLATE = new MessageTemplate("Hello", new Field[] { new Scalar("SenderName", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("VendorId", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, true) });
     RESET = new RESETMessage(FAST_RESET_TEMPLATE);
     {
         FAST_RESET_TEMPLATE.AddAttribute(RESET_PROPERTY, "yes");
     }
     RESET_HANDLER       = new RESETMessageHandler();
     ALERT_HANDLER       = new ALERTSessionMessageHandler();
     ATTRIBUTE           = new MessageTemplate(new QName("Attribute", NAMESPACE), new[] { dict("Ns", true, "template"), unicode("Name"), unicode("Value") });
     ELEMENT             = new MessageTemplate(new QName("Element", NAMESPACE), new[] { dict("Ns", true, "template"), unicode("Name"), new Sequence(qualify("Attributes"), new Field[] { new StaticTemplateReference(ATTRIBUTE) }, false), new Sequence(qualify("Content"), new Field[] { DynamicTemplateReference.INSTANCE }, false) });
     TEMPLATE_NAME       = new MessageTemplate(new QName("TemplateName", NAMESPACE), new Field[] { new Scalar(qualify("Ns"), Type.UNICODE, Operator.COPY, null, false), new Scalar(qualify("Name"), Type.UNICODE, Operator.NONE, null, false) });
     NS_NAME             = new MessageTemplate(new QName("NsName", NAMESPACE), new[] { dict("Ns", false, "template"), new Scalar(qualify("Name"), Type.UNICODE, Operator.NONE, null, false) });
     NS_NAME_WITH_AUX_ID = new MessageTemplate(new QName("NsNameWithAuxId", NAMESPACE), new Field[] { new StaticTemplateReference(NS_NAME), new Scalar(qualify("AuxId"), Type.UNICODE, Operator.NONE, null, true) });
     FIELD_BASE          = new MessageTemplate(new QName("PrimFieldBase", NAMESPACE), new Field[] { new StaticTemplateReference(NS_NAME_WITH_AUX_ID), new Scalar(qualify("Optional"), Type.U32, Operator.NONE, null, false), new StaticTemplateReference(OTHER) });
     PRIM_FIELD_BASE     = new MessageTemplate(new QName("PrimFieldBase", NAMESPACE), new Field[] { new StaticTemplateReference(FIELD_BASE), new Group(qualify("Operator"), new Field[] { DynamicTemplateReference.INSTANCE }, true) });
     INT32_INSTR         = new MessageTemplate(new QName("Int32Instr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.I32, Operator.NONE, null, true) });
     UINT32_INSTR        = new MessageTemplate(new QName("UInt32Instr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.U32, Operator.NONE, null, true) });
     INT64_INSTR         = new MessageTemplate(new QName("Int64Instr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.I64, Operator.NONE, null, true) });
     UINT64_INSTR        = new MessageTemplate(new QName("UInt64Instr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.U64, Operator.NONE, null, true) });
     DECIMAL_INSTR       = new MessageTemplate(new QName("DecimalInstr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.DECIMAL, Operator.NONE, null, true) });
     UNICODE_INSTR       = new MessageTemplate(new QName("UnicodeInstr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE_WITH_LENGTH), new Scalar(qualify("InitialValue"), Type.UNICODE, Operator.NONE, null, true) });
     ASCII_INSTR         = new MessageTemplate(new QName("AsciiInstr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE), new Scalar(qualify("InitialValue"), Type.ASCII, Operator.NONE, null, true) });
     BYTE_VECTOR_INSTR   = new MessageTemplate(new QName("ByteVectorInstr", NAMESPACE), new Field[] { new StaticTemplateReference(PRIM_FIELD_BASE_WITH_LENGTH), new Scalar(qualify("InitialValue"), Type.BYTE_VECTOR, Operator.NONE, null, true) });
     TEMPLATE_DEFINITION = new MessageTemplate(new QName("TemplateDef", NAMESPACE), new[] { new StaticTemplateReference(TEMPLATE_NAME), unicodeopt("AuxId"), u32opt("TemplateId"), new StaticTemplateReference(TYPE_REF), u32("Reset"), new StaticTemplateReference(OTHER), new Sequence(qualify("Instructions"), new Field[] { DynamicTemplateReference.INSTANCE }, false) });
     GROUP_INSTR         = new MessageTemplate(new QName("GroupInstr", NAMESPACE), new Field[] { new StaticTemplateReference(FIELD_BASE), new StaticTemplateReference(TYPE_REF), new Sequence(qualify("Instructions"), new Field[] { DynamicTemplateReference.INSTANCE }, false) });
     SEQUENCE_INSTR      = new MessageTemplate(new QName("SequenceInstr", NAMESPACE), new Field[] { new StaticTemplateReference(FIELD_BASE), new StaticTemplateReference(TYPE_REF), new Group(qualify("Length"), new Field[] { new Group(qualify("Name"), new Field[] { new StaticTemplateReference(NS_NAME_WITH_AUX_ID) }, true), new Group(qualify("Operator"), new Field[] { DynamicTemplateReference.INSTANCE }, true), new Scalar(qualify("InitialValue"), Type.U32, Operator.NONE, null, true), new StaticTemplateReference(OTHER) }, true), new Sequence(qualify("Instructions"), new Field[] { DynamicTemplateReference.INSTANCE }, false) });
     TEXT = new MessageTemplate(qualify("Text"), new Field[] { new Scalar(qualify("Value"), Type.UNICODE, Operator.NONE, ScalarValue.UNDEFINED, false) });
     COMP_DECIMAL_INSTR = new MessageTemplate(qualify("CompositeDecimalInstr"), new Field[] { new StaticTemplateReference(FIELD_BASE), new Group(qualify("Exponent"), new Field[] { new Group(qualify("Operator"), new Field[] { DynamicTemplateReference.INSTANCE }, false), new Scalar(qualify("InitialValue"), Type.I32, Operator.NONE, ScalarValue.UNDEFINED, true), new StaticTemplateReference(OTHER) }, true), new Group(qualify("Mantissa"), new Field[] { new Group(qualify("Operator"), new Field[] { DynamicTemplateReference.INSTANCE }, false), new Scalar(qualify("InitialValue"), Type.I32, Operator.NONE, ScalarValue.UNDEFINED, true), new StaticTemplateReference(OTHER) }, true) });
     {
         TEMPLATE_REGISTRY.Register(FAST_HELLO_TEMPLATE_ID, FAST_HELLO_TEMPLATE);
         TEMPLATE_REGISTRY.Register(FAST_ALERT_TEMPLATE_ID, FAST_ALERT_TEMPLATE);
         TEMPLATE_REGISTRY.Register(FAST_RESET_TEMPLATE_ID, FAST_RESET_TEMPLATE);
         TEMPLATE_REGISTRY.Register(TEMPLATE_DECL_ID, TEMPLATE_DECLARATION);
         TEMPLATE_REGISTRY.Register(TEMPLATE_DEF_ID, TEMPLATE_DEFINITION);
         TEMPLATE_REGISTRY.Register(INT32_INSTR_ID, INT32_INSTR);
         TEMPLATE_REGISTRY.Register(UINT32_INSTR_ID, UINT32_INSTR);
         TEMPLATE_REGISTRY.Register(INT64_INSTR_ID, INT64_INSTR);
         TEMPLATE_REGISTRY.Register(UINT64_INSTR_ID, UINT64_INSTR);
         TEMPLATE_REGISTRY.Register(DECIMAL_INSTR_ID, DECIMAL_INSTR);
         TEMPLATE_REGISTRY.Register(COMP_DECIMAL_INSTR_ID, COMP_DECIMAL_INSTR);
         TEMPLATE_REGISTRY.Register(ASCII_INSTR_ID, ASCII_INSTR);
         TEMPLATE_REGISTRY.Register(UNICODE_INSTR_ID, UNICODE_INSTR);
         TEMPLATE_REGISTRY.Register(BYTE_VECTOR_INSTR_ID, BYTE_VECTOR_INSTR);
         TEMPLATE_REGISTRY.Register(STAT_TEMP_REF_INSTR_ID, STAT_TEMP_REF_INSTR);
         TEMPLATE_REGISTRY.Register(DYN_TEMP_REF_INSTR_ID, DYN_TEMP_REF_INSTR);
         TEMPLATE_REGISTRY.Register(SEQUENCE_INSTR_ID, SEQUENCE_INSTR);
         TEMPLATE_REGISTRY.Register(GROUP_INSTR_ID, GROUP_INSTR);
         TEMPLATE_REGISTRY.Register(CONSTANT_OP_ID, CONSTANT_OP);
         TEMPLATE_REGISTRY.Register(DEFAULT_OP_ID, DEFAULT_OP);
         TEMPLATE_REGISTRY.Register(COPY_OP_ID, COPY_OP);
         TEMPLATE_REGISTRY.Register(INCREMENT_OP_ID, INCREMENT_OP);
         TEMPLATE_REGISTRY.Register(DELTA_OP_ID, DELTA_OP);
         TEMPLATE_REGISTRY.Register(TAIL_OP_ID, TAIL_OP);
         TEMPLATE_REGISTRY.Register(FOREIGN_INSTR_ID, FOREIGN_INSTR);
         TEMPLATE_REGISTRY.Register(ELEMENT_ID, ELEMENT);
         TEMPLATE_REGISTRY.Register(TEXT_ID, TEXT);
         MessageTemplate[] templates = TEMPLATE_REGISTRY.Templates;
         for (int i = 0; i < templates.Length; i++)
         {
             Namespace = templates[i];
         }
     }
 }
 public override Message CreateTemplateDefinitionMessage(MessageTemplate messageTemplate)
 {
     return null;
 }
Пример #41
0
 public StaticTemplateReference(MessageTemplate template)
     : base(template.QName, false)
 {
     _template = template;
 }