]>
Commit | Line | Data |
---|---|---|
2c8628dd | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // class that contains an object from the data base and knows about its // | |
21 | // validity range (meta data) // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | ||
fe913d8f | 26 | #include "AliCDBEntry.h" |
2c8628dd | 27 | |
fe913d8f | 28 | ClassImp(AliCDBEntry) |
2c8628dd | 29 | |
30 | ||
31 | //_____________________________________________________________________________ | |
fe913d8f | 32 | AliCDBEntry::AliCDBEntry() : |
2c8628dd | 33 | TObject(), |
34 | fObject(NULL), | |
fe913d8f | 35 | fMetaData() |
2c8628dd | 36 | { |
37 | // default constructor | |
38 | ||
39 | } | |
40 | ||
41 | //_____________________________________________________________________________ | |
fe913d8f | 42 | AliCDBEntry::AliCDBEntry(const TObject* object, const AliCDBMetaData& metaData) : |
2c8628dd | 43 | TObject(), |
fe913d8f | 44 | fObject(object->Clone()), |
45 | fMetaData(metaData) | |
2c8628dd | 46 | { |
47 | // constructor | |
48 | ||
49 | } | |
50 | ||
51 | //_____________________________________________________________________________ | |
fe913d8f | 52 | AliCDBEntry::~AliCDBEntry() |
2c8628dd | 53 | { |
54 | // destructor | |
55 | ||
56 | delete fObject; | |
57 | } | |
58 | ||
59 | ||
60 | //_____________________________________________________________________________ | |
fe913d8f | 61 | AliCDBEntry::AliCDBEntry(const AliCDBEntry& entry) : |
2c8628dd | 62 | TObject(entry), |
fe913d8f | 63 | fMetaData(entry.fMetaData) |
2c8628dd | 64 | { |
65 | // copy constructor | |
66 | ||
67 | } | |
68 | ||
69 | //_____________________________________________________________________________ | |
fe913d8f | 70 | AliCDBEntry& AliCDBEntry::operator = (const AliCDBEntry& entry) |
2c8628dd | 71 | { |
72 | // assignment operator | |
73 | ||
74 | delete fObject; | |
75 | fObject = entry.fObject->Clone(); | |
fe913d8f | 76 | fMetaData = entry.fMetaData; |
2c8628dd | 77 | return *this; |
78 | } | |
79 | ||
80 | ||
81 | ||
82 | //_____________________________________________________________________________ | |
fe913d8f | 83 | const char* AliCDBEntry::GetName() const |
2c8628dd | 84 | { |
85 | // get the name | |
86 | ||
fe913d8f | 87 | return fMetaData.GetName(); |
2c8628dd | 88 | } |
89 | ||
90 | ||
91 | //_____________________________________________________________________________ | |
fe913d8f | 92 | Int_t AliCDBEntry::Compare(const TObject* object) const |
2c8628dd | 93 | { |
f05209ee | 94 | // check whether this is preferred to object |
2c8628dd | 95 | |
fe913d8f | 96 | if (!object || !object->InheritsFrom(AliCDBEntry::Class())) return 1; |
97 | return fMetaData.Compare(&((AliCDBEntry*)object)->GetCDBMetaData()); | |
2c8628dd | 98 | } |
99 |