/// <summary> /// Sets the array for specified index. /// </summary> /// <param name="index">The index.</param> /// <param name="arrayValue">The array value.</param> internal void SetArray(MemoryIndex index, AssociativeArray arrayValue) { lockedTest(); IndexData data; if (!IndexData.TryGetValue(index, out data)) { data = new IndexData(null, null, null); } IndexDataBuilder builder = data.Builder(); builder.Array = arrayValue; IndexData[index] = builder.Build(); ArrayDescriptor descriptor; if (TryGetDescriptor(arrayValue, out descriptor)) { if (descriptor.ParentVariable != null) { Arrays[descriptor.ParentVariable.CallLevel].Remove(arrayValue); } } Arrays[index.CallLevel].Add(arrayValue); }
/// <summary> /// Sets objects for given index. /// </summary> /// <param name="index">The index.</param> /// <param name="objects">The objects.</param> internal void SetObjects(MemoryIndex index, ObjectValueContainer objects) { lockedTest(); IndexData data; if (!IndexData.TryGetValue(index, out data)) { data = new IndexData(null, null, null); } IndexDataBuilder builder = data.Builder(); builder.Objects = objects; IndexData[index] = builder.Build(); }
/// <summary> /// Removes the alias from specified index. /// </summary> /// <param name="index">The index.</param> internal void RemoveAlias(MemoryIndex index) { lockedTest(); IndexData data; if (!IndexData.TryGetValue(index, out data)) { data = new IndexData(null, null, null); } IndexDataBuilder builder = data.Builder(); builder.Aliases = null; IndexData[index] = builder.Build(); }
/// <summary> /// Removes the array from specified index. /// </summary> /// <param name="index">The index.</param> /// <param name="arrayValue">The array value.</param> internal void RemoveArray(MemoryIndex index, AssociativeArray arrayValue) { lockedTest(); ArrayDescriptors.Remove(arrayValue); IndexData data; if (!IndexData.TryGetValue(index, out data)) { data = new IndexData(null, null, null); } IndexDataBuilder builder = data.Builder(); builder.Array = null; IndexData[index] = builder.Build(); Arrays[index.CallLevel].Remove(arrayValue); }
/// <summary> /// Initializes a new instance of the <see cref="IndexData"/> class. /// </summary> /// <param name="data">The data.</param> public IndexData(IndexDataBuilder data) { Aliases = data.Aliases; Array = data.Array; Objects = data.Objects; }