libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal::Type Class Reference
Inheritance diagram for gimbal::Type:
gimbal::BoolType gimbal::CharType gimbal::DoubleType gimbal::EnumType gimbal::FlagsType gimbal::FloatType gimbal::IVariantType gimbal::Int16Type gimbal::Int32Type gimbal::Int64Type gimbal::InterfaceType gimbal::InvalidType gimbal::NilType gimbal::PointerType gimbal::StaticType< P, C, I > gimbal::StringType gimbal::Uint16Type gimbal::Uint32Type gimbal::Uint64Type gimbal::Uint8Type

Public Member Functions

 Type (GblType type=((GblType) 0))
 
 Type (float)=delete
 
 Type (double)=delete
 
 Type (unsigned)=delete
 
const char * getName (void) const
 
Type getParentType (void) const
 
Type getFundamentalType (void) const
 
const TypeInfogetInfo (void) const
 
UInt getDepth (void) const
 
bool isValid (void) const
 
bool isClassed (void) const
 
bool isInstantiable (void) const
 
bool isDerivable (void) const
 
bool isDeepDerivable (void) const
 
bool isAbstract (void) const
 
bool isFinal (void) const
 
bool isInterfaced (void) const
 
bool isFundamental (void) const
 
bool isA (Type base) const
 
bool isFundamentallyA (Type base) const
 
RefCount getClassRefCount (void) const
 
void * instanceCreate (void) const
 
void instanceConstruct (void *pInstance) const
 
void instanceDestruct (void *pInstance) const
 
void instanceDestroy (void *pInstance) const
 
void * classReference (void) const
 
void classUnreference (void *pClass) const
 

Static Public Member Functions

static Result init (Context *pCtx=nullptr, Size typeBuiltinInitialCount=0, Size typeTotalInitialCount=0)
 
static Type registerStatic (Type parentType, const char *pName, TypeInfo typeInfo, TypeFlags flags)
 
static void unregister (Type type)
 
static Size count (void)
 
static Type fromName (const char *pName)
 
static void * instanceCreate (Type type)
 
static void instanceConstruct (Type type, void *pInstance)
 
static void instanceDestruct (Type type, void *pInstance)
 
static void instanceDestroy (Type type, void *pInstance)
 
static void * classReference (Type type)
 
static void * classPeek (Type type)
 
static void classUnreference (Type type, void *pClass)
 

Detailed Description

Definition at line 38 of file gimbal_type.hpp.

Constructor & Destructor Documentation

◆ Type()

gimbal::Type::Type ( GblType  type = ((GblType)0))
inline

Definition at line 156 of file gimbal_type.hpp.

156: PrimitiveBase(type) {}

Member Function Documentation

◆ getName()

const char * gimbal::Type::getName ( void  ) const
inline

Definition at line 157 of file gimbal_type.hpp.

157{ return GblType_name(*this); }
const char * GblType_name(GblType self)
Returns the type name string associated with the given GblType.

◆ getParentType()

Type gimbal::Type::getParentType ( void  ) const
inline

Definition at line 158 of file gimbal_type.hpp.

158{ return GblType_parent(*this); }
GblType GblType_parent(GblType self)
Returns the given type's parent's GblType or GBL_INVALID_TYPE if it's a root type.

◆ getFundamentalType()

Type gimbal::Type::getFundamentalType ( void  ) const
inline

Definition at line 160 of file gimbal_type.hpp.

160{ return GblType_root(*this); }
GblType GblType_root(GblType self)
Returns the root parent GblType of the given GblType.

◆ getInfo()

const TypeInfo * gimbal::Type::getInfo ( void  ) const
inline

Definition at line 161 of file gimbal_type.hpp.

161{ return static_cast<const TypeInfo*>(GblType_info(*this)); }
const GblTypeInfo * GblType_info(GblType self)
Returns the GblTypeInfo struct for the given type, containing its meta information.

◆ getDepth()

UInt gimbal::Type::getDepth ( void  ) const
inline

Definition at line 159 of file gimbal_type.hpp.

159{ return GblType_depth(*this); }
size_t GblType_depth(GblType self)
Returns the depth of the given GblType, where a depth of 0 means it's a root type.

