00001 #include "CondCore/IOVService/interface/KeyList.h" 00002 #include "CondCore/DBCommon/interface/DbTransaction.h" 00003 00004 00005 00006 namespace cond { 00007 00008 KeyList::KeyList(IOVKeysDescription const * idescr) : m_description(idescr){} 00009 00010 void KeyList::load(std::vector<unsigned long long> const & keys) { 00011 m_sequence.db().transaction().start(true); 00012 m_data.resize(keys.size()); 00013 for (size_t i=0; i<keys.size(); ++i) { 00014 m_data[i].reset(); 00015 if (keys[i]!=0) { 00016 IOVSequence::const_iterator p = m_sequence.iov().findSince(keys[i]); 00017 if (p!=m_sequence.iov().iovs().end()) { 00018 m_data[i] = m_sequence.db().getTypedObject<Base>( (*p).wrapperToken() ); 00019 } 00020 } 00021 } 00022 m_sequence.db().transaction().commit(); 00023 } 00024 00025 00026 BaseKeyed const * KeyList::elem(int n) const { 00027 if (!m_data[n]) return 0; 00028 return m_data[n].get(); 00029 } 00030 00031 00032 }