public bool Insert(string className, string[] fields, uint topNodeSId, ref uint assignedCId) { if (m_name_cache.ContainsKey(className)) { return(false); } //no duplicates allowed. if (Search(className) != null) { return(false); } assignedCId = m_next_cid++; KCatalog key = new KCatalog(className); DCatalog data = new DCatalog(assignedCId, fields, topNodeSId); key.ClassInfo = data; bool succeed = m_tree.Insert(key); if (succeed) { _put_in_cache(assignedCId, className, fields, topNodeSId); } return(succeed); }
public IData Deserialize(byte[] bytes, int offset, int count) { int pos = offset; DCatalog result = new DCatalog(); result.m_topNodeSId = OOD.Utility.Bytes.Unpack4U(bytes, pos); pos += 4; result.m_cid = OOD.Utility.Bytes.Unpack4U(bytes, pos); pos += 4; int fNum = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_fields = new string[fNum]; for (int i = 0; i < fNum; i++) { int len = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_fields[i] = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len); pos += len; } Debug.Assert(pos == offset + count); return(result); }
public IKey Deserialize(byte[] bytes, int offset, int count) { int pos = offset; KCatalog result = new KCatalog(); short len = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_className = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len); pos += len; if (count > len + 2) { DCatalog catFactory = new DCatalog(); result.m_info = (DCatalog)catFactory.Deserialize(bytes, pos, count - len - 2); } return(result); }
public bool Insert(string className, string[] fields, uint topNodeSId, ref uint assignedCId) { if (m_name_cache.ContainsKey(className)) return false; //no duplicates allowed. if (Search(className) != null) return false; assignedCId = m_next_cid++; KCatalog key = new KCatalog(className); DCatalog data = new DCatalog(assignedCId, fields, topNodeSId); key.ClassInfo = data; bool succeed = m_tree.Insert(key); if (succeed) _put_in_cache(assignedCId, className, fields, topNodeSId); return succeed; }
public IData Deserialize(byte[] bytes, int offset, int count) { int pos = offset; DCatalog result = new DCatalog(); result.m_topNodeSId = OOD.Utility.Bytes.Unpack4U(bytes, pos); pos += 4; result.m_cid = OOD.Utility.Bytes.Unpack4U(bytes, pos); pos += 4; int fNum = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_fields = new string[fNum]; for (int i=0; i<fNum; i++) { int len = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_fields[i] = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len); pos += len; } Debug.Assert(pos == offset + count); return result; }
public IKey Deserialize(byte[] bytes, int offset, int count) { int pos = offset; KCatalog result = new KCatalog(); short len = OOD.Utility.Bytes.Unpack2(bytes, pos); pos += 2; result.m_className = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len); pos += len; if (count > len + 2) { DCatalog catFactory = new DCatalog(); result.m_info = (DCatalog)catFactory.Deserialize(bytes, pos, count - len - 2); } return result; }