LCOV - code coverage report
Current view: top level - STEER/CDB - AliCDBMetaData.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 61 21.3 %
Date: 2016-06-14 17:26:59 Functions: 6 14 42.9 %

          Line data    Source code
       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             : #include <TTimeStamp.h>
      29             : 
      30         128 : ClassImp(AliCDBMetaData)
      31             : 
      32             : //_____________________________________________________________________________
      33             : AliCDBMetaData::AliCDBMetaData() :
      34         740 :   TObject(),
      35         740 :   fObjectClassName(""),
      36         740 :   fResponsible(""),
      37         740 :   fBeamPeriod(0),
      38         740 :   fAliRootVersion(""),
      39         740 :   fComment(""),
      40         740 :   fProperties() 
      41        3700 : {
      42             :   // default constructor
      43             : 
      44         740 :   fProperties.SetOwner(1);
      45        1480 : }
      46             : 
      47             : //_____________________________________________________________________________
      48             : AliCDBMetaData::AliCDBMetaData(const char *responsible, UInt_t beamPeriod,
      49             :     const char* alirootVersion, const char* comment) :
      50           0 :   TObject(),
      51           0 :   fObjectClassName(""),
      52           0 :   fResponsible(responsible),
      53           0 :   fBeamPeriod(beamPeriod),
      54           0 :   fAliRootVersion(alirootVersion),
      55           0 :   fComment(comment),
      56           0 :   fProperties() 
      57           0 : {
      58             :   // constructor
      59             : 
      60           0 :   fProperties.SetOwner(1);
      61           0 : }
      62             : 
      63             : //_____________________________________________________________________________
      64         810 : AliCDBMetaData::~AliCDBMetaData() {
      65             :   // destructor
      66             : 
      67         405 : }
      68             : 
      69             : void AliCDBMetaData::Print(Option_t* option) const{
      70             :   //
      71             :   //
      72             :   //
      73           0 :   PrintMetaData();
      74           0 : }
      75             : 
      76             : //_____________________________________________________________________________
      77             : void AliCDBMetaData::SetProperty(const char* property, TObject* object) {
      78             :   // add something to the list of properties
      79             : 
      80           0 :   fProperties.Add(new TObjString(property), object);
      81           0 : }
      82             : 
      83             : //_____________________________________________________________________________
      84             : TObject* AliCDBMetaData::GetProperty(const char* property) const {
      85             :   // get a property specified by its name (property)
      86             : 
      87           0 :   return fProperties.GetValue(property);
      88             : }
      89             : 
      90             : //_____________________________________________________________________________
      91             : Bool_t AliCDBMetaData::RemoveProperty(const char* property) {
      92             :   // removes a property
      93             : 
      94           0 :   TObjString objStrProperty(property);
      95           0 :   TObjString* aKey = (TObjString*) fProperties.Remove(&objStrProperty);     
      96             : 
      97           0 :   if (aKey) {
      98           0 :     delete aKey;
      99           0 :     return kTRUE;
     100             :   } else {
     101           0 :     return kFALSE;
     102             :   }
     103           0 : }
     104             : 
     105             : //_____________________________________________________________________________
     106             : void AliCDBMetaData::AddDateToComment() {
     107             :   // add the date to the comment.
     108             :   // This method is supposed to be useful if called at the time when the object
     109             :   // is created, so that later it can more easily be tracked, in particular
     110             :   // when the date of the file can be lost or when one is interested in the
     111             :   // date of creation, irrespective of a later copy of it
     112             : 
     113           0 :   TTimeStamp ts(time(0));
     114           0 :   TString comment(GetComment());
     115           0 :   comment += Form("\tDate of production: %s\n", ts.AsString());
     116           0 :   comment.Remove(comment.Last('+'));
     117           0 :   SetComment(comment);
     118             : 
     119           0 : }
     120             : 
     121             : //_____________________________________________________________________________
     122             : void AliCDBMetaData::PrintMetaData() const {
     123             :   // print the object's metaData
     124             : 
     125           0 :   TString message;
     126           0 :   if(fObjectClassName != "")
     127           0 :     message += TString::Format("\tObject's class name:     %s\n", fObjectClassName.Data());
     128           0 :   if(fResponsible != "")
     129           0 :     message += TString::Format("\tResponsible:             %s\n", fResponsible.Data());
     130           0 :   if(fBeamPeriod != 0)
     131           0 :     message += TString::Format("\tBeam period:             %d\n", fBeamPeriod);
     132           0 :   if(fAliRootVersion != "")
     133           0 :     message += TString::Format("\tAliRoot version: %s\n", fAliRootVersion.Data());
     134           0 :   if(fComment != "")
     135           0 :     message += TString::Format("\tComment:         %s\n", fComment.Data());
     136           0 :   if(fProperties.GetEntries() > 0){
     137           0 :     message += "\tProperties key names:";
     138             : 
     139           0 :     TIter iter(fProperties.GetTable());
     140             :     TPair* aPair;
     141           0 :     while ((aPair = (TPair*) iter.Next())) {
     142           0 :       message += TString::Format("\t\t%s\n", ((TObjString* ) aPair->Key())->String().Data());
     143             :     }
     144           0 :   }
     145           0 :   message += '\n';
     146           0 :   Printf("**** Object's MetaData parameters **** \n%s", message.Data());
     147           0 : }

Generated by: LCOV version 1.11