◆ isValid()

bool gimbal::Type::isValid ( void  ) const
inline

Definition at line 164 of file gimbal_type.hpp.

164{ return *this != GBL_INVALID_TYPE; }
#define GBL_INVALID_TYPE
GblType UUID of the invalid type.
Definition gimbal_type.h:31

◆ isClassed()

bool gimbal::Type::isClassed ( void  ) const
inline

Definition at line 166 of file gimbal_type.hpp.

166{ return GBL_TYPE_CLASSED_CHECK(*this); }
#define GBL_TYPE_CLASSED_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_CLASSED flag.

◆ isInstantiable()

bool gimbal::Type::isInstantiable ( void  ) const
inline

Definition at line 167 of file gimbal_type.hpp.

167{ return GBL_TYPE_INSTANTIABLE_CHECK(*this); }
#define GBL_TYPE_INSTANTIABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INSTANTIABLE flag.

◆ isDerivable()

bool gimbal::Type::isDerivable ( void  ) const
inline

Definition at line 168 of file gimbal_type.hpp.

168{ return GBL_TYPE_DERIVABLE_CHECK(*this); }
#define GBL_TYPE_DERIVABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DERIVABLE flag.

◆ isDeepDerivable()

bool gimbal::Type::isDeepDerivable ( void  ) const
inline

Definition at line 169 of file gimbal_type.hpp.

169{ return GBL_TYPE_DEEP_DERIVABLE_CHECK(*this); }
#define GBL_TYPE_DEEP_DERIVABLE_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE flag.

◆ isAbstract()

bool gimbal::Type::isAbstract ( void  ) const
inline

Definition at line 170 of file gimbal_type.hpp.

170{ return GBL_TYPE_ABSTRACT_CHECK(*this); }
#define GBL_TYPE_ABSTRACT_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ABSTRACT flag.

◆ isFinal()

bool gimbal::Type::isFinal ( void  ) const
inline

Definition at line 171 of file gimbal_type.hpp.

171{ return GBL_TYPE_FINAL_CHECK(*this); }
#define GBL_TYPE_FINAL_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_FINAL flag ///<.

◆ isInterfaced()

bool gimbal::Type::isInterfaced ( void  ) const
inline

Definition at line 172 of file gimbal_type.hpp.

172{ return GBL_TYPE_INTERFACED_CHECK(*this); }
#define GBL_TYPE_INTERFACED_CHECK(type)
Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INTERFACED flag.

◆ isA()

bool gimbal::Type::isA ( Type  base) const
inline

Definition at line 162 of file gimbal_type.hpp.

162{ return GblType_check(*this, base); }
GblBool GblType_check(GblType self, GblType other)
Returns GBL_TRUE if the given type can be safely cast to the other type.

◆ getClassRefCount()

RefCount gimbal::Type::getClassRefCount ( void  ) const
inline

Definition at line 163 of file gimbal_type.hpp.

163{ return GblType_classRefCount(*this); }
GblRefCount GblType_classRefCount(GblType self)
Returns the reference counter for the given GblType's internally-managed default GblClass.

◆ instanceCreate() [1/2]

void * gimbal::Type::instanceCreate ( void  ) const
inline

Definition at line 175 of file gimbal_type.hpp.

175{ return Type::instanceCreate(*this); }

◆ instanceConstruct() [1/2]

void gimbal::Type::instanceConstruct ( void *  pInstance) const
inline

Definition at line 176 of file gimbal_type.hpp.

176{ return Type::instanceConstruct(*this, pInstance); }

◆ instanceDestruct() [1/2]

void gimbal::Type::instanceDestruct ( void *  pInstance) const
inline

Definition at line 177 of file gimbal_type.hpp.

177{ Type::instanceDestruct(*this, pInstance); }

◆ instanceDestroy() [1/2]

void gimbal::Type::instanceDestroy ( void *  pInstance) const
inline

Definition at line 178 of file gimbal_type.hpp.

178{ Type::instanceDestroy(*this, pInstance); }

◆ classReference() [1/2]

void * gimbal::Type::classReference ( void  ) const
inline

Definition at line 180 of file gimbal_type.hpp.

180{ return Type::classReference(*this); }

◆ classUnreference() [1/2]

