-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) -- Edit the ORIGNAL .chs file instead! {-# LINE 1 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE TypeSynonymInstances #-} -- This source file is part of HGamer3D -- (A project to enable 3D game development in Haskell) -- For the latest info, see http://www.althainz.de/HGamer3D.html -- -- (c) 2011, 2012 Peter Althainz -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- ClassResourceManager.chs -- module HGamer3D.Bindings.Ogre.ClassResourceManager where import C2HS import Foreign import Foreign.Ptr import Foreign.C import Monad (liftM, liftM2) import HGamer3D.Data.HG3DClass import HGamer3D.Data.Vector import HGamer3D.Data.Colour import HGamer3D.Data.Angle import HGamer3D.Bindings.Ogre.Utils {-# LINE 42 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} import HGamer3D.Bindings.Ogre.ClassPtr {-# LINE 43 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} import HGamer3D.Bindings.Ogre.StructHG3DClass {-# LINE 44 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. -> IO () -- ^ delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 49 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Set a limit on the amount of memory this resource handler may use. If, when asked to load a new resource, the manager believes it will exceed this memory budget, it will temporarily unload a resource to make room for the new one. This unloading is not permanent and the Resource setMemoryBudget :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Int -- ^ bytes -> IO () -- ^ setMemoryBudget a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromIntegral a2} in setMemoryBudget'_ a1' a2' >>= \res -> return () {-# LINE 54 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Get the limit on the amount of memory this resource handler may use. getMemoryBudget :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Int) -- ^ getMemoryBudget a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getMemoryBudget'_ a1' a2' >>= \res -> peekIntConv a2'>>= \a2'' -> return (a2'') {-# LINE 59 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Gets the current memory usage, in bytes. getMemoryUsage :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Int) -- ^ getMemoryUsage a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getMemoryUsage'_ a1' a2' >>= \res -> peekIntConv a2'>>= \a2'' -> return (a2'') {-# LINE 64 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Unloads a single resource by name. Unloaded resources are not removed, they simply free up their memory as much as they can and wait to be reloaded. ResourceGroupManager unload :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> String -- ^ name -> IO () -- ^ unload a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> unload'_ a1' a2' >>= \res -> return () {-# LINE 69 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Unloads all resources. Unloaded resources are not removed, they simply free up their memory as much as they can and wait to be reloaded. ResourceGroupManagerResource::isReloadable unloadAll :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ reloadableOnly - If true (the default), only unload the resource that is reloadable. Because some resources isn't reloadable, they will be unloaded but can't load them later. Thus, you might not want to them unloaded. Or, you might unload all of them, and then populate them manually later. -> IO () -- ^ unloadAll a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in unloadAll'_ a1' a2' >>= \res -> return () {-# LINE 74 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Caused all currently loaded resources to be reloaded. All resources currently being held in this manager which are also marked as currently loaded will be unloaded, then loaded again. Resource::isReloadable reloadAll :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ reloadableOnly - If true (the default), only reload the resource that is reloadable. Because some resources isn't reloadable, they will be unloaded but can't loaded again. Thus, you might not want to them unloaded. Or, you might unload all of them, and then populate them manually later. -> IO () -- ^ reloadAll a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in reloadAll'_ a1' a2' >>= \res -> return () {-# LINE 79 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Unload all resources which are not referenced by any other object. This method behaves like unloadAll, except that it only unloads resources which are not in use, ie not referenced by other objects. This allows you to free up some memory selectively whilst still keeping the group around (and the resources present, just not using much memory). Some referenced resource may exists 'weak' pointer to their sub-components (e.g. Entity unloadUnreferencedResources :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ reloadableOnly - If true (the default), only unloads resources which can be subsequently automatically reloaded. -> IO () -- ^ unloadUnreferencedResources a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in unloadUnreferencedResources'_ a1' a2' >>= \res -> return () {-# LINE 84 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Caused all currently loaded but not referenced by any other object resources to be reloaded. This method behaves like reloadAll, except that it only reloads resources which are not in use, i.e. not referenced by other objects. Some referenced resource may exists 'weak' pointer to their sub-components (e.g. Entity reloadUnreferencedResources :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ reloadableOnly - If true (the default), only reloads resources which can be subsequently automatically reloaded. -> IO () -- ^ reloadUnreferencedResources a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in reloadUnreferencedResources'_ a1' a2' >>= \res -> return () {-# LINE 89 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Remove a single resource by name. Removes a single resource, meaning it will be removed from the list of valid resources in this manager, also causing it to be unloaded. The word 'Destroy' is not used here, since if any other pointers are referring to this resource, it will persist until they have finished with it; however to all intents and purposes it no longer exists and will likely get destroyed imminently. --If you do have shared pointers to resources hanging around after the ResourceManager remove2 :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> String -- ^ name -> IO () -- ^ remove2 a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> remove2'_ a1' a2' >>= \res -> return () {-# LINE 94 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Removes all resources. The word 'Destroy' is not used here, since if any other pointers are referring to these resources, they will persist until they have been finished with; however to all intents and purposes the resources no longer exist and will get destroyed imminently. --If you do have shared pointers to resources hanging around after the ResourceManager removeAll :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ removeAll a1 = withHG3DClass a1 $ \a1' -> removeAll'_ a1' >>= \res -> return () {-# LINE 98 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Remove all resources which are not referenced by any other object. This method behaves like removeAll, except that it only removes resources which are not in use, ie not referenced by other objects. This allows you to free up some memory selectively whilst still keeping the group around (and the resources present, just not using much memory). Some referenced resource may exists 'weak' pointer to their sub-components (e.g. Entity removeUnreferencedResources :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ reloadableOnly - If true (the default), only removes resources which can be subsequently automatically reloaded. -> IO () -- ^ removeUnreferencedResources a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in removeUnreferencedResources'_ a1' a2' >>= \res -> return () {-# LINE 103 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Returns whether the named resource exists in this manager. resourceExists :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> String -- ^ name -> IO (Bool) -- ^ resourceExists a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> alloca $ \a3' -> resourceExists'_ a1' a2' a3' >>= \res -> peekBoolUtil a3'>>= \a3'' -> return (a3'') {-# LINE 109 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Gets the relative loading order of resources of this type. There are dependencies between some kinds of resource in terms of loading order, and this value enumerates that. Higher values load later during bulk loading tasks. getLoadingOrder :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Float) -- ^ getLoadingOrder a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getLoadingOrder'_ a1' a2' >>= \res -> peekFloatConv a2'>>= \a2'' -> return (a2'') {-# LINE 114 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Gets a string identifying the type of resource this manager handles. getResourceType :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (String) -- ^ getResourceType a1 = withHG3DClass a1 $ \a1' -> alloc64k $ \a2' -> getResourceType'_ a1' a2' >>= \res -> peekCString a2'>>= \a2'' -> return (a2'') {-# LINE 119 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Sets whether this manager and its resources habitually produce log output setVerbose :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ v -> IO () -- ^ setVerbose a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in setVerbose'_ a1' a2' >>= \res -> return () {-# LINE 124 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Gets whether this manager and its resources habitually produce log output getVerbose :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ getVerbose a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getVerbose'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 129 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | Destroy a resource pool. destroyResourcePool2 :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> String -- ^ name -> IO () -- ^ destroyResourcePool2 a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> destroyResourcePool2'_ a1' a2' >>= \res -> return () {-# LINE 134 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} -- | destroy all pools destroyAllResourcePools :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ destroyAllResourcePools a1 = withHG3DClass a1 $ \a1' -> destroyAllResourcePools'_ a1' >>= \res -> return () {-# LINE 138 ".\\HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs" #-} foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_destruct" delete'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_setMemoryBudget" setMemoryBudget'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_getMemoryBudget" getMemoryBudget'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_getMemoryUsage" getMemoryUsage'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_unload" unload'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_unloadAll" unloadAll'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_reloadAll" reloadAll'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_unloadUnreferencedResources" unloadUnreferencedResources'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_reloadUnreferencedResources" reloadUnreferencedResources'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_remove2" remove2'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_removeAll" removeAll'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_removeUnreferencedResources" removeUnreferencedResources'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_resourceExists" resourceExists'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> ((Ptr CInt) -> (IO ())))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_getLoadingOrder" getLoadingOrder'_ :: ((HG3DClassPtr) -> ((Ptr CFloat) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_getResourceType" getResourceType'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_setVerbose" setVerbose'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_getVerbose" getVerbose'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_destroyResourcePool2" destroyResourcePool2'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResourceManager.chs.h ogre_rsrcmgr_destroyAllResourcePools" destroyAllResourcePools'_ :: ((HG3DClassPtr) -> (IO ()))