Beispiel #1
0
        /// <summary>
        /// Creates new structure object with copy of diven data object.
        /// </summary>
        /// <param name="data">The old data.</param>
        /// <returns>
        /// New structure object with copy of diven data object.
        /// </returns>
        public static ISnapshotStructureProxy CreateWithData(TrackingSnapshotStructureContainer data)
        {
            TrackingSnapshotStructureProxy proxy = new TrackingSnapshotStructureProxy(data.Factories);

            proxy.readonlyInstance = data;
            return(proxy);
        }
Beispiel #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 TrackingSnapshotStructureProxy Copy()
        {
            TrackingSnapshotStructureProxy proxy = new TrackingSnapshotStructureProxy(factories);

            proxy.readonlyInstance = this.readonlyInstance;
            return(proxy);
        }
Beispiel #3
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 TrackingSnapshotStructureProxy CreateEmpty(ModularMemoryModelFactories factories)
        {
            TrackingSnapshotStructureProxy proxy = new TrackingSnapshotStructureProxy(factories);

            proxy.snapshotStructure = TrackingSnapshotStructureContainer.CreateEmpty(factories);
            proxy.readonlyInstance  = proxy.snapshotStructure;
            proxy.isReadonly        = false;
            return(proxy);
        }
Beispiel #4
0
        /// <inheritdoc />
        public ISnapshotStructureProxy CreateNewInstanceWithData(IReadOnlySnapshotStructure oldData)
        {
            TrackingSnapshotStructureContainer data = oldData as TrackingSnapshotStructureContainer;

            if (data != null)
            {
                return(TrackingSnapshotStructureProxy.CreateWithData(data));
            }
            else
            {
                throw new InvalidCastException("Argument is not of type TrackingSnapshotStructureContainer");
            }
        }
Beispiel #5
0
        /// <inheritdoc />
        public ISnapshotStructureProxy CopyInstance(ISnapshotStructureProxy oldData)
        {
            TrackingSnapshotStructureProxy proxy = oldData as TrackingSnapshotStructureProxy;

            if (proxy != null)
            {
                return(proxy.Copy());
            }
            else
            {
                throw new InvalidCastException("Argument is not of type CopySnapshotStructureProxy");
            }
        }
Beispiel #6
0
        /// <summary>
        /// Creates the structure with memory stack with global level only.
        /// </summary>
        /// <param name="factories">The factories.</param>
        /// <returns>
        /// New structure with memory stack with global level only.
        /// </returns>
        public static TrackingSnapshotStructureProxy CreateGlobal(ModularMemoryModelFactories factories)
        {
            TrackingSnapshotStructureProxy proxy = new TrackingSnapshotStructureProxy(factories);

            proxy.snapshotStructure = TrackingSnapshotStructureContainer.CreateEmpty(factories);
            proxy.isReadonly        = false;

            proxy.snapshotStructure.AddStackLevel(Snapshot.GLOBAL_CALL_LEVEL);
            proxy.snapshotStructure.SetLocalStackLevelNumber(Snapshot.GLOBAL_CALL_LEVEL);

            proxy.readonlyInstance = proxy.snapshotStructure;
            return(proxy);
        }
Beispiel #7
0
 /// <inheritdoc />
 public ISnapshotStructureProxy CreateGlobalContextInstance(ModularMemoryModelFactories factories)
 {
     return(TrackingSnapshotStructureProxy.CreateGlobal(factories));
 }
Beispiel #8
0
 /// <inheritdoc />
 public ISnapshotStructureProxy CreateEmptyInstance(ModularMemoryModelFactories factories)
 {
     return(TrackingSnapshotStructureProxy.CreateEmpty(factories));
 }