Drag[en]gine Game Engine  1.0
deResourceLoaderTask Class Reference

Resource loader task. More...

#include <deResourceLoaderTask.h>

Public Types

enum  eParentTargetTypes { epttNone, epttSkinPropertyImage, epttSkinPropertyNodeImage }
 Parent target object type. More...
 
enum  eTaskStates {
  etsLoadPending, etsLoadReadFile, etsLoadCreatePeerPending, etsLoadCreatePeer,
  etsLoadSucceeded, etsLoadFailed, etsSavePending, etsSaveWriteFile,
  etsSaveSucceeded, etsSaveFailed
}
 Task states. More...
 

Public Member Functions

Constructors and Destructors
 deResourceLoaderTask (deVirtualFileSystem *vfs, const char *path, int resourceType, deFileResource *resource, eTaskStates state)
 Create task. More...
 
 ~deResourceLoaderTask ()
 Clean up task. More...
 
Management
deVirtualFileSystemGetVFS () const
 Virtual file system. More...
 
const decStringGetPath () const
 path. More...
 
int GetResourceType () const
 Resource type. More...
 
bool Matches (deVirtualFileSystem *vfs, const char *path, int resourceType) const
 Task matches the given path/resourceType. More...
 
eTaskStates GetState () const
 State. More...
 
void SetState (eTaskStates state)
 Set state. More...
 
deResourceLoaderThreadGetThread () const
 Thread. More...
 
void SetThread (deResourceLoaderThread *thread)
 Set thread. More...
 
deFileResourceGetResource () const
 Resource or NULL. More...
 
void SetResource (deFileResource *resource)
 Set resource or NULL. More...
 
void SetStateAndResource (eTaskStates state, deFileResource *resource)
 Set state and resource. More...
 
deResourceLoaderTaskGetParentTask () const
 Parent task or NULL. More...
 
void SetParentTask (deResourceLoaderTask *task)
 Set parent task or NULL. More...
 
void * GetParentTarget () const
 Parent target or NULL. More...
 
void SetParentTarget (void *target)
 Set parent target or NULL. More...
 
eParentTargetTypes GetParentTargetType () const
 Parent target type. More...
 
void SetParentTargetType (eParentTargetTypes type)
 Set parent target type. More...
 
bool GetDelayed () const
 Task is a delayed task. More...
 
void SetDelayed (bool delayed)
 Set if task is a delayed task. More...
 
int GetChildTaskCount () const
 Number of child tasks. More...
 
void IncrementChildTaskCount ()
 Increment child task count by one. More...
 
void DecrementChildTaskCount ()
 Decrement child task count by one. More...
 
bool GetNotifyScriptModule () const
 Notify script module even if this task is not created by it. More...
 
void SetNotifyScriptModule (bool notifyScriptModule)
 Set if script module is notified even if this task is not created by it. More...
 

Detailed Description

Resource loader task.

Manages the loading of a resource. Tasks have various states throughout their livetime. Task in pending state have been queued but no thread has been assigned to them. Tasks in processing state have a thread assigned and are loading the resources. Once finished loading the tasks switches over to the finished state. Tasks in this state are picked up the next time the resource loader checks for updates and the notifiers are called. Afterwards the task is removed. If the loading fails for some reason the task is switched to the failed state and the error is stored. A task is initialized with the path and type of the resource to load. The loaded resources is stored in the task until it is removed.

Member Enumeration Documentation

◆ eParentTargetTypes

Parent target object type.

Enumerator
epttNone 

No parent target.

epttSkinPropertyImage 

Skin property image.

epttSkinPropertyNodeImage 

Skin property node image.

◆ eTaskStates

Task states.

Enumerator
etsLoadPending 

Loading pending.

etsLoadReadFile 

Loading, reading from file.

etsLoadCreatePeerPending 

Loading peer creation pending.

etsLoadCreatePeer 

Loading, create peers.

etsLoadSucceeded 

Loading succeeded, resource ready to be added.

etsLoadFailed 

Loading failed.

etsSavePending 

Saving pending.

etsSaveWriteFile 

Saving, writing to file.

etsSaveSucceeded 

Saving succeeded.

etsSaveFailed 

Saving failed.

Constructor & Destructor Documentation

◆ deResourceLoaderTask()

