Dali 3D User Interface Engine
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
Dali::Internal::ResourceTicket Class Reference

ResourceTicket records the lifetime of a resource loading request. More...

#include <resource-ticket.h>

Inheritance diagram for Dali::Internal::ResourceTicket:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::ResourceTicket:
Collaboration graph
[legend]

Public Member Functions

 ResourceTicket (ResourceTicketLifetimeObserver &observer, unsigned int id, ResourceTypePath &typePath)
 Create a resource request. More...
 
unsigned int GetId () const
 Retrieve the unique ID of the resource request. More...
 
const ResourceTypePathGetTypePath () const
 Retrieve the type and path of the resource request. More...
 
Dali::LoadingState GetLoadingState () const
 Query the state of the resource loading request. More...
 
void AddObserver (ResourceTicketObserver &observer)
 Adds an observer. More...
 
void RemoveObserver (ResourceTicketObserver &observer)
 Removes an observer. More...
 
void LoadingSucceeded ()
 Called when a resource loads successfully. More...
 
void LoadingFailed ()
 Called when a resource fails to load. More...
 
void Loading ()
 Reset state to ResourceLoading. More...
 
void Uploaded ()
 Notification when a resource has been uploaded to GL. More...
 
void StopLifetimeObservation ()
 Called when the ResourceTicketLifetimeObserver is being destroyed. More...
 
- Public Member Functions inherited from Dali::RefObject
void Reference ()
 Increment the object's reference count. More...
 
void Unreference ()
 Decrement the object's reference count. More...
 
int ReferenceCount ()
 Retrieve the object's reference count. More...
 

Protected Member Functions

virtual ~ResourceTicket ()
 A reference counted object may only be deleted by calling Unreference() More...
 
- Protected Member Functions inherited from Dali::RefObject
 RefObject ()
 Default constructor. More...
 
virtual ~RefObject ()
 RefObject is intended as a base class. More...
 
 RefObject (const RefObject &rhs)
 Copy constructor. More...
 
RefObjectoperator= (const RefObject &rhs)
 Assignment operator. More...
 

Private Types

typedef std::vector
< ResourceTicketObserver * > 
ObserverContainer
 
typedef ObserverContainer::iterator ObserverIter
 

Private Member Functions

 ResourceTicket (const ResourceTicket &)
 Undefined copy constructor. More...
 
ResourceTicketoperator= (const ResourceTicket &rhs)
 Undefined assignment operator. More...
 

Private Attributes

ResourceTicketLifetimeObservermLifetimeObserver
 reference to the lifetime-observer; not owned More...
 
unsigned int mId
 
ResourceTypePath mTypePath
 
Dali::LoadingState mLoadingState
 
ObserverContainer mObservers
 

Detailed Description

ResourceTicket records the lifetime of a resource loading request.

When a resource is requested from ResourceClient, you get a ticket. The state of the loading operation, can be observed using the ticket. After the ticket is destroyed, the resource will be discarded.

Multi-threading note: this class should be used in the main thread only i.e. not from within Dali::Integration::Core::Render().

Definition at line 52 of file resource-ticket.h.

Member Typedef Documentation

Definition at line 157 of file resource-ticket.h.

typedef ObserverContainer::iterator Dali::Internal::ResourceTicket::ObserverIter
private

Definition at line 158 of file resource-ticket.h.

Constructor & Destructor Documentation

Dali::Internal::ResourceTicket::ResourceTicket ( ResourceTicketLifetimeObserver observer,
unsigned int  id,
ResourceTypePath typePath 
)

Create a resource request.

This should only be done by the ResourceTicketRegistry.

Parameters
[in]observerThe object which observes ticket lifetimes.
[in]idA unique ID for this ticket (loading request).
[in]typePathThe resource Type & Path pair.

Definition at line 48 of file resource-ticket.cpp.

Dali::Internal::ResourceTicket::~ResourceTicket ( )
protectedvirtual

A reference counted object may only be deleted by calling Unreference()

Definition at line 56 of file resource-ticket.cpp.

References Dali::Internal::Stage::IsInstalled(), mLifetimeObserver, and Dali::Internal::ResourceTicketLifetimeObserver::ResourceTicketDiscarded().

Here is the call graph for this function:

Dali::Internal::ResourceTicket::ResourceTicket ( const ResourceTicket )
private

Undefined copy constructor.

Member Function Documentation

void Dali::Internal::ResourceTicket::AddObserver ( ResourceTicketObserver observer)

Adds an observer.

Parameters
[in]observerThe observer.

