1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. private package Resources.Cache is 
  10.  
  11.     -- Returns a Resource_File in the cache, or loads it if it hasn't been 
  12.     -- loaded. If 'needLock' is True, the cache's lock will be taken and 
  13.     -- released. null will be returned on error. 
  14.     function Load( filepath : String; 
  15.                    group    : String; 
  16.                    keep     : Boolean; 
  17.                    needLock : Boolean ) return A_Resource_File; 
  18.     pragma Precondition( filepath'Length > 0 ); 
  19.  
  20.     -- Preloads a file from disk if it hasn't been loaded, starting the 
  21.     -- reference count at 0. If 'needLock' is True, the cache's lock will be 
  22.     -- taken and released. 
  23.     procedure Preload( filepath : String; group : String; needLock : Boolean ); 
  24.  
  25.     -- Releases a reference to a Resource_File in the cache. If all 
  26.     -- references to the resource have been released, the resource made be 
  27.     -- removed from the cache. If 'needLock' is True, the cache's lock will 
  28.     -- be taken and released. 
  29.     procedure Unload( resource : in out A_Resource_File; needLock : Boolean ); 
  30.     pragma Precondition( resource /= null ); 
  31.     pragma Postcondition( resource = null ); 
  32.  
  33. end Resources.Cache;