--
-- Copyright (c) 2012 Kevin Wellwood
-- All rights reserved.
--
-- This source code is distributed under the Modified BSD License. For terms and
-- conditions, see license.txt.
--
private package Resources.Cache is
-- Returns a Resource_File in the cache, or loads it if it hasn't been
-- loaded. If 'needLock' is True, the cache's lock will be taken and
-- released. null will be returned on error.
function Load( filepath : String;
group : String;
keep : Boolean;
needLock : Boolean ) return A_Resource_File;
pragma Precondition( filepath'Length > 0 );
-- Preloads a file from disk if it hasn't been loaded, starting the
-- reference count at 0. If 'needLock' is True, the cache's lock will be
-- taken and released.
procedure Preload( filepath : String; group : String; needLock : Boolean );
-- Releases a reference to a Resource_File in the cache. If all
-- references to the resource have been released, the resource made be
-- removed from the cache. If 'needLock' is True, the cache's lock will
-- be taken and released.
procedure Unload( resource : in out A_Resource_File; needLock : Boolean );
pragma Precondition( resource /= null );
pragma Postcondition( resource = null );
end Resources.Cache;