CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cond::MetaData Class Reference

#include <MetaData.h>

Public Member Functions

bool addMapping (const std::string &name, const std::string &token, cond::TimeType timetype=cond::runnumber)
 
void deleteAllEntries ()
 
void deleteEntryByTag (const std::string &tag)
 
const std::string getToken (const std::string &tagname) const
 
bool hasTag (const std::string &name) const
 
void listAllTags (std::vector< std::string > &result) const
 
 MetaData (cond::DbSession &userSession)
 
 ~MetaData ()
 

Private Attributes

cond::DbSession m_userSession
 

Detailed Description

Definition at line 19 of file MetaData.h.

Constructor & Destructor Documentation

MetaData::MetaData ( cond::DbSession userSession)
explicit

Definition at line 31 of file MetaData.cc.

31  :m_userSession( userSession ){
32 }
cond::DbSession m_userSession
Definition: MetaData.h:48
MetaData::~MetaData ( )

Definition at line 33 of file MetaData.cc.

33  {
34 }

Member Function Documentation

bool MetaData::addMapping ( const std::string &  name,
const std::string &  token,
cond::TimeType  timetype = cond::runnumber 
)

Definition at line 36 of file MetaData.cc.

References cppFunctionSkipper::exception, and ora::OId::fromString().

Referenced by cond::service::PoolDBOutputService::createNewIOV(), cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), TestFunct::Write(), and TestFunct::WriteWithIOV().

38  {
39  try{
40  if(!m_userSession.storage().exists()) return false;
41  ora::OId oid;
42  oid.fromString( iovtoken );
44  }catch( const coral::DuplicateEntryInUniqueKeyException& er ){
45  mdDuplicateEntryError("addMapping",name);
46  }catch(std::exception& er){
47  mdError("MetaData::addMapping",name,er.what());
48  }
49  return true;
50 }
Definition: OId.h:8
cond::DbSession m_userSession
Definition: MetaData.h:48
bool exists()
Definition: Database.cc:130
bool fromString(const std::string &s)
Definition: OId.cc:64
ora::Database & storage()
Definition: DbSession.cc:198
void setObjectName(const std::string &name, const OId &oid)
Definition: Database.cc:329
void MetaData::deleteAllEntries ( )

Definition at line 92 of file MetaData.cc.

References cppFunctionSkipper::exception, and edm::hlt::Exception.

92  {
93  try{
95  }catch(const std::exception& er){
96  throw cond::Exception( std::string("MetaData::deleteAllEntries: " )+er.what() );
97  }
98 }
cond::DbSession m_userSession
Definition: MetaData.h:48
bool eraseAllNames()
Definition: Database.cc:339
ora::Database & storage()
Definition: DbSession.cc:198
void MetaData::deleteEntryByTag ( const std::string &  tag)

Definition at line 100 of file MetaData.cc.

References cppFunctionSkipper::exception, and edm::hlt::Exception.

Referenced by TestFunct::DropItem().

100  {
101  try{
103  }catch(const std::exception& er){
104  throw cond::Exception( std::string("MetaData::deleteEntryByTag: " )+er.what() );
105  }
106 }
cond::DbSession m_userSession
Definition: MetaData.h:48
bool eraseObjectName(const std::string &name)
Definition: Database.cc:334
ora::Database & storage()
Definition: DbSession.cc:198
const std::string MetaData::getToken ( const std::string &  tagname) const

Definition at line 53 of file MetaData.cc.

References cppFunctionSkipper::exception, convertSQLiteXML::ok, and ora::OId::toString().

Referenced by TestFunct::DropItem(), cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), HcalO2OManager::getListOfPoolIovs(), cond::CondDB::iovToken(), cond::BasePayloadProxy::loadTag(), cond::service::PoolDBOutputService::lookUpRecord(), l1t::DataWriter::payloadToken(), TestFunct::Read(), and TestFunct::ReadWithIOV().

53  {
54  bool ok=false;
55  std::string iovtoken("");
56  if(!m_userSession.storage().exists()) return iovtoken;
57  try{
58  ora::OId oid;
59  ok = m_userSession.storage().getItemId( name, oid );
60  if(ok) {
61  iovtoken = oid.toString();
62  }
63  }catch(const std::exception& er){
64  mdError("MetaData::getToken", name,er.what() );
65  }
66  if (!ok) mdNoEntry("MetaData::getToken", name);
67  return iovtoken;
68 }
bool getItemId(const std::string &name, OId &destination)
Definition: Database.cc:344
Definition: OId.h:8
cond::DbSession m_userSession
Definition: MetaData.h:48
bool exists()
Definition: Database.cc:130
std::string toString() const
Definition: OId.cc:58
ora::Database & storage()
Definition: DbSession.cc:198
bool MetaData::hasTag ( const std::string &  name) const

Definition at line 70 of file MetaData.cc.

References cppFunctionSkipper::exception, and query::result.

Referenced by cond::ExportIOVUtilities::execute(), HcalO2OManager::getListOfPoolIovs(), cond::service::PoolDBOutputService::lookUpRecord(), and l1t::DataWriter::payloadToken().

70  {
71  bool result=false;
72  if(!m_userSession.storage().exists()) return result;
73  try{
74  ora::OId oid;
75  result = m_userSession.storage().getItemId( name, oid );
76  }catch(const std::exception& er){
77  mdError("MetaData::hasTag", name, er.what() );
78  }
79  return result;
80 }
bool getItemId(const std::string &name, OId &destination)
Definition: Database.cc:344
Definition: OId.h:8
cond::DbSession m_userSession
Definition: MetaData.h:48
tuple result
Definition: query.py:137
bool exists()
Definition: Database.cc:130
ora::Database & storage()
Definition: DbSession.cc:198
void MetaData::listAllTags ( std::vector< std::string > &  result) const

Definition at line 83 of file MetaData.cc.

References cppFunctionSkipper::exception, and edm::hlt::Exception.

Referenced by cond::CondDB::allTags(), HcalO2OManager::getListOfPoolTags(), and TestFunct::ReadAll().

83  {
84  try{
86  }catch(const std::exception& er){
87  throw cond::Exception( std::string("MetaData::listAllTags: " )+er.what() );
88  }
89 }
cond::DbSession m_userSession
Definition: MetaData.h:48
tuple result
Definition: query.py:137
bool listObjectNames(std::vector< std::string > &destination)
Definition: Database.cc:369
ora::Database & storage()
Definition: DbSession.cc:198

Member Data Documentation

cond::DbSession cond::MetaData::m_userSession
mutableprivate

Definition at line 48 of file MetaData.h.