Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbPayloadUtils.hh

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // File and Version Information
00003 //      $Id: CdbPayloadUtils.hh,v 1.1 2005/07/13 20:00:58 jtinslay Exp $
00004 //
00005 // Description:
00006 //      Class CdbPayloadUtils
00007 //      Utility functions for payload applications
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00011 //
00012 // Author List:
00013 //      Jane Tinslay                
00014 //
00015 // Copyright Information:
00016 //      Copyright (C) 2005          SLAC
00017 //
00018 //-----------------------------------------------------------------------------
00019 #ifndef CDBPAYLOADUTILS_HH
00020 #define CDBPAYLOADUTILS_HH
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "CdbBase/Cdb.hh"
00026 #include "CdbBase/CdbObjectTranslator.hh"
00027 #include "CdbBase/CdbProxyElement.hh"
00028 #include "CdbBase/CdbStatus.hh"
00029 #include <string>
00030 #include <vector>
00031 
00032 using std::string;
00033 using std::vector;
00034 
00035 namespace CdbPayloadUtils {
00036   
00037   namespace {
00038     
00039     //Helper class lifted from DchProxy/DchDetectorProxy
00040     class hasBeenUpdated {
00041     public:
00042       hasBeenUpdated(const string& name): _name(name) {};
00043       bool operator()(const CdbProxyElement& e) const
00044       {return e.name()==_name && e.updated();}
00045     private:
00046       string _name;
00047     };
00048     
00049   }
00050   
00051   //Return pointer to transient if given condition is present
00052   //in CdbProxyElement list and is updated
00053   template <typename T>
00054   T* transient(const string&, const std::vector<CdbProxyElement>&);
00055   
00056   //Register translator with Cdb
00057   inline void registerTranslator(CdbObjectTranslator* translator) {
00058     if( CdbStatus::Success != Cdb::instance()->registerTranslator(translator)) {
00059       ErrMsg(fatal) << "Failed to register translator " <<endmsg;
00060     }
00061   }
00062   
00063 };
00064 
00065 #ifdef BABAR_COMP_INST
00066 #include "CdbBase/CdbPayloadUtils.cc"
00067 #endif
00068 
00069 #endif

Generated on Mon Dec 5 18:22:08 2005 for CDB by doxygen1.3-rc3