]>
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 | ||
9e1ceb13 | 16 | ///////////////////////////////////////////////////////////////////// |
17 | // // | |
18 | // class AliCDBMetaData // | |
19 | // Set of data describing the object // | |
20 | // but not used to identify the object // | |
21 | // // | |
22 | ///////////////////////////////////////////////////////////////////// | |
2c8628dd | 23 | |
fe913d8f | 24 | #include "AliCDBMetaData.h" |
f05209ee | 25 | #include "AliLog.h" |
2c8628dd | 26 | |
9e1ceb13 | 27 | #include <TObjString.h> |
2c8628dd | 28 | |
fe913d8f | 29 | ClassImp(AliCDBMetaData) |
2c8628dd | 30 | |
2c8628dd | 31 | //_____________________________________________________________________________ |
17c7b9cd | 32 | AliCDBMetaData::AliCDBMetaData() : |
33 | TObject(), | |
34 | fObjectClassName(""), | |
c3a7b59a | 35 | fResponsible(""), |
36 | fBeamPeriod(0), | |
17c7b9cd | 37 | fAliRootVersion(""), |
fe12e09c | 38 | fComment(""), |
39 | fProperties() | |
17c7b9cd | 40 | { |
2c8628dd | 41 | // default constructor |
2c8628dd | 42 | |
9e1ceb13 | 43 | fProperties.SetOwner(1); |
2c8628dd | 44 | } |
45 | ||
c3a7b59a | 46 | //_____________________________________________________________________________ |
47 | AliCDBMetaData::AliCDBMetaData(const char *responsible, UInt_t beamPeriod, | |
48 | const char* alirootVersion, const char* comment) : | |
49 | TObject(), | |
50 | fObjectClassName(""), | |
51 | fResponsible(responsible), | |
52 | fBeamPeriod(beamPeriod), | |
53 | fAliRootVersion(alirootVersion), | |
54 | fComment(comment), | |
55 | fProperties() | |
56 | { | |
57 | // constructor | |
58 | ||
59 | fProperties.SetOwner(1); | |
60 | } | |
61 | ||
2c8628dd | 62 | //_____________________________________________________________________________ |
9e1ceb13 | 63 | AliCDBMetaData::~AliCDBMetaData() { |
64 | // destructor | |
2c8628dd | 65 | |
2c8628dd | 66 | } |
67 | ||
2c8628dd | 68 | //_____________________________________________________________________________ |
9e1ceb13 | 69 | void AliCDBMetaData::SetProperty(const char* property, TObject* object) { |
70 | // add something to the list of properties | |
f05209ee | 71 | |
9e1ceb13 | 72 | fProperties.Add(new TObjString(property), object); |
f05209ee | 73 | } |
74 | ||
75 | //_____________________________________________________________________________ | |
9e1ceb13 | 76 | TObject* AliCDBMetaData::GetProperty(const char* property) const { |
77 | // get a property specified by its name (property) | |
f05209ee | 78 | |
9e1ceb13 | 79 | return fProperties.GetValue(property); |
2c8628dd | 80 | } |
81 | ||
82 | //_____________________________________________________________________________ | |
9e1ceb13 | 83 | Bool_t AliCDBMetaData::RemoveProperty(const char* property) { |
84 | // removes a property | |
85 | ||
86 | TObjString objStrProperty(property); | |
87 | TObjString* aKey = (TObjString*) fProperties.Remove(&objStrProperty); | |
88 | ||
89 | if (aKey) { | |
90 | delete aKey; | |
91 | return kTRUE; | |
92 | } else { | |
93 | return kFALSE; | |
94 | } | |
2c8628dd | 95 | } |
96 | ||
2c8628dd | 97 | //_____________________________________________________________________________ |
9e1ceb13 | 98 | void AliCDBMetaData::PrintMetaData() { |
99 | // print the object's metaData | |
100 | ||
62032124 | 101 | TString message; |
102 | if(fObjectClassName != "") | |
103 | message += Form("\tObject's class name: %s\n", fObjectClassName.Data()); | |
104 | if(fResponsible != "") | |
105 | message += Form("\tResponsible: %s\n", fResponsible.Data()); | |
106 | if(fBeamPeriod != 0) | |
107 | message += Form("\tBeam period: %d\n", fBeamPeriod); | |
108 | if(fAliRootVersion != "") | |
109 | message += Form("\tAliRoot version: %s\n", fAliRootVersion.Data()); | |
110 | if(fComment != "") | |
111 | message += Form("\tComment: %s\n", fComment.Data()); | |
112 | if(fProperties.GetEntries() > 0){ | |
113 | message += "\tProperties key names:"; | |
114 | ||
115 | TIter iter(fProperties.GetTable()); | |
116 | TPair* aPair; | |
117 | while ((aPair = (TPair*) iter.Next())) { | |
118 | message += Form("\t\t%s\n", ((TObjString* ) aPair->Key())->String().Data()); | |
119 | } | |
9e1ceb13 | 120 | } |
c3a7b59a | 121 | message += '\n'; |
122 | AliInfo(Form("**** Object's MetaData parameters **** \n%s", message.Data())); | |
2c8628dd | 123 | } |