5#include "../types/gimbal_typedefs.hpp"
6#include "../core/gimbal_api_generators.hpp"
7#include "../types/gimbal_result.hpp"
8#include "../objects/gimbal_context.hpp"
9#include "../meta/gimbal_primitives.h"
10#include "../meta/gimbal_enum.h"
11#include "../meta/gimbal_flags.h"
13#define GBL_TYPE_DECLARE_CPP(cppName, cName)
14 class cppName final: public Type {
16 cppName(void): Type(cName) {}
25 TypeFlags(
unsigned value):
26 TypeFlags(
static_cast<GblTypeFlags>(value)) {}
28 TypeFlags(GblTypeFlags flags=
static_cast<GblTypeFlags>(0)):
29 PrimitiveBase(flags) {}
43 Type(
double) =
delete;
44 Type(
unsigned) =
delete;
46 const char* getName(
void)
const;
47 Type getParentType(
void)
const;
48 Type getFundamentalType(
void)
const;
50 UInt getDepth(
void)
const;
52 bool isValid(
void)
const;
53 bool isClassed(
void)
const;
54 bool isInstantiable(
void)
const;
55 bool isDerivable(
void)
const;
56 bool isDeepDerivable(
void)
const;
57 bool isAbstract(
void)
const;
58 bool isFinal(
void)
const;
59 bool isInterfaced(
void)
const;
60 bool isFundamental(
void)
const;
62 bool isA(
Type base)
const;
63 bool isFundamentallyA(
Type base)
const;
64 RefCount getClassRefCount(
void)
const;
69 void* instanceCreate (
void)
const;
70 void instanceConstruct (
void* pInstance)
const;
71 void instanceDestruct (
void* pInstance)
const;
72 void instanceDestroy (
void* pInstance)
const;
74 void* classReference (
void)
const;
75 void classUnreference (
void* pClass)
const;
78 static Result init(Context* pCtx =
nullptr,
79 Size typeBuiltinInitialCount =0,
80 Size typeTotalInitialCount =0);
81 static Type registerStatic(
Type parentType,
85 static void unregister(
Type type);
87 static Size count(
void);
88 static Type fromName(
const char* pName);
90 static void* instanceCreate (
Type type);
91 static void instanceConstruct (
Type type,
void* pInstance);
92 static void instanceDestruct (
Type type,
void* pInstance);
93 static void instanceDestroy (
Type type,
void* pInstance);
95 static void* classReference (
Type type);
96 static void* classPeek (
Type type);
97 static void classUnreference (
Type type,
void* pClass);
107 using ParentType = P;
109 using InstanceType = I;
112 StaticType(
Type type):
Type(std::move(type)) {}
119 InstanceType* createInstance(
void)
const;
120 void destroyInstance(InstanceType* pInstance)
const;
125 .classSize =
sizeof(C),
126 .instanceSize =
sizeof(I)
129 return Type::registerStatic(P(), pName, info, flags);
156inline Type::Type(
GblType type): PrimitiveBase(type) {}
157inline const char*
Type::getName(
void)
const {
return GblType_name(*
this); }
158inline Type Type::getParentType(
void)
const {
return GblType_parent(*
this); }
159inline UInt
Type::getDepth(
void)
const {
return GblType_depth(*
this); }
160inline Type Type::getFundamentalType(
void)
const {
return GblType_root(*
this); }
161inline const TypeInfo*
Type::getInfo(
void)
const {
return static_cast<
const TypeInfo*>(GblType_info(*
this)); }
162inline bool Type::isA(
Type base)
const {
return GblType_check(*
this, base); }
163inline RefCount
Type::getClassRefCount(
void)
const {
return GblType_classRefCount(*
this); }
175inline void*
Type::instanceCreate (
void)
const {
return Type::instanceCreate(*
this); }
176inline void Type::instanceConstruct (
void* pInstance)
const {
return Type::instanceConstruct(*
this, pInstance); }
177inline void Type::instanceDestruct (
void* pInstance)
const {
Type::instanceDestruct(*
this, pInstance); }
178inline void Type::instanceDestroy (
void* pInstance)
const {
Type::instanceDestroy(*
this, pInstance); }
180inline void*
Type::classReference (
void)
const {
return Type::classReference(*
this); }
181inline void Type::classUnreference (
void* pClass)
const {
return Type::classUnreference(*
this, pClass); }
183inline Result
Type::init(Context* pCtx, Size initialBuiltinCount, Size initialTotalCount) {
184 return GblType_init(pCtx, initialBuiltinCount, initialTotalCount);
192 return GblType_registerStatic(parentType,
198inline void Type::unregister(
Type type) {
199 Exception::checkThrow(GblType_unregister(type));
202inline Type Type::fromName(
const char* pName) {
203 return GblType_fromName(pName);
205inline Size
Type::count(
void) {
206 return GblType_registeredCount();
209inline void*
Type::instanceCreate (
Type type) {
return GblInstance_create(type); }
210inline void Type::instanceConstruct (
Type type,
void* pInstance) { GblInstance_construct(
reinterpret_cast<GblInstance*>(pInstance), type); }
211inline void Type::instanceDestruct (
Type type,
void* pInstance) { GblInstance_destruct(
reinterpret_cast<GblInstance*>(pInstance)); }
212inline void Type::instanceDestroy (
Type type,
void* pInstance) { GblInstance_destroy(
reinterpret_cast<GblInstance*>(pInstance)); }
214inline void*
Type::classReference (
Type type) {
return GblClass_refDefault(type); }
215inline void Type::classUnreference (
Type type,
void* pClass) { GblClass_unrefDefault(
reinterpret_cast<GblClass*>(pClass)); }
#define GBL_TYPE_ROOT_CHECK(type)
#define GBL_TYPE_DEEP_DERIVABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE flag.
#define GBL_TYPE_DERIVABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DERIVABLE flag.
#define GBL_TYPE_INSTANTIABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INSTANTIABLE flag.
#define GBL_TYPE_CLASSED_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_CLASSED flag.
#define GBL_TYPE_FINAL_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_FINAL flag ///<.
#define GBL_TYPE_INTERFACED_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INTERFACED flag.
#define GBL_TYPE_ABSTRACT_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ABSTRACT flag.
#define GBL_INVALID_TYPE
GblType UUID of the invalid type.
#define GBL_TYPE_DECLARE_CPP(cppName, cName)