void gimbal::Type::classUnreference ( void *  pClass) const
inline

Definition at line 181 of file gimbal_type.hpp.

181{ return Type::classUnreference(*this, pClass); }

◆ init()

Result gimbal::Type::init ( Context pCtx = nullptr,
Size  typeBuiltinInitialCount = 0,
Size  typeTotalInitialCount = 0 
)
inlinestatic

Definition at line 183 of file gimbal_type.hpp.

183 {
184 return GblType_init(pCtx, initialBuiltinCount, initialTotalCount);
185}

◆ registerStatic()

Type gimbal::Type::registerStatic ( Type  parentType,
const char *  pName,
TypeInfo  typeInfo,
TypeFlags  flags 
)
inlinestatic

Definition at line 187 of file gimbal_type.hpp.

191{
192 return GblType_registerStatic(parentType,
193 pName,
194 &typeInfo,
195 flags);
196}

◆ unregister()

void gimbal::Type::unregister ( Type  type)
inlinestatic

Definition at line 198 of file gimbal_type.hpp.

198 {
199 Exception::checkThrow(GblType_unregister(type));
200}
GBL_RESULT GblType_unregister(GblType type)
Unregisters a type from the type system. Typically not done, better not be used.

◆ count()

Size gimbal::Type::count ( void  )
inlinestatic

Definition at line 205 of file gimbal_type.hpp.

205 {
206 return GblType_registeredCount();
207}

◆ fromName()

Type gimbal::Type::fromName ( const char *  pName)
inlinestatic

Definition at line 202 of file gimbal_type.hpp.

202 {
203 return GblType_fromName(pName);
204}

◆ instanceCreate() [2/2]

void * gimbal::Type::instanceCreate ( Type  type)
inlinestatic

Definition at line 209 of file gimbal_type.hpp.

209{ return GblInstance_create(type); }
GblInstance * GblInstance_create(GblType type, size_t publicSize, GblClass *pClass)
Creates and returns an instance, optionally with an extended size and/or non-default class.

◆ instanceConstruct() [2/2]

void gimbal::Type::instanceConstruct ( Type  type,
void *  pInstance 
)
inlinestatic

Definition at line 210 of file gimbal_type.hpp.

210{ GblInstance_construct(reinterpret_cast<GblInstance*>(pInstance), type); }
GBL_RESULT GblInstance_construct(GblInstance *pSelf, GblType type, GblClass *pClass)
Constructs an instance, optionally with a non-default class, returning a result code.
Base struct for all instantiable meta types.

◆ instanceDestruct() [2/2]

void gimbal::Type::instanceDestruct ( Type  type,
void *  pInstance 
)
inlinestatic

Definition at line 211 of file gimbal_type.hpp.

211{ GblInstance_destruct(reinterpret_cast<GblInstance*>(pInstance)); }
GblRefCount GblInstance_destruct(GblInstance *pSelf)
Destructs but doesn't deallocate an instance. It must have been created with GblInstance_construct().

◆ instanceDestroy() [2/2]

void gimbal::Type::instanceDestroy ( Type  type,
void *  pInstance 
)
inlinestatic

Definition at line 212 of file gimbal_type.hpp.

212{ GblInstance_destroy(reinterpret_cast<GblInstance*>(pInstance)); }
GblRefCount GblInstance_destroy(GblInstance *pSelf)
Destructs and deallocates an instance. It must have been created with GblInstance_create().

◆ classReference() [2/2]

void * gimbal::Type::classReference ( Type  type)
inlinestatic

Definition at line 214 of file gimbal_type.hpp.

214{ return GblClass_refDefault(type); }
GblClass * GblClass_refDefault(GblType type)
Returns a reference to the default class for type, instantiating it if necessary.

◆ classUnreference() [2/2]

void gimbal::Type::classUnreference ( Type  type,
void *  pClass 
)
inlinestatic

Definition at line 215 of file gimbal_type.hpp.

215{ GblClass_unrefDefault(reinterpret_cast<GblClass*>(pClass)); }
GblRefCount GblClass_unrefDefault(GblClass *pSelf)
Releases a reference to the default version of the given class, possibly freeing it.
Base struct for all type classes.

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