public void setElement(int index, TLVAmqp element)
 {
     _size          -= elements[index].getLength();
     elements[index] = element;
     _size          += element.getLength();
     update();
 }
Exemplo n.º 2
0
 public void putElement(TLVAmqp key, TLVAmqp value)
 {
     map[key] = value;
     _size   += key.getLength() + value.getLength();
     _count++;
     update();
 }
        public override int getLength()
        {
            int     length    = 8;
            TLVAmqp arguments = this.getArguments();

            length += arguments.getLength();
            return(length);
        }
        public void addElement(TLVAmqp element)
        {
            if (_size == 0)
            {
                Constructor.Code = AMQPType.LIST_8;
                _width           = 1;
                _size           += 1;
            }

            elements.Add(element);
            _count++;
            _size += element.getLength();
            update();
        }
Exemplo n.º 5
0
        public override int getLength()
        {
            int     length    = 8;
            TLVAmqp arguments = this.getArguments();

            length += arguments.getLength();

            foreach (KeyValuePair <SectionCodes, AMQPSection> item in _sections)
            {
                length += item.Value.getValue().getLength();
            }

            return(length);
        }
        public void addToArray(int index, TLVAmqp element)
        {
            if (_count <= index)
            {
                addElement(index, new TLVArray());
            }
            TLVAmqp array = elements[index];

            if (array.isNull())
            {
                setElement(index, new TLVArray());
            }
            ((TLVArray)elements[index]).addElement(element);
            _size += element.getLength();
            update();
        }
        public void addToMap(int index, TLVAmqp key, TLVAmqp value)
        {
            if (_count <= index)
            {
                addElement(index, new TLVMap());
            }
            TLVAmqp map = elements[index];

            if (map.isNull())
            {
                setElement(index, new TLVMap());
            }
            ((TLVMap)elements[index]).putElement(key, value);
            _size += key.getLength() + value.getLength();
            update();
        }
        public void addToList(int index, int elemIndex, TLVAmqp element)
        {
            if (_count <= index)
            {
                addElement(index, new TLVList());
            }
            TLVAmqp list = this.elements[index];

            if (list.isNull())
            {
                setElement(index, new TLVList());
            }
            ((TLVList)this.elements[index]).addElement(elemIndex, element);
            _size += element.getLength();
            update();
        }
        public void addElement(TLVAmqp element)
        {
            if (elements.Count == 0)
            {
                elementConstructor = element.Constructor;
                _size += _width;
                _size += elementConstructor.getLength();
            }

            elements.Add(element);
            _count++;
            _size += element.getLength() - elementConstructor.getLength();
            if (_width == 1 && _size > 255)
            {
                Constructor.Code = AMQPType.ARRAY_32;
                _width           = 4;
                _size           += 3;
            }
        }