igor::iFactory Class Referenceabstract

#include <iFactory.h>

Inherited by igor::iAnimationFactory, igor::iMaterialFactory, igor::iModelFactory, igor::iShaderMaterialFactory, igor::iSoundFactory, igor::iSpriteFactory, and igor::iTextureFactory.

Public Member Functions

 iFactory (const iaString &type, const std::vector< iaString > &supportedExtensions)
 
virtual ~iFactory ()=default
 
const iaStringgetType () const
 
const std::vector< iaString > & getSupportedExtensions () const
 

Protected Member Functions

virtual iaString getHashData (const iParameters &parameters) const
 
virtual iResourcePtr createResource (const iParameters &parameters)=0
 
virtual iResourcePtr createResource ()
 
virtual bool loadResource (iResourcePtr resource)=0
 
virtual void unloadResource (iResourcePtr resource)=0
 
virtual bool saveResource (iResourcePtr resource, const iaString &filename="")
 
virtual void init ()
 
virtual void deinit ()
 

Protected Attributes

iaString _type
 
std::vector< iaString_supportedExtensions
 

Friends

class iResourceManager
 

Detailed Description

represents a factory that can process resources

Constructor & Destructor Documentation

◆ iFactory()

igor::iFactory::iFactory ( const iaString type,
const std::vector< iaString > &  supportedExtensions 
)
inline

does nothing

◆ ~iFactory()

virtual igor::iFactory::~iFactory ( )
virtualdefault

does nothing

Member Function Documentation

◆ createResource() [1/2]

virtual iResourcePtr igor::iFactory::createResource ( )
inlineprotectedvirtual

creates an empty resource

Returns
new resource

◆ createResource() [2/2]

virtual iResourcePtr igor::iFactory::createResource ( const iParameters parameters)
protectedpure virtual

creates a resource object

Parameters
namethe name of the resource
parametersthe resource parameters
Returns
new resource

◆ deinit()

virtual void igor::iFactory::deinit ( )
inlineprotectedvirtual

called once before unregistration from resource manager

◆ getHashData()

virtual iaString igor::iFactory::getHashData ( const iParameters parameters) const
inlineprotectedvirtual
Returns
resource type specific hash data based on given parameters
Parameters
parametersthe given parameters

◆ getSupportedExtensions()

const std::vector< iaString > & igor::iFactory::getSupportedExtensions ( ) const
inline
Returns
supported file extensions or subtypes

◆ getType()

const iaString & igor::iFactory::getType ( ) const
inline
Returns
the factory type

this type is used to register with the resource manager

◆ init()

virtual void igor::iFactory::init ( )
inlineprotectedvirtual

called once after registration to resource manager

◆ loadResource()

virtual bool igor::iFactory::loadResource ( iResourcePtr  resource)
protectedpure virtual

loads the resource based on it's parameters

Parameters
resourcethe resource to load
Returns
true if loading the resource was successful

◆ saveResource()

virtual bool igor::iFactory::saveResource ( iResourcePtr  resource,
const iaString filename = "" 
)
inlineprotectedvirtual

exports the resource based on it's parameters

this needs to be a valid resource with a valid source parameter

Parameters
resourcethe resource to save
filenameoptional filename if resource is to be saved in a new location
Returns
true if saving the resource was successful

◆ unloadResource()

virtual void igor::iFactory::unloadResource ( iResourcePtr  resource)
protectedpure virtual

unloads the resource

Parameters
resourcethe resource to unload

Friends And Related Function Documentation

◆ iResourceManager

friend class iResourceManager
friend

Member Data Documentation

◆ _supportedExtensions

std::vector<iaString> igor::iFactory::_supportedExtensions
protected

supported file extensions or subtypes

◆ _type

iaString igor::iFactory::_type
protected

the factory type


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