gcc: Added mui and oop to list of standard link libraries.
[AROS.git] / test / class.h
blobb34d37456fe73436657d8c85dfa42e55489b928f
1 #ifndef OOPSYS_CLASS_H
2 #define OOPSYS_CLASS_H
4 #ifndef EXEC_TYPES_H
5 # include <exec/types.h>
6 #endif
8 typedef struct IClass
11 /* Array of pointers to methodtables for this class */
12 struct Node ClassNode;
14 IPTR **InterfaceTable;
15 struct IClass **ClassTable;
17 ULONG InstOffset;
18 ULONG InstSize;
20 /* The number of methods that are new for this class */
21 ULONG NumMethods;
23 ULONG SubClassCount;
24 ULONG ObjectCount;
26 /* Can also be gotten with indexing the ClassTable */
27 struct IClass *SuperClass;
29 /* What level in the hierarchy are we ? */
30 ULONG SuperCount;
32 } Class;
34 typedef APTR Object;
35 struct _Object
37 Class *Class;
40 /* Used when initializing a class */
41 struct MTabDescr
43 APTR *Table;
44 ULONG NumMethods;
48 /* Macros */
49 #define BASEOBJECT(obj) ((Object *)(_OBJ(obj) + 1))
50 #define _OBJECT(obj) (_OBJ(obj) - 1)
51 #define _OBJ(obj) ((struct _Object *)(obj))
53 #define INST_DATA(obj, cl_level) \
54 (((VOID *)(obj)) + _OBJECT(obj)->Class->ClassTable[(cl_level)]->InstOffset)
56 #define CL_INTERFACE(cl, cl_level, if_level) \
57 ((cl)->ClassTable[(cl_level)]->InterfaceTable[(if_level)])
59 #define OBJ_INTERFACE(o, cl_level, if_level) \
60 (_OBJECT(o)->Class->ClassTable[(cl_level)]->InterfaceTable[(if_level)])
62 #define ROOTCLASSNAME "rootclass"
64 #define CL_Level_Root 0UL /* Root is on top of hierachy */
65 #define IF_Level_Root 0UL /* Root is on top of hierachy */
67 /* Root interface */
68 typedef struct RootInterface
70 Object (*New)(Class *, APTR);
71 VOID (*Dispose)(Object);
72 } IRoot;
74 typedef struct RootIFStorage
76 IRoot *IRoot;
77 } IRootTable;
79 #endif /* OOPSYS_CLASS_H */