Пример #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 TrackingSnapshotStructureContainer CreateEmpty(ModularMemoryModelFactories factories)
        {
            TrackingSnapshotStructureContainer data = new TrackingSnapshotStructureContainer(factories);

            data.memoryStack       = new LazyDeepCopyDictionary <int, IWriteableStackContext>();
            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);
        }
Пример #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 TrackingSnapshotStructureContainer Copy()
        {
            TrackingSnapshotStructureContainer data = new TrackingSnapshotStructureContainer(Factories);

            data.memoryStack = new LazyDeepCopyDictionary <int, IWriteableStackContext>(this.memoryStack);
            data.localLevel  = this.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();

            data.changeTracker = new ChangeTracker <IReadOnlySnapshotStructure>(data.StructureId, data, this.changeTracker);

            return(data);
        }