Remove minor warning
[u/mrichter/AliRoot.git] / CONTAINERS / AliCTypes.h
CommitLineData
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
20class TDumpMembers : public TMemberInspector {
21public:
22 TDumpMembers() { }
0a24c9eb 23 void Inspect(TClass *cl, const char *parent, const char *name, const void *addr);
6fa1c374 24};
25
26//////////////////////////////////////////////////////////////////////////
27
28
29
0f917871 30// Removed:
31// friend operator>>
32// _ClassInit_
6fa1c374 33#define LClassDef(name,id) \
34private: \
35 static TClass *fgIsA; \
36public: \
37 static TClass *Class(); \
38 static const char *Class_Name(); \
39 static Version_t Class_Version() { return id; } \
40 static void Dictionary(); \
41 TClass *IsA() const { return name::Class(); } \
42 void ShowMembers(TMemberInspector &insp, char *parent); \
43 void Streamer(TBuffer &b); \
6fa1c374 44 static const char *DeclFileName() { return __FILE__; } \
45 static int DeclFileLine() { return __LINE__; } \
46 static const char *ImplFileName(); \
47 static int ImplFileLine(); \
48 void *operator new(size_t sz) { return TStorage::ObjectAlloc(sz); } \
49 void *operator new(size_t sz, void *vp) { return vp; } \
50 void Dump();
45bcf167 51
52//static int ImplFileLine(){return 0;}
6fa1c374 53
54#define LClassImp(name) \
55 void name::Dump() { \
56 char parent[256]; \
57 parent[0] = 0; \
58 TDumpMembers dm; \
59 ShowMembers(dm, parent); \
60 } \
61 ClassImp(name)
62
63
64/*
65#define ClassArrayDef(name) \
66private: \
67 static AliArrayVT * fgArrayInfo; \
68public: \
69 static name * Unchecked1DAt(const AliObjectArray & arr, UInt_t index)\
70 { return ((name*)arr.Unchecked1DAt(index));} \
71 static name * Unchecked2DAt(const AliObjectArray & arr, UInt_t index) \
72 { return ((name*)arr.Unchecked2DAt(index));} \
73 static name * UncheckedAt(const AliObjectArray & arr, UInt_t index) \
74 { return (name*)arr.UncheckedAt(index);} \
75 static name * At(const AliObjectArray & arr, UInt_t index) \
76 { return (arr.GetClassInfo()==fgArrayInfo) ? (name*)arr.At(index): 0;} \
77 static name * CastAt(const AliObjectArray & arr, UInt_t index) \
78 { return (name*) ((arr.GetClass())->DynamicCast(Class(), arr.At(index))) ;} \
79 static AliArrayVT * GetArrayInfo(); \
80
81
82
83//This should be in automatic generated code
84#define ClassArrayImp(name) \
85AliArrayVT * name::fgArrayInfo = 0; \
86char *name ##__MakeBuffer(UInt_t size) { return (char*)new name[size];} \
87void name ##__DeleteBuffer(void *p) {delete [] (name*)p;} \
88int name ##__Cmp(char *p1, char * p2){return ((name*)p1)->Compare((name*)p2);} \
89void name ##__StreamObject(TBuffer& b, char * object){ ((name*)object)->Streamer(b);} \
90void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ); \
91void name ##__DumpObject(char *p) {return ((name*)p)->Dump();} \
92void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ) \
93{ \
94 for (UInt_t i=0;i<size;i++) ((name*)object)[i].Streamer(b); \
95} \
96void name ##__DTORBuffer(void *p) { \
97 ((name*)p)->~name(); \
98} \
99void name ##__CTORBuffer(void *p) { \
100 new (p)name; \
101} \
102void name ##__DTORBuffer(void *p, const UInt_t size) { \
103 name * pp = (name*)p; \
104 name * pmax = pp+size; \
105 while (pp<pmax) (pp++)->~name(); \
106} \
107void name ##__CTORBuffer(void *p, const UInt_t size) { \
108 name * pp = (name*)p; \
109 name * pmax = pp+size; \
110 while (pp<pmax) new (pp++)name; \
111} \
112AliArrayVT *name::GetArrayInfo() \
113{ \
114 if (!fgArrayInfo) { \
115 fgArrayInfo = new AliArrayVT; \
116 fgArrayInfo->cmp = &(name ##__Cmp); \
117 fgArrayInfo->delbuffer = &(name ##__DeleteBuffer); \
118 fgArrayInfo->mkbuffer = &(name ##__MakeBuffer); \
119 fgArrayInfo->ctorbuffer = &(name ##__CTORBuffer); \
120 fgArrayInfo->dtorbuffer = &(name ##__DTORBuffer); \
121 fgArrayInfo->stream = &(name ##__StreamObject); \
122 fgArrayInfo->streamb = &(name ##__StreamBuffer); \
123 fgArrayInfo->dump = &(name ##__DumpObject); \
124 fgArrayInfo->fClass = name::Class(); \
125 fgArrayInfo->fClassName = "name"; \
126 fgArrayInfo->fSize = sizeof(name); \
127 } \
128 return fgArrayInfo; \
129}
130*/
131
132
133#endif // ALI_CTypes