Esempio n. 1
0
 public virtual dynamic writeReaction(List <RWRequest> requests, RWRequest currentRequest, dynamic cellData)
 {
     if (requests.Count > 1)
     {
         throw new ForbiddenMemoryOperationException();
     }
     return(currentRequest.Data);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 /// <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);
 }
Esempio n. 4
0
 /// <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);
 }
Esempio n. 5
0
 /// <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);
 }
Esempio n. 6
0
 /// <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));
 }
Esempio n. 7
0
 /// <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);
 }
Esempio n. 8
0
 /// <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));
 }
Esempio n. 9
0
 public virtual dynamic readReaction(List <RWRequest> requests, RWRequest currentRequest, dynamic cellData)
 {
     return(cellData);
 }