Definition at line 66 of file resource-ticket.cpp.

References mObservers.

unsigned int Dali::Internal::ResourceTicket::GetId ( ) const
inline

Retrieve the unique ID of the resource request.

This can be shared with Nodes etc. which will require the resource when rendering.

Returns
The unique ID for this request.

Definition at line 70 of file resource-ticket.h.

References mId.

Referenced by Dali::Internal::ResourceClient::ResourceTicketDiscarded().

Here is the caller graph for this function:

Dali::LoadingState Dali::Internal::ResourceTicket::GetLoadingState ( ) const
inline

Query the state of the resource loading request.

Returns
The state.

Definition at line 82 of file resource-ticket.h.

References mLoadingState.

const ResourceTypePath& Dali::Internal::ResourceTicket::GetTypePath ( ) const
inline

Retrieve the type and path of the resource request.

Returns
The type and path.

Definition at line 76 of file resource-ticket.h.

References mTypePath.

Referenced by Dali::Internal::ResourceClient::ReloadResource(), and Dali::Internal::ResourceClient::ResourceTicketDiscarded().

Here is the caller graph for this function:

void Dali::Internal::ResourceTicket::Loading ( )

Reset state to ResourceLoading.

Definition at line 131 of file resource-ticket.cpp.

References anonymous_namespace{resource-ticket.cpp}::isNULL(), mLoadingState, mObservers, and Dali::ResourceLoading.

Referenced by Dali::Internal::ResourceClient::NotifyLoading().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::ResourceTicket::LoadingFailed ( )

Called when a resource fails to load.

The ResourceTicketObservers will be notified.

Definition at line 106 of file resource-ticket.cpp.

References DALI_ASSERT_DEBUG, anonymous_namespace{resource-ticket.cpp}::isNULL(), mLoadingState, mObservers, Dali::ResourceLoading, and Dali::ResourceLoadingFailed.

Referenced by Dali::Internal::ResourceClient::NotifyLoadingFailed().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::ResourceTicket::LoadingSucceeded ( )

Called when a resource loads successfully.

The ResourceTicketObservers will be notified.

Definition at line 81 of file resource-ticket.cpp.

References DALI_ASSERT_DEBUG, anonymous_namespace{resource-ticket.cpp}::isNULL(), mLoadingState, mObservers, Dali::ResourceLoading, and Dali::ResourceLoadingSucceeded.

Referenced by Dali::Internal::ResourceClient::NotifyLoadingSucceeded().

Here is the call graph for this function:

Here is the caller graph for this function:

ResourceTicket& Dali::Internal::ResourceTicket::operator= ( const ResourceTicket rhs)
private

Undefined assignment operator.

void Dali::Internal::ResourceTicket::RemoveObserver ( ResourceTicketObserver observer)

Removes an observer.

Parameters
[in]observerThe observer.

Definition at line 71 of file resource-ticket.cpp.

References DALI_ASSERT_DEBUG, and mObservers.

void Dali::Internal::ResourceTicket::StopLifetimeObservation ( )

Called when the ResourceTicketLifetimeObserver is being destroyed.

This method should only be called during destruction of the Dali core.

Definition at line 163 of file resource-ticket.cpp.

References mLifetimeObserver.

void Dali::Internal::ResourceTicket::Uploaded ( )

Notification when a resource has been uploaded to GL.

The ResourceTicketObservers will be notified.

Definition at line 142 of file resource-ticket.cpp.

References anonymous_namespace{resource-ticket.cpp}::isNULL(), and mObservers.

Referenced by Dali::Internal::ResourceClient::NotifyUploaded().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

unsigned int Dali::Internal::ResourceTicket::mId
private

Definition at line 150 of file resource-ticket.h.

Referenced by GetId().

ResourceTicketLifetimeObserver* Dali::Internal::ResourceTicket::mLifetimeObserver
private

reference to the lifetime-observer; not owned

Definition at line 148 of file resource-ticket.h.

Referenced by StopLifetimeObservation(), and ~ResourceTicket().

Dali::LoadingState Dali::Internal::ResourceTicket::mLoadingState
private

Definition at line 153 of file resource-ticket.h.

Referenced by GetLoadingState(), Loading(), LoadingFailed(), and LoadingSucceeded().

ObserverContainer Dali::Internal::ResourceTicket::mObservers
private
ResourceTypePath Dali::Internal::ResourceTicket::mTypePath
private

Definition at line 151 of file resource-ticket.h.

Referenced by GetTypePath().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali