parcel | Clownfish |
class variable | CFISH_CLASS |
struct symbol | cfish_Class |
class nickname | cfish_Class |
header file | Clownfish/Class.h |
Clownfish::Class – Class.
Classes are first-class objects in Clownfish. Class objects are instances of Clownfish::Class.
cfish_Class*
cfish_Class_singleton(
cfish_String *class_name,
cfish_Class *parent
);
Return a singleton. If a Class can be found in the registry based on
the supplied class name, it will be returned. Otherwise, a new Class
will be created using parent
as a base.
If parent
is NULL, an attempt will be made to find it. If the
attempt fails, an error will result.
cfish_Class*
cfish_Class_fetch_class(
cfish_String *class_name
);
Find a registered class. May return NULL if the class is not registered.
void
cfish_Class_Override(
cfish_Class *self,
cfish_method_t method_ptr,
uint32_t offset
);
Replace a function pointer in the Class’s vtable.
cfish_Obj* // incremented
cfish_Class_Make_Obj(
cfish_Class *self
);
Create an empty object of the type defined by the Class: allocate, assign its class and give it an initial refcount of 1. The caller is responsible for initialization.
cfish_Obj* // incremented
cfish_Class_Init_Obj(
cfish_Class *self,
void *allocation
);
Take a raw memory allocation which is presumed to be of adequate size, assign its class and give it an initial refcount of 1.
cfish_String*
cfish_Class_Get_Name(
cfish_Class *self
);
Return the name of the class.
cfish_Class*
cfish_Class_Get_Parent(
cfish_Class *self
);
Return the parent class, or NULL for a root of the class hierarchy.
uint32_t
cfish_Class_Get_Obj_Alloc_Size(
cfish_Class *self
);
Return the number of bytes needed to hold an instance of the class.
Clownfish::Class is a Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.