1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////////////
18 // class AliCDBMetaData //
19 // Set of data describing the object //
20 // but not used to identify the object //
22 /////////////////////////////////////////////////////////////////////
24 #include "AliCDBMetaData.h"
27 #include <TObjString.h>
28 #include <TTimeStamp.h>
30 ClassImp(AliCDBMetaData)
32 //_____________________________________________________________________________
33 AliCDBMetaData::AliCDBMetaData() :
42 // default constructor
44 fProperties.SetOwner(1);
47 //_____________________________________________________________________________
48 AliCDBMetaData::AliCDBMetaData(const char *responsible, UInt_t beamPeriod,
49 const char* alirootVersion, const char* comment) :
52 fResponsible(responsible),
53 fBeamPeriod(beamPeriod),
54 fAliRootVersion(alirootVersion),
60 fProperties.SetOwner(1);
63 //_____________________________________________________________________________
64 AliCDBMetaData::~AliCDBMetaData() {
69 //_____________________________________________________________________________
70 void AliCDBMetaData::SetProperty(const char* property, TObject* object) {
71 // add something to the list of properties
73 fProperties.Add(new TObjString(property), object);
76 //_____________________________________________________________________________
77 TObject* AliCDBMetaData::GetProperty(const char* property) const {
78 // get a property specified by its name (property)
80 return fProperties.GetValue(property);
83 //_____________________________________________________________________________
84 Bool_t AliCDBMetaData::RemoveProperty(const char* property) {
87 TObjString objStrProperty(property);
88 TObjString* aKey = (TObjString*) fProperties.Remove(&objStrProperty);
98 //_____________________________________________________________________________
99 void AliCDBMetaData::AddDateToComment() {
100 // add the date to the comment.
101 // This method is supposed to be useful if called at the time when the object
102 // is created, so that later it can more easily be tracked, in particular
103 // when the date of the file can be lost or when one is interested in the
104 // date of creation, irrespective of a later copy of it
106 TTimeStamp ts(time(0));
107 TString comment(GetComment());
108 comment += Form("\tDate of production: %s\n", ts.AsString());
109 comment.Remove(comment.Last('+'));
114 //_____________________________________________________________________________
115 void AliCDBMetaData::PrintMetaData() {
116 // print the object's metaData
119 if(fObjectClassName != "")
120 message += TString::Format("\tObject's class name: %s\n", fObjectClassName.Data());
121 if(fResponsible != "")
122 message += TString::Format("\tResponsible: %s\n", fResponsible.Data());
124 message += TString::Format("\tBeam period: %d\n", fBeamPeriod);
125 if(fAliRootVersion != "")
126 message += TString::Format("\tAliRoot version: %s\n", fAliRootVersion.Data());
128 message += TString::Format("\tComment: %s\n", fComment.Data());
129 if(fProperties.GetEntries() > 0){
130 message += "\tProperties key names:";
132 TIter iter(fProperties.GetTable());
134 while ((aPair = (TPair*) iter.Next())) {
135 message += TString::Format("\t\t%s\n", ((TObjString* ) aPair->Key())->String().Data());
139 Printf("**** Object's MetaData parameters **** \n%s", message.Data());