CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
ObjClassInfo Struct Reference

#include <objclass.h>

Data Fields

size_t instsize
 Size in bytes of a class instance.
 
ObjClassInfoparent
 Parent class (NULL if no parent)
 
ObjIfaceclassif
 Class interface (methods specific to this class, optional)
 
ObjIface ** ifimpl
 NULL-terminated array of interface implementations.
 
bool(* init )(void *_self)
 
void(* destroy )(void *_self)
 
bool _abstract
 True if this is an abstract class (cannot be instantiated)
 
intptr(* _cmp )(void *self, void *other, uint32 flags)
 Cached function pointer for Sortable.cmp interface (NULL if not implemented)
 
uint32(* _hash )(void *self, uint32 flags)
 Cached function pointer for Hashable.hash interface (NULL if not implemented)
 
sa_ObjIface _impl
 Storage for hydrated interface implementations.
 
hashtable _tmpl
 Maps interface templates to populated implementations.
 

Detailed Description

Runtime metadata for a class

This structure contains all the information needed to manage a class at runtime, including its size, inheritance relationships, interface implementations, and lifecycle callbacks. One instance exists per class for the lifetime of the program.

The structure is divided into two sections:

  • Static fields: Set by the class implementer during declaration
  • Runtime fields: Populated automatically during first instantiation

Definition at line 45 of file objclass.h.

Field Documentation

◆ destroy

void(* ObjClassInfo::destroy) (void *_self)

Optional destruction callback

Called just before the object's memory is deallocated. Use this to clean up resources, release owned objects, destroy strings, etc. The framework automatically calls parent class destructors after the child destructor.

Definition at line 66 of file objclass.h.

◆ init

bool(* ObjClassInfo::init) (void *_self)

Optional initialization callback

Called at the end of factory functions, after members are initialized but before returning to caller. If init returns false, construction must abort and the factory should return NULL. Useful for validation or common initialization that applies regardless of which factory is used.

Definition at line 59 of file objclass.h.


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