Removing operator new
[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(); \
6fa1c374 48 void Dump();
45bcf167 49
50//static int ImplFileLine(){return 0;}
6fa1c374 51
52#define LClassImp(name) \
53 void name::Dump() { \
54 char parent[256]; \
55 parent[0] = 0; \
56 TDumpMembers dm; \
57 ShowMembers(dm, parent); \
58 } \
59 ClassImp(name)
60
61
62/*
63#define ClassArrayDef(name) \
64private: \
65 static AliArrayVT * fgArrayInfo; \
66public: \
67 static name * Unchecked1DAt(const AliObjectArray & arr, UInt_t index)\
68 { return ((name*)arr.Unchecked1DAt(index));} \
69 static name * Unchecked2DAt(const AliObjectArray & arr, UInt_t index) \
70 { return ((name*)arr.Unchecked2DAt(index));} \
71 static name * UncheckedAt(const AliObjectArray & arr, UInt_t index) \
72 { return (name*)arr.UncheckedAt(index);} \
73 static name * At(const AliObjectArray & arr, UInt_t index) \
74 { return (arr.GetClassInfo()==fgArrayInfo) ? (name*)arr.At(index): 0;} \
75 static name * CastAt(const AliObjectArray & arr, UInt_t index) \
76 { return (name*) ((arr.GetClass())->DynamicCast(Class(), arr.At(index))) ;} \
77 static AliArrayVT * GetArrayInfo(); \
78
79
80
81//This should be in automatic generated code
82#define ClassArrayImp(name) \
83AliArrayVT * name::fgArrayInfo = 0; \
84char *name ##__MakeBuffer(UInt_t size) { return (char*)new name[size];} \
85void name ##__DeleteBuffer(void *p) {delete [] (name*)p;} \
86int name ##__Cmp(char *p1, char * p2){return ((name*)p1)->Compare((name*)p2);} \
87void name ##__StreamObject(TBuffer& b, char * object){ ((name*)object)->Streamer(b);} \
88void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ); \
89void name ##__DumpObject(char *p) {return ((name*)p)->Dump();} \
90void name ##__StreamBuffer(TBuffer& b, char * object, UInt_t size ) \
91{ \
92 for (UInt_t i=0;i<size;i++) ((name*)object)[i].Streamer(b); \
93} \
94void name ##__DTORBuffer(void *p) { \
95 ((name*)p)->~name(); \
96} \
97void name ##__CTORBuffer(void *p) { \
98 new (p)name; \
99} \
100void name ##__DTORBuffer(void *p, const UInt_t size) { \
101 name * pp = (name*)p; \
102 name * pmax = pp+size; \
103 while (pp<pmax) (pp++)->~name(); \
104} \
105void name ##__CTORBuffer(void *p, const UInt_t size) { \
106 name * pp = (name*)p; \
107 name * pmax = pp+size; \
108 while (pp<pmax) new (pp++)name; \
109} \
110AliArrayVT *name::GetArrayInfo() \
111{ \
112 if (!fgArrayInfo) { \
113 fgArrayInfo = new AliArrayVT; \
114 fgArrayInfo->cmp = &(name ##__Cmp); \
115 fgArrayInfo->delbuffer = &(name ##__DeleteBuffer); \
116 fgArrayInfo->mkbuffer = &(name ##__MakeBuffer); \
117 fgArrayInfo->ctorbuffer = &(name ##__CTORBuffer); \
118 fgArrayInfo->dtorbuffer = &(name ##__DTORBuffer); \
119 fgArrayInfo->stream = &(name ##__StreamObject); \
120 fgArrayInfo->streamb = &(name ##__StreamBuffer); \
121 fgArrayInfo->dump = &(name ##__DumpObject); \
122 fgArrayInfo->fClass = name::Class(); \
123 fgArrayInfo->fClassName = "name"; \
124 fgArrayInfo->fSize = sizeof(name); \
125 } \
126 return fgArrayInfo; \
127}
128*/
129
130
131#endif // ALI_CTypes