The Nebula Device 3: Resources::PoolResourceMapper Class Reference

The Nebula Device 3

Resources::PoolResourceMapper Class Reference

#include <poolresourcemapper.h>


Detailed Description

Base-interface for all ResourceCaches using a pool-construct.

(C) 2010 Radon Labs GmbH

Public Member Functions

 PoolResourceMapper (void)
 constructor
 ~PoolResourceMapper (void)
 destructor
void SetResourceCreatorClass (const Core::Rtti &creatorType)
 sets the default loader class
void SetDefaultPoolScheduler (const Ptr< PoolScheduler > &scheduler)
 set default scheduler for pools
virtual void SetupPools (const Util::Dictionary< Util::StringAtom, PoolSetupInfo > &poolSetupData)
 creates and initializes pools using given information
virtual void OnAttachToResourceManager ()
 called from resource manager when mapper is attached
virtual void OnRemoveFromResourceManager ()
 called from resource manager when mapper is removed
virtual void OnPrepare (bool waiting)
 called before gathering render stats - updates frameIndex of all pools
virtual void Reset ()
 resets all resource-connections and restores initial-state (keeps pools initialized)
virtual uint GetAllocatedMemory ()
 returns allocated resource space of all pools in bytes
virtual uint GetUsedMemory ()
 returns used memory of all pools in bytes
virtual void WritePoolsToXML (const IO::URI &fileName)
 writes info of all pools to given XML file
SizeT GetNumPools () const
 returns pool count
const Ptr< ResourcePool > & GetPoolForDebug (const Util::StringAtom &poolId) const
 returns Ptr to pool for given index (may exclusively be called by debug pagehandler!)

Static Public Member Functions

static void ReadTexturePoolFromXML (const IO::URI &fileName, Util::Dictionary< Util::StringAtom, PoolSetupInfo > &setupData)
 read given file name and fill given dictionary with data
static void WriteTexturePoolToXML (const IO::URI &fileName, const Util::Dictionary< Util::StringAtom, Resources::PoolSetupInfo > &setupData)
 write given pool data to given file name

Protected Member Functions

IndexT GetFittingPoolIndex (const ResourceInfo *resInfo) const
 returns index of pool which is of given info-type or -1 if no pool found
void NoSlotFound (const Ptr< ManagedResource > &resource, IndexT frameIdx)
 this is called if a resource is requested but no free slot is found for

Member Function Documentation

void Resources::PoolResourceMapper::OnRemoveFromResourceManager (  )  [virtual]

called from resource manager when mapper is removed

unloads all pools, placeholder-resource, ... (shutting down)

void Resources::PoolResourceMapper::WritePoolsToXML ( const IO::URI fileName  )  [virtual]

writes info of all pools to given XML file

Writes infos of all pools to given XML-file.

void Resources::PoolResourceMapper::NoSlotFound ( const Ptr< ManagedResource > &  resource,
IndexT  frameIdx 
) [protected]

this is called if a resource is requested but no free slot is found for

If no free slot is found we may want to do something like trying to find next lower or higher level of detail for the requested resource. Overload this method in subclasses to do things like this.