/// <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); }
/// <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); }
/// <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); }
/// <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"); } }
/// <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"); } }
/// <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); }
/// <inheritdoc /> public ISnapshotStructureProxy CreateGlobalContextInstance(ModularMemoryModelFactories factories) { return(TrackingSnapshotStructureProxy.CreateGlobal(factories)); }
/// <inheritdoc /> public ISnapshotStructureProxy CreateEmptyInstance(ModularMemoryModelFactories factories) { return(TrackingSnapshotStructureProxy.CreateEmpty(factories)); }