Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::TSdlOwnerClass< Owner, FieldSet > Class Template Reference

SDL binding type for a canonical SDL resource class. More...

#include <TSdlOwnerClass.h>

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

Public Types

using OwnerType = Owner
 

Public Member Functions

 TSdlOwnerClass (std::string displayName)
 
std::shared_ptr< ISdlResourcecreateResource () const override
 
void initResource (ISdlResource &resource, SdlInputClauses &clauses, const SdlInputContext &ctx) const override
 Initialize a resource from value clauses. How the resource will be initialized depends on the resource class's SDL definition.
 
void initDefaultResource (ISdlResource &resource) const override
 Initialize a resource to default values. Default values are defined by the resource class's SDL definition.
 
void saveResource (const ISdlResource &resource, SdlOutputClauses &clauses, const SdlOutputContext &ctx) const override
 
void call (std::string_view funcName, ISdlResource *resource, SdlInputClauses &clauses, const SdlInputContext &ctx) const override
 
void referencedResources (const ISdlResource *targetResource, std::vector< const ISdlResource * > &out_resources) const override
 Get all SDL resources referenced by targetResource.
 
std::size_t numFields () const override
 
const SdlFieldgetField (std::size_t index) const override
 
std::size_t numFunctions () const override
 
const SdlFunctiongetFunction (std::size_t index) const override
 
void loadFieldsFromSdl (Owner &owner, SdlInputClauses &clauses, const SdlInputContext &ctx) const
 
void saveFieldsToSdl (const Owner &owner, SdlOutputClauses &clauses, const SdlOutputContext &ctx) const
 
const TSdlOwnedField< Owner > * getOwnedField (std::size_t index) const
 
template<typename SdlFieldType >
TSdlOwnerClassaddField (SdlFieldType sdlField)
 
template<typename StructType >
TSdlOwnerClassaddStruct (StructType Owner::*structObjPtr)
 
template<typename StructType >
TSdlOwnerClassaddStruct (StructType Owner::*structObjPtr, const SdlStructFieldStump &structFieldStump)
 
template<typename T >
TSdlOwnerClassaddFunction ()
 Adds a function that can later be called.
 
auto description (std::string descriptionStr) -> TSdlOwnerClass &
 
auto docName (std::string docName) -> TSdlOwnerClass &
 
template<typename T >
auto baseOn () -> TSdlOwnerClass &
 Set another SDL class as the base of this class.
 
auto allowCreateFromClass (bool allowCreateFromClass) -> TSdlOwnerClass &
 
template<typename SdlFieldType >
auto addField (SdlFieldType sdlField) -> TSdlOwnerClass &
 
template<typename StructType >
auto addStruct (StructType Owner::*const structObjPtr) -> TSdlOwnerClass &
 
template<typename StructType >
auto addStruct (StructType Owner::*const structObjPtr, const SdlStructFieldStump &structFieldStump) -> TSdlOwnerClass &
 
template<typename T >
auto addFunction () -> TSdlOwnerClass &
 
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.
 
- Public Member Functions inherited from ph::SdlClass
 SdlClass (ESdlTypeCategory category, const std::string &typeName)
 
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
 

Additional Inherited Members

- Protected Member Functions inherited from ph::SdlClass
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)
 

Detailed Description

template<typename Owner, typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
class ph::TSdlOwnerClass< Owner, FieldSet >

SDL binding type for a canonical SDL resource class.

Member Typedef Documentation

◆ OwnerType

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
using ph::TSdlOwnerClass< Owner, FieldSet >::OwnerType = Owner

Constructor & Destructor Documentation

◆ TSdlOwnerClass()

template<typename Owner , typename FieldSet >
ph::TSdlOwnerClass< Owner, FieldSet >::TSdlOwnerClass ( std::string displayName)
inlineexplicit

Member Function Documentation

◆ addField() [1/2]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename SdlFieldType >
TSdlOwnerClass & ph::TSdlOwnerClass< Owner, FieldSet >::addField ( SdlFieldType sdlField)

◆ addField() [2/2]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename SdlFieldType >
auto ph::TSdlOwnerClass< Owner, FieldSet >::addField ( SdlFieldType sdlField) -> TSdlOwnerClass&
inline

◆ addFunction() [1/2]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename T >
TSdlOwnerClass & ph::TSdlOwnerClass< Owner, FieldSet >::addFunction ( )

Adds a function that can later be called.

◆ addFunction() [2/2]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename T >
auto ph::TSdlOwnerClass< Owner, FieldSet >::addFunction ( ) -> TSdlOwnerClass&
inline

◆ addStruct() [1/4]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename StructType >
auto ph::TSdlOwnerClass< Owner, FieldSet >::addStruct ( StructType Owner::*const structObjPtr) -> TSdlOwnerClass&
inline

◆ addStruct() [2/4]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename StructType >
auto ph::TSdlOwnerClass< Owner, FieldSet >::addStruct ( StructType Owner::*const structObjPtr,
const SdlStructFieldStump & structFieldStump ) -> TSdlOwnerClass&
inline

