Esempio n. 1
0
        /// <summary>
        /// Creates empty structure which contains no data in containers.
        /// </summary>
        /// <param name="factories">The factories.</param>
        /// <returns>
        /// New empty structure which contains no data in containers.
        /// </returns>
        public static SnapshotStructureContainer CreateEmpty(ModularMemoryModelFactories factories)
        {
            SnapshotStructureContainer data = new SnapshotStructureContainer(factories);

            data.memoryStack       = new List <CopyStackContext>();
            data.arrayDescriptors  = factories.StructuralContainersFactories.AssociativeContainerFactory.CreateWriteableAssociativeContainer <AssociativeArray, IArrayDescriptor>();
            data.objectDescriptors = factories.StructuralContainersFactories.AssociativeContainerFactory.CreateWriteableAssociativeContainer <ObjectValue, IObjectDescriptor>();
            data.indexDefinitions  = factories.StructuralContainersFactories.AssociativeContainerFactory.CreateWriteableAssociativeContainer <MemoryIndex, IIndexDefinition>();
            data.functionDecl      = factories.StructuralContainersFactories.DeclarationContainerFactory.CreateWriteableDeclarationContainer <FunctionValue>();
            data.classDecl         = factories.StructuralContainersFactories.DeclarationContainerFactory.CreateWriteableDeclarationContainer <TypeValue>();
            data.callArrays        = factories.StructuralContainersFactories.AssociativeContainerFactory.CreateWriteableAssociativeContainer <AssociativeArray, CopySet <Snapshot> >();

            return(data);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates new structure object as copy of this structure which contains the same data as this instace.
        /// </summary>
        /// <returns>
        /// New copy of this structure which contains the same data as this instace.
        /// </returns>
        public SnapshotStructureContainer Copy()
        {
            SnapshotStructureContainer data = new SnapshotStructureContainer(Factories);

            data.memoryStack = new List <CopyStackContext>();
            foreach (CopyStackContext context in this.memoryStack)
            {
                data.memoryStack.Add(new CopyStackContext(context));
                data.localLevel++;
            }

            data.arrayDescriptors  = this.arrayDescriptors.Copy();
            data.objectDescriptors = this.objectDescriptors.Copy();
            data.indexDefinitions  = this.indexDefinitions.Copy();
            data.functionDecl      = this.functionDecl.Copy();
            data.classDecl         = this.classDecl.Copy();
            data.callArrays        = this.callArrays.Copy();

            return(data);
        }