8928f7e3c196565620bb1aa7fb38111f21d5fee0
[mono.git] / mono / metadata / class.h
1 #ifndef _MONO_CLI_CLASS_H_
2 #define _MONO_CLI_CLASS_H_
3
4 #include <mono/metadata/metadata.h>
5 #include <mono/metadata/image.h>
6 #include <mono/cli/cli.h>
7
8 #define MONO_CLASS_IS_ARRAY(c) (c->type_token == 0)
9
10 typedef struct {
11         MonoFieldType *type;
12         int            offset;
13         guint32        flags;
14 } MonoClassField;
15
16 typedef struct _MonoClass MonoClass;
17
18 struct _MonoClass {
19         MonoImage *image;
20         guint32    type_token;
21
22         guint inited : 1;
23         guint valuetype : 1; /* derives from System.ValueType */
24         guint evaltype : 1; /* element type derives from System.ValueType */
25
26         MonoClass *parent;
27         
28         /*
29          * Computed object instance size, total.
30          */
31         int        instance_size;
32         int        class_size;
33
34         /*
35          * From the TypeDef table
36          */
37         guint32    flags;
38         struct {
39                 guint32 first, last;
40                 int count;
41         } field, method;
42
43         /*
44          * Field information: Type and location from object base
45          */
46         MonoClassField *fields;
47         
48         struct MonoMethod **methods;
49
50         /*
51          * After the fields, there is room for the static fields...
52          */
53 };
54
55 typedef struct {
56         MonoClass class;
57         guint32 rank;        /* array dimension */
58         guint32 etype_token; /* element type token */
59         guint32 esize;       /* element size */ 
60 } MonoArrayClass;
61
62 MonoClass *
63 mono_class_get       (MonoImage *image, guint32 type_token);
64
65 MonoClass *
66 mono_array_class_get (MonoImage *image, guint32 etype, guint32 rank);
67
68 MonoClassField *
69 mono_class_get_field (MonoClass *class, guint32 field_token);
70
71 #endif /* _MONO_CLI_CLASS_H_ */