public virtual dynamic writeReaction(List <RWRequest> requests, RWRequest currentRequest, dynamic cellData) { if (requests.Count > 1) { throw new ForbiddenMemoryOperationException(); } return(currentRequest.Data); }
public virtual dynamic writeReaction(List <RWRequest> requests, RWRequest currentRequest, dynamic cellData) { if (requests.All(request => request.Data == currentRequest.Data)) { // If all requests are the same we allow them to write return(currentRequest.Data); } // Otherwise data remains unchanged return(cellData); }
/// <summary> /// This method posts a write request to the cell. /// All requests from a cycle are posted before they get to be analyzed. /// </summary> /// <param name="request">Posted request</param> public void PostWriteRequest(RWRequest request) { writeRequests.Add(request); }
/// <summary> /// This method posts a read request to the cell. /// All requests from a cycle are posted before they get to be analyzed. /// </summary> /// <param name="request">Posted request</param> public void PostReadRequest(RWRequest request) { readRequests.Add(request); }
/// <summary> /// This is method for analyzing single write request, after all write requests have been posted. /// </summary> /// <param name="request">Request that will be analyzed</param> public void WriteData(RWRequest request) { writeCount++; data = memoryType.writeReaction(writeRequests, request, this.data); }
/// <summary> /// This method is for analyzing single read request, after all read requests have been posted. /// </summary> /// <param name="request">Request that will be analyzed</param> /// <returns>Result of processing this request (usually it will be data stored in cell)</returns> public dynamic ReadData(RWRequest request) { readCount++; return(memoryType.readReaction(readRequests, request, this.data)); }
/// <summary> /// This method writes data to cell, upon a write request. /// This is performed after all write requests have been posted to cells. /// </summary> /// <param name="request">A write request directed to a specific cell</param> public void WriteData(RWRequest request) { Memory[request.Where.MemoryName][request.Where.Address].WriteData(request); }
/// <summary> /// This method reads data from a cell, upon a read request. /// This is performed after all read requests have been posted to cells /// </summary> /// <param name="request">A read request directed to a specific cell</param> /// <returns>Data returned by cell upon analyzing request</returns> public dynamic ReadData(RWRequest request) { return(Memory[request.Where.MemoryName][request.Where.Address].ReadData(request)); }
public virtual dynamic readReaction(List <RWRequest> requests, RWRequest currentRequest, dynamic cellData) { return(cellData); }