00001 #ifndef CondCore_MetaDataService_METADATA_H 00002 #define CondCore_MetaDataService_METADATA_H 00003 #include <string> 00004 #include <vector> 00005 #include "CondCore/DBCommon/interface/Time.h" 00006 #include "MetaDataEntry.h" 00007 // 00008 // Package: MetaDataService 00009 // Class : MetaData 00010 // 00014 // 00015 // Author: Zhen Xie 00016 // 00017 namespace cond{ 00018 class CoralTransaction; 00019 class MetaData { 00020 public: 00021 // constructor 00022 explicit MetaData( cond::CoralTransaction& coraldb ); 00023 // destructor 00024 ~MetaData(); 00025 // add metadata entry 00026 bool addMapping(const std::string& name, const std::string& token,cond::TimeType timetype=cond::runnumber); 00027 // replace iov token associated with a given tag 00028 bool replaceToken(const std::string& name, const std::string& newtoken); 00029 // if given iov tag exists 00030 bool hasTag( const std::string& name ) const; 00031 // list all tags 00032 void listAllTags( std::vector<std::string>& result ) const; 00033 // list all entries in the metadata table 00034 void listAllEntries( std::vector<cond::MetaDataEntry>& result ) const; 00035 // get iov token associated with given tag 00036 const std::string getToken( const std::string& tagname ) const; 00037 // get the metadata table entry by tag name 00038 void getEntryByTag( const std::string& tagname, cond::MetaDataEntry& result )const; 00039 // delete all entries in the metadata table 00040 void deleteAllEntries(); 00041 // delete metadata entry selected by iov token 00042 void deleteEntryByToken( const std::string& token ); 00043 // delete metadata entry selected by tag name 00044 void deleteEntryByTag( const std::string& tag ); 00045 private: 00046 // create metadata table 00047 //void createTable(const std::string& tabname); 00048 cond::CoralTransaction& m_coraldb; 00049 }; 00050 } 00051 #endif 00052