Beispiel #1
0
        public override object Get(IStmMemory memoryRef, int[] memoryVersion = null)
        {
            IInnerTransactionStmMemory innerMemoryRef = (IInnerTransactionStmMemory)memoryRef;
            MemoryTuple memoryTuple = GenerateMemoryTuple(innerMemoryRef, memoryVersion);

            if (!memoryChanges.ContainsKey(innerMemoryRef))
            {
                FixMemoryChange(innerMemoryRef, memoryTuple);
            }
            return(memoryTuple.value);
        }
Beispiel #2
0
        public override void Set(IStmMemory memoryRef, object value, int[] memoryVersion = null)
        {
            IInnerTransactionStmMemory innerMemoryRef = (IInnerTransactionStmMemory)memoryRef;
            MemoryTuple memoryTuple = GenerateMemoryTuple(innerMemoryRef, memoryVersion, value);

            FixMemoryChange(innerMemoryRef, memoryTuple);
            if (!memoryRefsToUpdate.Contains(innerMemoryRef))
            {
                memoryRefsToUpdate.Add(innerMemoryRef);
            }
        }
Beispiel #3
0
 private void FixMemoryChange(IInnerTransactionStmMemory memoryRef, MemoryTuple memoryTyple)
 {
     if (memoryChanges.ContainsKey(memoryRef))
     {
         memoryChanges[memoryRef] = memoryTyple.value;
     }
     else
     {
         memoryChanges.Add(memoryRef, memoryTyple.value);
         FixMemoryVersion(memoryRef, memoryTyple);
     }
 }
Beispiel #4
0
 public void FixMemoryVersion(IInnerTransactionStmMemory memoryRef, MemoryTuple memoryTuple)
 {
     lock (subTransactionsLocker)
     {
         if (!memoryStartVersions.ContainsKey(memoryRef))
         {
             memoryStartVersions.Add(memoryRef, memoryTuple.version[imbrication]);
             if (parentTransaction != null)
             {
                 ParentTransaction.FixMemoryVersion(memoryRef, memoryTuple);
             }
         }
     }
 }
        public void Set <T>(StmMemory <T> memoryRef, object value, MemoryTuple <T> memoryTuple = null) where T : struct
        {
            if (memoryTuple == null)
            {
                memoryTuple = MemoryTuple <T> .Get((T)value, memoryRef.Version[Imbrication]);
            }
            baseTransaction.Set(memoryRef, value, memoryTuple);
            string log = baseTransaction.Name + " set value to " + memoryRef.ToString() + " value = " + memoryTuple.value;

            if (baseTransaction.ParentTransaction != null)
            {
                log += " parent value = " + baseTransaction.ParentTransaction.GetMemoryTupleValue <T>(memoryRef).value;
            }
            LogAction(log);
        }
Beispiel #6
0
 private MemoryTuple GenerateMemoryTuple(IInnerTransactionStmMemory memoryRef, int[] memoryVersion, object memoryValue = null)
 {
     int[] currentMemVersion = null;
     if (memoryVersion == null)
     {
         currentMemVersion = memoryRef.Version;
     }
     if (memoryValue == null)
     {
         return(MemoryTuple.Get(GetTransactionMemoryValue(memoryRef), currentMemVersion));
     }
     else
     {
         return(MemoryTuple.Get(memoryValue, currentMemVersion));
     }
 }
 public void FixMemoryVersion <T>(StmMemory <T> memoryRef, MemoryTuple <T> memoryTuple) where T : struct
 {
     baseTransaction.FixMemoryVersion(memoryRef, memoryTuple);
 }