]>
Commit | Line | Data |
---|---|---|
6fa1c374 | 1 | #ifndef ALI_CTypes |
2 | #define ALI_CTypes | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | ////////////////////////////////////////////////////////////////////////// | |
9 | // // | |
10 | // Ali C types // | |
11 | // | |
12 | // MI // | |
13 | // Macros for defining Containers // | |
14 | // // | |
15 | ////////////////////////////////////////////////////////////////////////// | |
16 | #include "TMemberInspector.h" | |
17 | #include "TClass.h" | |
18 | #include "TStorage.h" | |
19 | ||
20 | class TDumpMembers : public TMemberInspector { | |
21 | public: | |
22 | TDumpMembers() { } | |
23 | void Inspect(TClass *cl, const char *parent, const char *name, void *addr); | |
24 | }; | |
25 | ||
26 | ////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | ||
29 | ||
30 | #define LClassDef(name,id) \ | |
31 | private: \ | |
32 | static TClass *fgIsA; \ | |
33 | public: \ | |
34 | static TClass *Class(); \ | |
35 | static const char *Class_Name(); \ | |
36 | static Version_t Class_Version() { return id; } \ | |
37 | static void Dictionary(); \ | |
38 | TClass *IsA() const { return name::Class(); } \ | |
39 | void ShowMembers(TMemberInspector &insp, char *parent); \ | |
40 | void Streamer(TBuffer &b); \ | |
41 | friend TBuffer &operator>>(TBuffer &buf, name *&obj); \ | |
42 | _ClassInit_(name) \ | |
43 | static const char *DeclFileName() { return __FILE__; } \ | |
44 | static int DeclFileLine() { return __LINE__; } \ | |
45 | static const char *ImplFileName(); \ | |
46 | static int ImplFileLine(); \ | |
47 | void *operator new(size_t sz) { return TStorage::ObjectAlloc(sz); } \ | |
48 | void *operator new(size_t sz, void *vp) { return vp; } \ | |
49 | void Dump(); | |
50 | ||
51 | #define LClassImp(name) \ | |
52 | void name::Dump() { \ | |
53 | char parent[256]; \ | |
54 | parent[0] = 0; \ | |
55 | TDumpMembers dm; \ | |
56 | ShowMembers(dm, parent); \ | |
57 | } \ | |
58 | ClassImp(name) | |
59 | ||
60 | ||
61 | /* | |
62 | #define ClassArrayDef(name) \ | |
63 | private: \ | |
64 | static AliArrayVT * fgArrayInfo; \ | |
65 | public: \ | |
66 | static name * Unchecked1DAt(const AliObjectArray & arr, UInt_t index)\ | |
67 | { return ((name*)arr.Unchecked1DAt(index));} \ | |
68 | static name * Unchecked2DAt(const AliObjectArray & arr, UInt_t index) \ | |
69 | { return ((name*)arr.Unchecked2DAt(index));} \ | |
70 | static name * UncheckedAt(const AliObjectArray & arr, UInt_t index) \ | |
71 | { return (name*)arr.UncheckedAt(index);} \ | |
72 | static name * At(const AliObjectArray & arr, UInt_t index) \ | |
73 | { return (arr.GetClassInfo()==fgArrayInfo) ? (name*)arr.At(index): 0;} \ | |
74 | static name * CastAt(const AliObjectArray & arr, UInt_t index) \ | |
75 | { return (name*) ((arr.GetClass())->DynamicCast(Class(), arr.At(index))) ;} \ | |
76 | static AliArrayVT * GetArrayInfo(); \ | |
77 | ||
78 | ||
79 | ||
80 | //This should be in automatic generated code | |
81 | #define ClassArrayImp(name) \ | |
82 | AliArrayVT * name::fgArrayInfo = 0; \ | |
83 | char *name ##__MakeBuffer(UInt_t size) { return (char*)new name[size];} \ | |
84 | void name ##__DeleteBuffer(void *p) {delete [] (name*)p;} \ | |
85 | int name ##__Cmp(char *p1, char * p2){return ((name*)p1)->Compare((name*)p2);} \ | |
86 | void name ##__StreamObject(TBuffer& b, char * object){ ((name*)object)->Streamer(b);} \ | |
87 | void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ); \ | |
88 | void name ##__DumpObject(char *p) {return ((name*)p)->Dump();} \ | |
89 | void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ) \ | |
90 | { \ | |
91 | for (UInt_t i=0;i<size;i++) ((name*)object)[i].Streamer(b); \ | |
92 | } \ | |
93 | void name ##__DTORBuffer(void *p) { \ | |
94 | ((name*)p)->~name(); \ | |
95 | } \ | |
96 | void name ##__CTORBuffer(void *p) { \ | |
97 | new (p)name; \ | |
98 | } \ | |
99 | void name ##__DTORBuffer(void *p, const UInt_t size) { \ | |
100 | name * pp = (name*)p; \ | |
101 | name * pmax = pp+size; \ | |
102 | while (pp<pmax) (pp++)->~name(); \ | |
103 | } \ | |
104 | void name ##__CTORBuffer(void *p, const UInt_t size) { \ | |
105 | name * pp = (name*)p; \ | |
106 | name * pmax = pp+size; \ | |
107 | while (pp<pmax) new (pp++)name; \ | |
108 | } \ | |
109 | AliArrayVT *name::GetArrayInfo() \ | |
110 | { \ | |
111 | if (!fgArrayInfo) { \ | |
112 | fgArrayInfo = new AliArrayVT; \ | |
113 | fgArrayInfo->cmp = &(name ##__Cmp); \ | |
114 | fgArrayInfo->delbuffer = &(name ##__DeleteBuffer); \ | |
115 | fgArrayInfo->mkbuffer = &(name ##__MakeBuffer); \ | |
116 | fgArrayInfo->ctorbuffer = &(name ##__CTORBuffer); \ | |
117 | fgArrayInfo->dtorbuffer = &(name ##__DTORBuffer); \ | |
118 | fgArrayInfo->stream = &(name ##__StreamObject); \ | |
119 | fgArrayInfo->streamb = &(name ##__StreamBuffer); \ | |
120 | fgArrayInfo->dump = &(name ##__DumpObject); \ | |
121 | fgArrayInfo->fClass = name::Class(); \ | |
122 | fgArrayInfo->fClassName = "name"; \ | |
123 | fgArrayInfo->fSize = sizeof(name); \ | |
124 | } \ | |
125 | return fgArrayInfo; \ | |
126 | } | |
127 | */ | |
128 | ||
129 | ||
130 | #endif // ALI_CTypes |