Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
Macros | Functions | Variables
Null.c File Reference
#include <assert.h>
#include "Null.h"

Go to the source code of this file.

Macros

#define _Class   _Null
 

Functions

Class_Null (void)
 
static Objectcopy (const Object *self)
 
static void destroy (Class *clazz)
 
static void initialize (Class *clazz)
 
static Nullnull (void)
 

Variables

static Null_null
 

Macro Definition Documentation

◆ _Class

#define _Class   _Null

Definition at line 28 of file Null.c.

Function Documentation

◆ _Null()

Class * _Null ( void  )

Definition at line 83 of file Null.c.

83 {
84 static Class *clazz;
85 static Once once;
86
87 do_once(&once, {
88 clazz = _initialize(&(const ClassDef) {
89 .name = "Null",
90 .superclass = _Object(),
91 .instanceSize = sizeof(Null),
92 .interfaceOffset = offsetof(Null, interface),
93 .interfaceSize = sizeof(NullInterface),
96 });
97 });
98
99 return clazz;
100}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition: Class.c:91
static void destroy(Class *clazz)
Definition: Null.c:74
static void initialize(Class *clazz)
Definition: Null.c:64
long Once
The Once type.
Definition: Once.h:37
#define do_once(once, block)
Executes the given block at most one time.
Definition: Once.h:43
ClassDefs are passed to _initialize via an archetype to initialize a Class.
Definition: Class.h:41
The runtime representation of a Class.
Definition: Class.h:95
The Null sentinel.
Definition: Null.h:42
Class * _Object(void)
The Object archetype.
Definition: Object.c:136

◆ copy()

static Object * copy ( const Object self)
static
See also
Object::copy(const Object *)

Definition at line 35 of file Null.c.

35 {
36
37 return (Object *) self;
38}
Object is the root Class of The Objectively Class hierarchy.
Definition: Object.h:46

◆ destroy()

static void destroy ( Class clazz)
static
See also
Class::destroy(Class *)

Definition at line 74 of file Null.c.

74 {
75
77}
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
Definition: Class.c:196
static Null * _null
Definition: Null.c:42

◆ initialize()

static void initialize ( Class clazz)
static
See also
Class::initialize(Class *)

Definition at line 64 of file Null.c.

64 {
65
66 ((ObjectInterface *) clazz->interface)->copy = copy;
67
68 ((NullInterface *) clazz->interface)->null = null;
69}
ident interface
The interface of the Class.
Definition: Class.h:105
Null * null(void)
Definition: Null.c:48
Object * copy(const Object *self)
Creates a shallow copy of this Object.
Definition: Array.c:40

◆ null()

static Null * null ( void  )
static

Definition at line 48 of file Null.c.

48 {
49
50 static Once once;
51
52 do_once(&once, {
53 _null = (Null *) $((Object *) alloc(Null), init);
54 });
55
56 return _null;
57}
#define alloc(type)
Allocate and initialize and instance of type.
Definition: Class.h:159
Condition * init(Condition *self)
Initializes this Condition.
Definition: Condition.c:67

Variable Documentation

◆ _null

Null* _null
static

Definition at line 42 of file Null.c.