]>
Commit | Line | Data |
---|---|---|
a197a4ce | 1 | #ifndef ALIRAWDATA_H |
2 | #define ALIRAWDATA_H | |
d04aea32 | 3 | // @(#) $Id$ |
a197a4ce | 4 | // Author: Fons Rademakers 26/11/99 |
5 | ||
6 | /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * | |
7 | * See cxx source for full Copyright notice */ | |
8 | ||
9 | ////////////////////////////////////////////////////////////////////////// | |
10 | // // | |
11 | // AliRawData // | |
12 | // // | |
13 | ////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | #ifndef ROOT_TObject | |
16 | #include <TObject.h> | |
17 | #endif | |
18 | ||
19 | ||
20 | class AliRawData : public TObject { | |
21 | ||
22 | public: | |
f3c1e83c | 23 | AliRawData(); |
a197a4ce | 24 | virtual ~AliRawData() { if (fOwner) delete [] fRawData; } |
25 | ||
26 | inline void SetSize(Int_t size); | |
27 | inline void SetBuffer(void *buf, Int_t size); | |
28 | Int_t GetSize() const { return fSize; } | |
29 | void *GetBuffer() { return fRawData; } | |
30 | ||
31 | private: | |
32 | Int_t fSize; // number of raw data bytes | |
33 | Int_t fBufSize; //!actual size of fRawData | |
34 | char *fRawData; //[fSize] raw event data | |
35 | Bool_t fOwner; //!if true object owns fRawData buffer | |
36 | ||
37 | AliRawData(const AliRawData &); // not implemented, usage causes | |
38 | AliRawData &operator=(const AliRawData &); // link time error | |
39 | ||
40 | ClassDef(AliRawData,1) // Alice raw event buffer | |
41 | }; | |
42 | ||
43 | void AliRawData::SetSize(Int_t size) | |
44 | { | |
45 | if (size > fBufSize) { | |
46 | if (fOwner) delete [] fRawData; | |
47 | fRawData = new char [size]; | |
48 | fBufSize = size; | |
49 | fOwner = kTRUE; | |
50 | } | |
51 | fSize = size; | |
52 | } | |
53 | ||
54 | void AliRawData::SetBuffer(void *buf, Int_t size) | |
55 | { | |
56 | if (fOwner) delete [] fRawData; | |
57 | fRawData = (char *) buf; | |
58 | fBufSize = size; | |
59 | fSize = size; | |
60 | fOwner = kFALSE; | |
61 | } | |
62 | ||
63 | #endif |