ork::ResourceFactory Class Reference
[resource]

A Resource factory, creates resources from ResourceDescriptor. More...

#include <ResourceFactory.h>

List of all members.

Classes

class  Type
 A utility template to automate the registration of new resource types. More...

Public Types

typedef ptr< Object >(* createFunc )(ptr< ResourceManager > manager, const string &name, ptr< ResourceDescriptor > desc, const TiXmlElement *e)
 A function that creates a Resource from a ResourceDescriptor.

Public Member Functions

void addType (const string &type, createFunc f)
 Registers a new resource type with this factory.
ptr< Objectcreate (ptr< ResourceManager > manager, const string &name, ptr< ResourceDescriptor > desc, const TiXmlElement *e=NULL)
 Creates a Resource from the given ResourceDescriptor.

Static Public Member Functions

static ResourceFactorygetInstance ()
 Returns the unique instance of this class.

Detailed Description

A Resource factory, creates resources from ResourceDescriptor.

There is only one instance of this class, which registers a creation function for each resource type name.


Member Typedef Documentation

typedef ptr<Object>(* ork::ResourceFactory::createFunc)(ptr< ResourceManager > manager, const string &name, ptr< ResourceDescriptor > desc, const TiXmlElement *e)

A function that creates a Resource from a ResourceDescriptor.

Parameters:
manager the manager that will manage the created resource.
name the resource name.
desc the resource descriptor.
e an optional XML element providing contextual information (such as the XML element in which the resource descriptor was found).
Returns:
the created resource.

Member Function Documentation

void ork::ResourceFactory::addType ( const string &  type,
createFunc  f 
)

Registers a new resource type with this factory.

Parameters:
type a resource type, as it appears in the tag of a ResourceDescriptor (e.g. texture1D, texture2D, shader, program, etc).
f a function that can create resources of this type.
ptr<Object> ork::ResourceFactory::create ( ptr< ResourceManager manager,
const string &  name,
ptr< ResourceDescriptor desc,
const TiXmlElement *  e = NULL 
)

Creates a Resource from the given ResourceDescriptor.

Parameters:
manager the manager that will manage the created resource.
name the resoure name.
desc the resource descriptor.
e an optional XML element providing contextual information (such as the XML element in which the resource descriptor was found).
Returns:
the created resource.
static ResourceFactory* ork::ResourceFactory::getInstance (  )  [static]

Returns the unique instance of this class.


Generated on Mon Oct 18 09:36:11 2010 for ork by  doxygen 1.6.1