Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::SdlClass Class Referenceabstract

#include <SdlClass.h>

Inheritance diagram for ph::SdlClass:
ph::ISdlInstantiable ph::TSdlOwnerClass< Owner, FieldSet >

Public Member Functions

 SdlClass (ESdlTypeCategory category, const std::string &typeName)
 
virtual std::shared_ptr< ISdlResourcecreateResource () const =0
 
virtual void initResource (ISdlResource &resource, SdlInputClauses &clauses, const SdlInputContext &ctx) const =0
 Initialize a resource from value clauses. How the resource will be initialized depends on the resource class's SDL definition.
 
virtual void initDefaultResource (ISdlResource &resource) const =0
 Initialize a resource to default values. Default values are defined by the resource class's SDL definition.
 
virtual void saveResource (const ISdlResource &resource, SdlOutputClauses &clauses, const SdlOutputContext &ctx) const =0
 
virtual void call (std::string_view funcName, ISdlResource *resource, SdlInputClauses &clauses, const SdlInputContext &ctx) const =0
 
virtual void referencedResources (const ISdlResource *targetResource, std::vector< const ISdlResource * > &out_resources) const =0
 Get all SDL resources referenced by targetResource.
 
virtual std::size_t numFunctions () const =0
 
virtual const SdlFunctiongetFunction (std::size_t index) const =0
 
std::size_t numFields () const override=0
 
const SdlFieldgetField (std::size_t index) const override=0
 
std::string_view getTypeName () const override
 
std::string_view getDescription () const override
 
bool isBlueprint () const
 Whether the class is for building other classes only. A blueprint class cannot be instantiated as a SDL resource. Note that blueprint class is semantically different to abstract class; nevertheless, they often are closely related.
 
bool allowCreateFromClass () const
 Whether a resource can be created by calling createResource(). This attribute is useful to decide whether the resource need custom construction routines to create them. A true return value does not mean createResource() always return a valid resource, e.g., a blueprint class or some error occurs.
 
std::string genPrettyName () const
 
std::string genCategoryName () const
 
ESdlTypeCategory getCategory () const
 
std::string_view getDocName () const
 
const SdlClassgetBase () const
 
bool isDerived () const
 
bool hasField () const
 
bool hasFunction () const
 
- Public Member Functions inherited from ph::ISdlInstantiable
virtual ~ISdlInstantiable ()=default
 

Protected Member Functions

SdlClasssetDescription (std::string description)
 
SdlClasssetDocName (std::string docName)
 
template<typename SdlResourceType >
SdlClasssetBase ()
 Set another SDL class as the base of this class.
 
SdlClasssetIsBlueprint (bool isBlueprint)
 
SdlClasssetAllowCreateFromClass (bool allowCreateFromClass)
 

Constructor & Destructor Documentation

◆ SdlClass()

ph::SdlClass::SdlClass ( ESdlTypeCategory category,
const std::string & typeName )

Member Function Documentation

◆ allowCreateFromClass()

bool ph::SdlClass::allowCreateFromClass ( ) const
inline

Whether a resource can be created by calling createResource(). This attribute is useful to decide whether the resource need custom construction routines to create them. A true return value does not mean createResource() always return a valid resource, e.g., a blueprint class or some error occurs.

◆ call()

virtual void ph::SdlClass::call ( std::string_view funcName,
ISdlResource * resource,
SdlInputClauses & clauses,
const SdlInputContext & ctx ) const
pure virtual

◆ createResource()

virtual std::shared_ptr< ISdlResource > ph::SdlClass::createResource ( ) const
pure virtual

◆ genCategoryName()

std::string ph::SdlClass::genCategoryName ( ) const

◆ genPrettyName()

std::string ph::SdlClass::genPrettyName ( ) const

◆ getBase()

const SdlClass * ph::SdlClass::getBase ( ) const
inline

◆ getCategory()

ESdlTypeCategory ph::SdlClass::getCategory ( ) const
inline

◆ getDescription()

std::string_view ph::SdlClass::getDescription ( ) const
inlineoverridevirtual
Returns
A description of this instantiable.

Implements ph::ISdlInstantiable.

◆ getDocName()

std::string_view ph::SdlClass::getDocName ( ) const
inline

◆ getField()

const SdlField * ph::SdlClass::getField ( std::size_t index) const
overridepure virtual
Returns
Field at index. index must <= numFields().

Implements ph::ISdlInstantiable.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ getFunction()

virtual const SdlFunction * ph::SdlClass::getFunction ( std::size_t index) const
pure virtual

◆ getTypeName()

std::string_view ph::SdlClass::getTypeName ( ) const
inlineoverridevirtual
Returns
Type name of this instantiable.

Implements ph::ISdlInstantiable.

◆ hasField()

bool ph::SdlClass::hasField ( ) const
inline

◆ hasFunction()

bool ph::SdlClass::hasFunction ( ) const
inline

◆ initDefaultResource()

virtual void ph::SdlClass::initDefaultResource ( ISdlResource & resource) const
pure virtual

Initialize a resource to default values. Default values are defined by the resource class's SDL definition.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ initResource()

virtual void ph::SdlClass::initResource ( ISdlResource & resource,
SdlInputClauses & clauses,
const SdlInputContext & ctx ) const
pure virtual

Initialize a resource from value clauses. How the resource will be initialized depends on the resource class's SDL definition.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ isBlueprint()

bool ph::SdlClass::isBlueprint ( ) const
inline

Whether the class is for building other classes only. A blueprint class cannot be instantiated as a SDL resource. Note that blueprint class is semantically different to abstract class; nevertheless, they often are closely related.

◆ isDerived()

bool ph::SdlClass::isDerived ( ) const
inline

◆ numFields()

std::size_t ph::SdlClass::numFields ( ) const
overridepure virtual
Returns
Number of fields directly contained in this class. Fields from any associated classes are not accounted for.

Implements ph::ISdlInstantiable.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ numFunctions()

virtual std::size_t ph::SdlClass::numFunctions ( ) const
pure virtual
Returns
Number of functions directly contained in this class. Functions from any associated classes are not accounted for.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ referencedResources()

virtual void ph::SdlClass::referencedResources ( const ISdlResource * targetResource,
std::vector< const ISdlResource * > & out_resources ) const
pure virtual

Get all SDL resources referenced by targetResource.

Parameters
targetResourceResource instance in question.
out_resourcesSDL resources referenced by targetResource. Never contains null. Appends to existing ones.

Implemented in ph::TSdlOwnerClass< Owner, FieldSet >.

◆ saveResource()

virtual void ph::SdlClass::saveResource ( const ISdlResource & resource,
SdlOutputClauses & clauses,
const SdlOutputContext & ctx ) const
pure virtual

◆ setAllowCreateFromClass()

SdlClass & ph::SdlClass::setAllowCreateFromClass ( bool allowCreateFromClass)
protected

◆ setBase()

template<typename SdlResourceType >
SdlClass & ph::SdlClass::setBase ( )
inlineprotected

Set another SDL class as the base of this class.

The effect of the base class depends on the implementation.

◆ setDescription()

SdlClass & ph::SdlClass::setDescription ( std::string description)
protected

◆ setDocName()

SdlClass & ph::SdlClass::setDocName ( std::string docName)
protected

◆ setIsBlueprint()

SdlClass & ph::SdlClass::setIsBlueprint ( bool isBlueprint)
protected

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