]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBMetaData.h
Additional protection
[u/mrichter/AliRoot.git] / STEER / AliCDBMetaData.h
1 #ifndef ALICDBMETADATA_H
2 #define ALICDBMETADATA_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///
9 ///  CDB meta data: it fully describes a run dependent database object. 
10 ///  It is attached to the object to build an AliCDBEntry object
11 /// 
12 ///
13
14 #include <TObject.h>
15 #include <TString.h>
16
17 class AliCDBMetaData: public TObject {
18 public:
19   AliCDBMetaData();     // default constructor
20   AliCDBMetaData
21          (const char* name, Int_t firstRun = -1, Int_t lastRun = -1, Int_t period=-1, 
22           const char* objFormat="", const char* responsible="Duck, Donald", 
23           const char* extraInfo="");    // constructor
24
25   virtual ~AliCDBMetaData() {}; // destructor
26
27   AliCDBMetaData(const AliCDBMetaData& entry);  // copy contructor      
28   AliCDBMetaData& operator = (const AliCDBMetaData& entry);     // assignment  operator
29
30
31   void          SetName(const char* name) {fName = name; DecodeName();} // object's name ("Detector/DBType/DetSpecType")
32   void          SetDetector(const char* Detector) {fDetector = Detector; EncodeName();} // set the detector's name (ZDC,ITS ...)
33   void          SetDBType(const char* DBType) {fDBType = DBType; EncodeName();} // set the database type (Calib, Align ...)
34   void          SetDetSpecType(const char* DetSpecType) {fDetSpecType = DetSpecType; EncodeName();} // set the detector's specific type name (Pedestals, GainConst, DeadChannelMaps...)
35   void          SetRunRange(Int_t firstRun = -1, Int_t lastRun = 1) 
36                         {fFirstRun = firstRun; fLastRun = lastRun;} // set the run validity range
37   void          SetVersion(Int_t version = -1) {fVersion = version;} // object's version (automatically set during storage!)
38   void          SetPeriod(Int_t period) {fPeriod = period;}     // set number of beam period
39   void          SetFormat(const char* objFormat) {fFormat = objFormat;} // set infos about object's format (array o floats, histos...)
40   void          SetResponsible(const char* responsible) {fResponsible = responsible;}   // who made the object?
41   void          SetExtraInfo(const char* extraInfo) {fExtraInfo = extraInfo;}   // something else you would like to know
42   
43
44   const char*   GetName() const {return fName.Data();} // get the name 
45   const char*   GetDetector() const {return fDetector.Data();} // get the detector's name 
46   const char*   GetDBType() const {return fDBType.Data();} // get the database type 
47   const char*   GetDetSpecType() const {return fDetSpecType.Data();} // get the detector's specific type name 
48   
49   const Int_t   GetFirstRun() const {return fFirstRun;} // get the first valid run
50   const Int_t   GetLastRun() const {return fLastRun;} // get the last valid run
51   const Int_t   GetVersion() const {return fVersion;} // get the version
52   const Int_t   GetPeriod() const {return fPeriod;} // get the beam period
53   const char*   GetFormat() const {return fFormat.Data();} // get the object's format
54   const char*   GetResponsible() const  {return fResponsible.Data();} // get the responsible's name
55   const char*   GetExtraInfo() const {return fExtraInfo.Data();} // get the object's extra info
56   
57   Bool_t        IsValid(Int_t runNumber,     
58                         AliCDBMetaData* metaData = NULL) const; 
59   Bool_t        IsStrictlyValid(Int_t runNumber, 
60                         AliCDBMetaData* metaData = NULL) const;
61   Int_t         Compare(const TObject* object) const;
62   Bool_t        Matches(const char* name, Int_t runNumber) const;
63
64 protected:
65   TString       fName;           // name of the entry
66   TString       fDetector;       // name of the detector (ZDC, TPC, etc...)
67   TString       fDBType;         // name of the database type (Calib, Align)
68   TString       fDetSpecType;    // name of the detector's specific data type (pedestals, gain coeffs...)
69   Int_t         fFirstRun;       // index of first valid run
70   Int_t         fLastRun;        // index of last valid run
71   Int_t         fVersion;        // version of the entry
72   Int_t         fPeriod;         // beam period 
73   TString       fFormat;         // object's format
74   TString       fResponsible;    // name of the person responsible for the object
75   TString       fExtraInfo;      // extra info about the object
76   
77   void          EncodeName();
78   void          DecodeName();
79
80 ClassDef(AliCDBMetaData, 1)   // CDB meta data: full description of a run dependent database object
81 };
82
83 extern Bool_t operator == (const AliCDBMetaData& entry1, 
84                            const AliCDBMetaData& entry2);
85
86 #endif