deResourceLoaderTask::deResourceLoaderTask ( deVirtualFileSystem vfs,
const char *  path,
int  resourceType,
deFileResource resource,
eTaskStates  state 
)

Create task.

◆ ~deResourceLoaderTask()

deResourceLoaderTask::~deResourceLoaderTask ( )

Clean up task.

Member Function Documentation

◆ DecrementChildTaskCount()

void deResourceLoaderTask::DecrementChildTaskCount ( )

Decrement child task count by one.

Referenced by GetChildTaskCount().

◆ GetChildTaskCount()

int deResourceLoaderTask::GetChildTaskCount ( ) const
inline

Number of child tasks.

References DecrementChildTaskCount(), and IncrementChildTaskCount().

◆ GetDelayed()

bool deResourceLoaderTask::GetDelayed ( ) const
inline

Task is a delayed task.

References SetDelayed().

◆ GetNotifyScriptModule()

bool deResourceLoaderTask::GetNotifyScriptModule ( ) const
inline

Notify script module even if this task is not created by it.

References SetNotifyScriptModule().

◆ GetParentTarget()

void* deResourceLoaderTask::GetParentTarget ( ) const
inline

Parent target or NULL.

References SetParentTarget().

◆ GetParentTargetType()

eParentTargetTypes deResourceLoaderTask::GetParentTargetType ( ) const
inline

Parent target type.

References SetParentTargetType().

◆ GetParentTask()

deResourceLoaderTask* deResourceLoaderTask::GetParentTask ( ) const
inline

Parent task or NULL.

References SetParentTask().

◆ GetPath()

const decString& deResourceLoaderTask::GetPath ( ) const
inline

path.

◆ GetResource()

deFileResource* deResourceLoaderTask::GetResource ( ) const

Resource or NULL.

Referenced by GetThread().

◆ GetResourceType()

int deResourceLoaderTask::GetResourceType ( ) const
inline

Resource type.

References GetState(), Matches(), and SetState().

◆ GetState()

eTaskStates deResourceLoaderTask::GetState ( ) const

State.

Referenced by GetResourceType().

◆ GetThread()

deResourceLoaderThread* deResourceLoaderTask::GetThread ( ) const
inline

◆ GetVFS()

deVirtualFileSystem* deResourceLoaderTask::GetVFS ( ) const
inline

Virtual file system.

◆ IncrementChildTaskCount()

void deResourceLoaderTask::IncrementChildTaskCount ( )

Increment child task count by one.

Referenced by GetChildTaskCount().

◆ Matches()

bool deResourceLoaderTask::Matches ( deVirtualFileSystem vfs,
const char *  path,
int  resourceType 
) const

Task matches the given path/resourceType.

Referenced by GetResourceType().

◆ SetDelayed()

void deResourceLoaderTask::SetDelayed ( bool  delayed)

Set if task is a delayed task.

Referenced by GetDelayed().

◆ SetNotifyScriptModule()

void deResourceLoaderTask::SetNotifyScriptModule ( bool  notifyScriptModule)

Set if script module is notified even if this task is not created by it.

Referenced by GetNotifyScriptModule().

◆ SetParentTarget()

void deResourceLoaderTask::SetParentTarget ( void *  target)

Set parent target or NULL.

Referenced by GetParentTarget().

◆ SetParentTargetType()

void deResourceLoaderTask::SetParentTargetType ( eParentTargetTypes  type)

Set parent target type.

Referenced by GetParentTargetType().

◆ SetParentTask()

void deResourceLoaderTask::SetParentTask ( deResourceLoaderTask task)

Set parent task or NULL.

Referenced by GetParentTask().

◆ SetResource()

void deResourceLoaderTask::SetResource ( deFileResource resource)

Set resource or NULL.

Referenced by GetThread().

◆ SetState()

void deResourceLoaderTask::SetState ( eTaskStates  state)

Set state.

Referenced by GetResourceType().

◆ SetStateAndResource()

void deResourceLoaderTask::SetStateAndResource ( eTaskStates  state,
deFileResource resource 
)

Set state and resource.

Referenced by GetThread().

◆ SetThread()

void deResourceLoaderTask::SetThread ( deResourceLoaderThread thread)

Set thread.

Referenced by GetThread().


The documentation for this class was generated from the following file: