public void updateSize() { int newSize = 0; for (int i = 0; i < nodeList_.Count; ++i) { DerNode n = nodeList_[i]; newSize += n.getSize(); } size_ = newSize; childChanged_ = false; }
/// <summary> /// Add a child to this node. /// </summary> /// /// <param name="node">The child node to add.</param> /// <param name="notifyParent"></param> public void addChild(DerNode node, bool notifyParent) { node.parent_ = this; ILOG.J2CsMapping.Collections.Collections.Add(nodeList_, node); if (notifyParent) { if (parent_ != null) { parent_.setChildChanged(); } } childChanged_ = true; }
/// <summary> /// Override the base decode to decode and store the data from an input /// buffer. Recursively populates child nodes. /// </summary> /// /// <param name="inputBuf">position.</param> /// <param name="startIdx">The offset into the buffer.</param> protected internal override void decode(ByteBuffer inputBuf, int startIdx) { int idx = startIdx; size_ = decodeHeader(inputBuf, idx); idx += header_.remaining(); int accSize = 0; while (accSize < size_) { DerNode node = net.named_data.jndn.encoding.der.DerNode.parse(inputBuf, idx); idx += node.getSize(); accSize += node.getSize(); addChild(node, false); } }
/// <summary> /// Override the base encode to return raw data encoding for this node and /// its children /// </summary> /// /// <returns>The raw data encoding.</returns> public override Blob encode() { DynamicByteBuffer temp = new DynamicByteBuffer(10); updateSize(); encodeHeader(size_); temp.ensuredPut(header_); for (int i = 0; i < nodeList_.Count; ++i) { DerNode n = nodeList_[i]; Blob encodedChild = n.encode(); temp.ensuredPut(encodedChild.buf()); } return(new Blob(temp.flippedBuffer(), false)); }
public void addChild(DerNode node) { addChild(node, false); }
public void addChild(DerNode node) { addChild(node, false); }
/// <summary> /// Add a child to this node. /// </summary> /// /// <param name="node">The child node to add.</param> /// <param name="notifyParent"></param> public void addChild(DerNode node, bool notifyParent) { node.parent_ = this; ILOG.J2CsMapping.Collections.Collections.Add(nodeList_,node); if (notifyParent) { if (parent_ != null) parent_.setChildChanged(); } childChanged_ = true; }