1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Class.hpp
// Emojicode
//
// Created by Theo Weidmann on 06/02/2017.
// Copyright © 2017 Theo Weidmann. All rights reserved.
//
#ifndef Class_hpp
#define Class_hpp
#include "Engine.hpp"
namespace Emojicode {
struct Class {
Class() {}
explicit Class(void (*mark)(Object *)) : instanceVariableRecords(nullptr), mark(mark), size(0), valueSize(0) {}
/// Returns true if @c a inherits from class @c from
bool inheritsFrom(Class *from) const;
Function **methodsVtable;
Function **initializersVtable;
ProtocolDispatchTable protocolTable;
/** The class’s superclass */
Class *superclass;
ObjectVariableRecord *instanceVariableRecords;
unsigned int instanceVariableRecordsCount;
/** Marker FunctionPointer for GC */
void (*mark)(Object *self) = nullptr;
void (*deinit)(Object *self);
/// The exact size of the object when allocated.
/// Equivalent to @c alignSize(valueSize + size for instance variables + sizeof(Object))
size_t size;
size_t valueSize;
};
}
#endif /* Class_hpp */