Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TSdlOwnerStruct.h
Go to the documentation of this file.
1#pragma once
2
4#include "SDL/sdl_fwd.h"
7
8#include <cstddef>
9#include <string>
10
11namespace ph
12{
13
16template<typename StructType>
18{
19public:
20 using OwnerType = StructType;
21
22public:
23 explicit TSdlOwnerStruct(std::string name);
24
25 void initObject(
27 SdlInputClauses& clauses,
28 const SdlInputContext& ctx) const override;
29
30 void initDefaultObject(AnyNonConstPtr obj) const override;
31
32 void saveObject(
33 AnyConstPtr obj,
34 SdlOutputClauses& clauses,
35 const SdlOutputContext& ctx) const override;
36
38 AnyConstPtr obj,
39 std::vector<const ISdlResource*>& out_resources) const override;
40
43 void initDefaultStruct(StructType& structObj) const;
44
45 std::size_t numFields() const override;
46 const SdlField* getField(std::size_t index) const override;
47
48 template<typename T>
50
51 template<typename StructObjType>
52 TSdlOwnerStruct& addStruct(StructObjType StructType::* structObjPtr);
53
54 template<typename StructObjType>
56 StructObjType StructType::* structObjPtr,
57 const SdlStructFieldStump& structFieldStump);
58
59 auto getFields() const -> const TSdlBruteForceFieldSet<TSdlOwnedField<StructType>>&;
60
61 TSdlOwnerStruct& description(std::string descriptionStr);
62
63private:
67 void setFieldsToDefaults(StructType& structObj) const;
68
69 TSdlBruteForceFieldSet<TSdlOwnedField<StructType>> m_fields;
70};
71
72}// end namespace ph
73
74#include "SDL/Introspect/TSdlOwnerStruct.ipp"
Definition SdlField.h:19
Container for input clauses.
Definition SdlInputClauses.h:18
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Definition SdlOutputClauses.h:14
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Definition SdlStructFieldStump.h:12
Definition SdlStruct.h:25
A set of fields, with basic functionalities.
Definition TSdlBruteForceFieldSet.h:32
Abstraction for a value that is owned by some owner type. Governs how a field should be initialized o...
Definition TSdlOwnedField.h:15
SDL binding type for a typical C++ struct.
Definition TSdlOwnerStruct.h:18
void saveObject(AnyConstPtr obj, SdlOutputClauses &clauses, const SdlOutputContext &ctx) const override
Definition TSdlOwnerStruct.ipp:71
StructType OwnerType
Definition TSdlOwnerStruct.h:20
TSdlOwnerStruct & addStruct(StructObjType StructType::*structObjPtr)
void referencedResources(AnyConstPtr obj, std::vector< const ISdlResource * > &out_resources) const override
Get all SDL resources referenced by obj.
Definition TSdlOwnerStruct.ipp:90
TSdlOwnerStruct & addStruct(StructObjType StructType::*structObjPtr, const SdlStructFieldStump &structFieldStump)
void initObject(AnyNonConstPtr obj, SdlInputClauses &clauses, const SdlInputContext &ctx) const override
Initialize a struct object from value clauses. How the object will be initialized depends on the stru...
Definition TSdlOwnerStruct.ipp:27
std::size_t numFields() const override
Definition TSdlOwnerStruct.ipp:158
TSdlOwnerStruct & description(std::string descriptionStr)
Definition TSdlOwnerStruct.ipp:177
void initDefaultObject(AnyNonConstPtr obj) const override
Initialize a struct object to default values. Default values are defined by the struct's SDL definiti...
Definition TSdlOwnerStruct.ipp:57
auto getFields() const -> const TSdlBruteForceFieldSet< TSdlOwnedField< StructType > > &
Definition TSdlOwnerStruct.ipp:170
void initDefaultStruct(StructType &structObj) const
Initialize the struct object to default values.
Definition TSdlOwnerStruct.ipp:152
TSdlOwnerStruct(std::string name)
Definition TSdlOwnerStruct.ipp:19
const SdlField * getField(std::size_t index) const override
Definition TSdlOwnerStruct.ipp:164
TSdlOwnerStruct & addField(T sdlField)
The root for all renderer implementations.
Definition EEngineProject.h:6
Definition TAABB2D.h:96