The Nebula Device 3: Resources::LoadingResource Class Reference

The Nebula Device 3

Resources::LoadingResource Class Reference

#include <loadingresource.h>

Inheritance diagram for Resources::LoadingResource:

Core::RefCounted Resources::PoolLoadingResource

Detailed Description

A LoadingResource contains a Resource we want to load and a ManagedResource which may have a pointer towards a Resource we may reuse for loading. ResourceCache keeps an sorted Array of LoadingResources to determine loading-order of requested resources.

(C) 2010 Radon Labs GmbH

Public Member Functions

 LoadingResource ()
 constructor
 ~LoadingResource ()
 destructor
int GetPriority () const
 returns loading-priority-value
const Ptr< ManagedResource > & GetManagedResource () const
 returns ManagedResource
const Ptr< Resource > & GetTargetResource () const
 returns Resource we want to load to
void SetManagedResource (const Ptr< ManagedResource > &managedResource)
 set ManagedResource
void SetTargetResource (const Ptr< Resource > &targetResource)
 set target resource (resource we want to load)
void SetPriority (int priority)
 set the loading-priority
virtual void OnCancelRequest ()
 called as the request is aborted (canceled, aborted, failed, ...)
virtual void OnSuccessRequest ()
 called as the request was performed successfully
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Protected Attributes

Ptr< ManagedResourcemanagedResource
 the managed resource we place on the resource after successful loading
Ptr< ResourcetargetResource
 the resource we want to load

Friends

bool operator< (const LoadingResource &a, const LoadingResource &b)
 less-than operator

Member Function Documentation

void Resources::LoadingResource::OnCancelRequest (  )  [virtual]

called as the request is aborted (canceled, aborted, failed, ...)

Do everything needed in here which has to be performed as a loading request is going to be terminated because it was canceled, aborted, failed and so on.

void Resources::LoadingResource::OnSuccessRequest (  )  [virtual]

called as the request was performed successfully

Do everything needed in here which has to be performed as a loading request is going to be terminated because it was successful and is no longer needed.

Reimplemented in Resources::PoolLoadingResource.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.