◆ addStruct() [3/4]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename StructType >
TSdlOwnerClass & ph::TSdlOwnerClass< Owner, FieldSet >::addStruct ( StructType Owner::* structObjPtr)

◆ addStruct() [4/4]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
template<typename StructType >
TSdlOwnerClass & ph::TSdlOwnerClass< Owner, FieldSet >::addStruct ( StructType Owner::* structObjPtr,
const SdlStructFieldStump & structFieldStump )

◆ allowCreateFromClass() [1/2]

template<typename Owner , typename FieldSet = TSdlBruteForceFieldSet<TSdlOwnedField<Owner>>>
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.

◆ allowCreateFromClass() [2/2]

template<typename Owner , typename FieldSet >
auto ph::TSdlOwnerClass< Owner, FieldSet >::allowCreateFromClass ( bool allowCreateFromClass) -> TSdlOwnerClass&

◆ baseOn()

template<typename Owner , typename FieldSet >
template<typename T >
auto ph::TSdlOwnerClass< Owner, FieldSet >::baseOn ( ) -> TSdlOwnerClass&
inline

Set another SDL class as the base of this class.

By default, fields and functions in the base are automatically inherited.

◆ call()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::call ( std::string_view funcName,
ISdlResource * resource,
SdlInputClauses & clauses,
const SdlInputContext & ctx ) const
inlineoverridevirtual

Implements ph::SdlClass.

◆ createResource()

template<typename Owner , typename FieldSet >
std::shared_ptr< ISdlResource > ph::TSdlOwnerClass< Owner, FieldSet >::createResource ( ) const
inlineoverridevirtual

Implements ph::SdlClass.

◆ description()

template<typename Owner , typename FieldSet >
auto ph::TSdlOwnerClass< Owner, FieldSet >::description ( std::string descriptionStr) -> TSdlOwnerClass&
inline

◆ docName()

template<typename Owner , typename FieldSet >
auto ph::TSdlOwnerClass< Owner, FieldSet >::docName ( std::string docName) -> TSdlOwnerClass&
inline

◆ getField()

template<typename Owner , typename FieldSet >
const SdlField * ph::TSdlOwnerClass< Owner, FieldSet >::getField ( std::size_t index) const
inlineoverridevirtual
Returns
Field at index. index must <= numFields().

Implements ph::SdlClass.

◆ getFunction()

template<typename Owner , typename FieldSet >
const SdlFunction * ph::TSdlOwnerClass< Owner, FieldSet >::getFunction ( std::size_t index) const
inlineoverridevirtual

Implements ph::SdlClass.

◆ getOwnedField()

template<typename Owner , typename FieldSet >
const TSdlOwnedField< Owner > * ph::TSdlOwnerClass< Owner, FieldSet >::getOwnedField ( std::size_t index) const
inline

◆ initDefaultResource()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::initDefaultResource ( ISdlResource & resource) const
inlineoverridevirtual

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

Implements ph::SdlClass.

◆ initResource()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::initResource ( ISdlResource & resource,
SdlInputClauses & clauses,
const SdlInputContext & ctx ) const
inlineoverridevirtual

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

Implements ph::SdlClass.

◆ loadFieldsFromSdl()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::loadFieldsFromSdl ( Owner & owner,
SdlInputClauses & clauses,
const SdlInputContext & ctx ) const
inline

Loads only fields in this class. Does not take other indirect fields into account (such as fields in base class).

◆ numFields()

template<typename Owner , typename FieldSet >
std::size_t ph::TSdlOwnerClass< Owner, FieldSet >::numFields ( ) const
inlineoverridevirtual
Returns
Number of fields directly contained in this class. Fields from any associated classes are not accounted for.

Implements ph::SdlClass.

◆ numFunctions()

template<typename Owner , typename FieldSet >
std::size_t ph::TSdlOwnerClass< Owner, FieldSet >::numFunctions ( ) const
inlineoverridevirtual
Returns
Number of functions directly contained in this class. Functions from any associated classes are not accounted for.

Implements ph::SdlClass.

◆ referencedResources()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::referencedResources ( const ISdlResource * targetResource,
std::vector< const ISdlResource * > & out_resources ) const
inlineoverridevirtual

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.

Implements ph::SdlClass.

◆ saveFieldsToSdl()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::saveFieldsToSdl ( const Owner & owner,
SdlOutputClauses & clauses,
const SdlOutputContext & ctx ) const
inline

Saves only fields in this class. Does not take other indirect fields into account (such as fields in base class).

◆ saveResource()

template<typename Owner , typename FieldSet >
void ph::TSdlOwnerClass< Owner, FieldSet >::saveResource ( const ISdlResource & resource,
SdlOutputClauses & clauses,
const SdlOutputContext & ctx ) const
inlineoverridevirtual

Implements ph::SdlClass.


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