public void Dispose()
 {
     if (this.cacheAccessor != null)
     {
         this.cacheAccessor.Dispose();
         this.cacheAccessor = null;
     }
 }
Exemplo n.º 2
0
 IClousotCache IClousotCacheFactory.Create(IClousotCacheOptions options)
 {
     if (existing == null)
     {
         var memCache = new MemClousotCacheFactory().Create(options);
         this.existing = new UndisposableCacheDataAccessor(memCache);
     }
     return(this.existing);
 }
 /// <summary>
 /// Must be called only once !
 /// </summary>
 public static void SetWitness(this IClousotCache @this, Outcome outcome, Witness witness, BijectiveMap <Subroutine, int> subroutineLocalIds)
 {
     if (@outcome.OutcomeContexts.Any())
     {
         throw new InvalidOperationException();
     }
     @outcome.ProofOutcome = witness.Outcome;
     @outcome.WarningType  = witness.Warning;
     @this.SetAPC(outcome, witness.PC, subroutineLocalIds);
     foreach (var c in witness.Context)
     {
         @this.AddNewOutcomeContext(outcome, c);
     }
 }
        /// <summary>
        /// Must be called only once !
        /// </summary>
        public static void SetAPC(this IClousotCache @this, OutcomeOrSuggestion that, APC apc, BijectiveMap <Subroutine, int> subroutineLocalIds)
        {
            if (@that.ContextEdges.Any())
            {
                throw new InvalidOperationException();
            }
            @that.SubroutineLocalId = subroutineLocalIds[apc.Block.Subroutine];
            @that.BlockIndex        = apc.Block.Index;
            @that.ApcIndex          = apc.Index;
            int rank = 0;

            foreach (var edge in apc.SubroutineContext.GetEnumerable())
            {
                var added = @this.AddNewContextEdge(that, rank);
                added.SetContextEdge(subroutineLocalIds, edge);
                rank++;
            }
        }
 public virtual IClousotCache Create(IClousotCacheOptions options)
 {
     if (this.cacheAccessor == null) // avoids locking if not necessary
     {
         lock (this.LockCacheAccessor)
             if (this.cacheAccessor == null)
             {
                 foreach (var factory in this.cacheDataAccessorFactories)
                 {
                     this.cacheAccessor = factory.Create(options);
                     //test the db connection
                     if (this.cacheAccessor != null && this.cacheAccessor.TestCache())
                     {
                         break;
                     }
                     this.cacheAccessor = null;
                 }
             }
     }
     return(new UndisposableCacheDataAccessor(this.cacheAccessor));
 }
Exemplo n.º 6
0
 public UndisposableCacheDataAccessor(IClousotCache underlying)
 {
     Contract.Requires(underlying != null);
     this.underlying = underlying;
 }
 public UndisposableCacheDataAccessor(IClousotCache underlying)
 {
   Contract.Requires(underlying != null);
   this.underlying = underlying;
 }
 IClousotCache IClousotCacheFactory.Create(IClousotCacheOptions options)
 {
   if (existing == null)
   {
     var memCache = new MemClousotCacheFactory().Create(options);
     this.existing = new UndisposableCacheDataAccessor(memCache);
   }
   return this.existing;
 }