/// <summary> /// Note: /// 1. helper should be the realy key used in the b-tree. /// </summary> /// <param name="segmentId"></param> /// <param name="helper"></param> /// <param name="bytes"></param> /// <param name="offset"></param> /// <param name="count"></param> public override Segment Deserialize(uint segmentId, object helper, byte[] bytes, int offset, int count) { IKey keyFactory = (IKey)helper; int pos = offset; short order = OOD.Utility.Bytes.Unpack2(bytes, pos); BNode result = new BNode(segmentId, order); pos += 2; result.m_leaf = (bytes[pos++] == 1); result.m_keyNums = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; for (int i = 0; i < result.m_keyNums; i++) { int length = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_keys[i] = keyFactory.Deserialize(bytes, pos, length); pos += length; } for (int i = 0; i <= result.m_keyNums; i++) { result.m_children[i] = OOD.Utility.Bytes.Unpack4U(bytes, pos); pos += 4; } result.m_dirty = false; return(result); }