AliRoot Core  3dc7879 (3dc7879)
AliCDBEntry.cxx
Go to the documentation of this file.
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 
17 // //
18 // class AliCDBEntry //
19 // container for an object, it identity (AliCDBId) //
20 // and its metaData (AliCDBMetaData) //
21 // //
23 
24 #include "AliCDBEntry.h"
25 #include "AliLog.h"
26 
27 ClassImp(AliCDBEntry)
28 
29 //_____________________________________________________________________________
31  fObject(NULL),
32  fId(),
33  fMetaData(NULL),
34  fIsOwner(kFALSE){
35  // default constructor
36 
37  }
38 
39 //_____________________________________________________________________________
40 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBId& id,
41  AliCDBMetaData* metaData, Bool_t owner):
42  fObject(object),
43  fId(id),
44  fMetaData(metaData),
45  fIsOwner(owner){
46  // constructor
47  fMetaData->SetObjectClassName(fObject->ClassName());
48  }
49 
50 //_____________________________________________________________________________
51 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBPath& path,
52  const AliCDBRunRange& runRange,
53  AliCDBMetaData* metaData,Bool_t owner):
54  fObject(object),
55  fId(path, runRange, -1, -1),
56  fMetaData(metaData),
57  fIsOwner(owner){
58  // constructor
59  fMetaData->SetObjectClassName(fObject->ClassName());
60  }
61 
62 //_____________________________________________________________________________
63 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBPath& path,
64  const AliCDBRunRange& runRange,
65  Int_t version, AliCDBMetaData* metaData, Bool_t owner):
66  fObject(object),
67  fId(path, runRange, version, -1),
68  fMetaData(metaData),
69  fIsOwner(owner){
70  // constructor
71  fMetaData->SetObjectClassName(fObject->ClassName());
72  }
73 
74 //_____________________________________________________________________________
75 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBPath& path,
76  const AliCDBRunRange& runRange,
77  Int_t version, Int_t subVersion,
78  AliCDBMetaData* metaData, Bool_t owner):
79  fObject(object),
80  fId(path, runRange, version, subVersion),
81  fMetaData(metaData),
82  fIsOwner(owner){
83  // constructor
84  fMetaData->SetObjectClassName(fObject->ClassName());
85  }
86 
87 
88 //_____________________________________________________________________________
89 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBPath& path,
90  Int_t firstRun, Int_t lastRun,
91  AliCDBMetaData* metaData, Bool_t owner):
92  fObject(object),
93  fId(path, firstRun, lastRun, -1, -1),
94  fMetaData(metaData),
95  fIsOwner(owner){
96  // constructor
97  fMetaData->SetObjectClassName(fObject->ClassName());
98  }
99 
100 //_____________________________________________________________________________
101 AliCDBEntry::AliCDBEntry(TObject* object, const AliCDBPath& path,
102  Int_t firstRun, Int_t lastRun,
103  Int_t version, AliCDBMetaData* metaData,
104  Bool_t owner):
105  fObject(object),
106  fId(path, firstRun, lastRun, version, -1),
107  fMetaData(metaData),
108  fIsOwner(owner){
109  // constructor
110  fMetaData->SetObjectClassName(fObject->ClassName());
111  }
112 
113 //_____________________________________________________________________________
114 AliCDBEntry::AliCDBEntry( TObject* object, const AliCDBPath& path,
115  Int_t firstRun, Int_t lastRun,
116  Int_t version, Int_t subVersion,
117  AliCDBMetaData* metaData, Bool_t owner):
118  fObject(object),
119  fId(path, firstRun, lastRun, version, subVersion),
120  fMetaData(metaData), fIsOwner(owner){
121  // constructor
122  fMetaData->SetObjectClassName(fObject->ClassName());
123  }
124 
125 //_____________________________________________________________________________
127  // destructor
128 
129  if (fIsOwner) {
130  if (fObject) {
131  delete fObject;
132  }
133 
134  if (fMetaData) {
135  delete fMetaData;
136  }
137  }
138 }
139 
140 void AliCDBEntry::Print(Option_t* option) const{
141  //
142  //
143  //
144  PrintId();
145  if (fMetaData) fMetaData->Print(option);
146  if (fObject) fObject->Print(option);
147 
148 }
149 
150 //_____________________________________________________________________________
151 void AliCDBEntry::PrintId() const {
152 
153  AliInfo(Form("%s",fId.ToString().Data()));
154 
155 }
156 
157 
158 Int_t AliCDBEntry::Compare(const TObject* obj) const
159 {
160  //
161  // compare according y
162  AliCDBEntry * o2 = (AliCDBEntry*)obj;
163  return TString(this->GetId().GetPath()).CompareTo((o2->GetId().GetPath()));
164 
165 }
166 
167 Bool_t AliCDBEntry::IsSortable() const {
168  return kTRUE;
169 }
void PrintId() const
Bool_t fIsOwner
Definition: AliCDBEntry.h:82
const char * path
AliCDBMetaData * fMetaData
Definition: AliCDBEntry.h:81
virtual Bool_t IsSortable() const
virtual ~AliCDBEntry()
TObject * fObject
Definition: AliCDBEntry.h:79
AliCDBEntry()
Definition: AliCDBEntry.cxx:30
#define AliInfo(message)
Definition: AliLog.h:484
virtual void Print(Option_t *option="") const
AliCDBId fId
Definition: AliCDBEntry.h:80
Definition: AliCDBEntry.h:18
TString ToString() const
Definition: AliCDBId.cxx:163
void SetObjectClassName(const char *name)
const TString & GetPath() const
Definition: AliCDBId.h:40
virtual void Print(Option_t *option="") const
AliCDBId & GetId()
Definition: AliCDBEntry.h:51
virtual Int_t Compare(const TObject *obj) const