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