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::persistency::KeyList Class Reference

#include <KeyList.h>

Public Member Functions

template<typename T >
boost::shared_ptr< Tget (size_t n) const
 
void init (IOVProxy iovProxy)
 
void load (const std::vector< unsigned long long > &keys)
 
size_t size () const
 

Private Attributes

std::map< size_t, std::pair
< std::string, std::pair
< cond::Binary, cond::Binary > > > 
m_data
 
bool m_isOra = false
 
std::vector< boost::shared_ptr
< void > > 
m_objects
 
IOVProxy m_proxy
 

Detailed Description

Definition at line 31 of file KeyList.h.

Member Function Documentation

template<typename T >
boost::shared_ptr<T> cond::persistency::KeyList::get ( size_t  n) const
inline

Definition at line 39 of file KeyList.h.

References i, m_data, m_isOra, m_objects, gen::n, size(), and cond::persistency::throwException().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), DTUserKeyedConfigPopConAnalyzer::analyze(), DTKeyedConfigPopConAnalyzer::analyze(), DTKeyedConfigDBDump::analyze(), DTUserKeyedConfigHandler::chkConfigList(), DTKeyedConfigHandler::chkConfigList(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), DTKeyedConfigCache::get(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

39  {
40  if( n >= size() ) throwException( "Index outside the bounds of the key array.",
41  "KeyList::get");
42  if( !m_objects[n] ){
43  auto i = m_data.find( n );
44  if( i != m_data.end() ){
45  m_objects[n] = deserialize<T>( i->second.first, i->second.second.first, i->second.second.second, m_isOra );
46  m_data.erase( n );
47  } else {
48  throwException( "Payload for index "+boost::lexical_cast<std::string>(n)+" has not been found.",
49  "KeyList::get");
50  }
51  }
52  return boost::static_pointer_cast<T>( m_objects[n] );
53  }
size_t size() const
Definition: KeyList.h:55
int i
Definition: DBlmapReader.cc:9
std::map< size_t, std::pair< std::string, std::pair< cond::Binary, cond::Binary > > > m_data
Definition: KeyList.h:61
std::vector< boost::shared_ptr< void > > m_objects
Definition: KeyList.h:62
long double T
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
void cond::persistency::KeyList::init ( IOVProxy  iovProxy)

Definition at line 8 of file KeyList.cc.

References m_data, m_objects, and m_proxy.

8  {
9  m_proxy = iovProxy;
10  m_data.clear();
11  m_objects.clear();
12  }
std::map< size_t, std::pair< std::string, std::pair< cond::Binary, cond::Binary > > > m_data
Definition: KeyList.h:61
std::vector< boost::shared_ptr< void > > m_objects
Definition: KeyList.h:62
void cond::persistency::KeyList::load ( const std::vector< unsigned long long > &  keys)

Definition at line 14 of file KeyList.cc.

References cond::persistency::Transaction::commit(), cond::persistency::IOVProxy::end(), cond::persistency::Session::fetchPayloadData(), cond::persistency::IOVProxy::find(), i, cond::persistency::Session::isOraSession(), m_data, m_isOra, m_objects, m_proxy, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, cond::persistency::IOVProxy::session(), cond::persistency::Transaction::start(), cond::throwException(), and cond::persistency::Session::transaction().

Referenced by DTKeyedConfigDBDump::analyze(), DTUserKeyedConfigHandler::chkConfigList(), DTKeyedConfigHandler::chkConfigList(), DTKeyedConfigCache::get(), MatrixToProcess.MatrixToProcess::getProcess(), and MatrixToProcess.MatrixToProcess::listAll().

14  {
15  std::shared_ptr<SessionImpl> simpl = m_proxy.session();
16  if( !simpl.get() ) cond::throwException("The KeyList has not been initialized.","KeyList::load");
17  Session s( simpl );
18  s.transaction().start( true );
19  m_isOra = s.isOraSession();
20  m_data.clear();
21  m_objects.resize(keys.size());
22  for (size_t i=0; i<keys.size(); ++i) {
23  m_objects[i].reset();
24  if (keys[i]!=0) {
25  auto p = m_proxy.find(keys[i]);
26  if ( p!= m_proxy.end()) {
27  auto item = m_data.insert( std::make_pair( i, std::make_pair("",std::make_pair(cond::Binary(),cond::Binary()) ) ) );
28  if( ! s.fetchPayloadData( (*p).payloadId, item.first->second.first,
29  item.first->second.second.first, item.first->second.second.second ) )
30  cond::throwException("The Iov contains a broken payload reference.","KeyList::load");
31  }
32  }
33  }
34  s.transaction().commit();
35  }
int i
Definition: DBlmapReader.cc:9
std::map< size_t, std::pair< std::string, std::pair< cond::Binary, cond::Binary > > > m_data
Definition: KeyList.h:61
Iterator find(cond::Time_t time)
Definition: IOVProxy.cc:288
std::vector< boost::shared_ptr< void > > m_objects
Definition: KeyList.h:62
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
Iterator end() const
Definition: IOVProxy.cc:265
const std::shared_ptr< SessionImpl > & session() const
Definition: IOVProxy.cc:361
size_t cond::persistency::KeyList::size ( void  ) const
inline

Definition at line 55 of file KeyList.h.

References m_objects.

Referenced by DTUserKeyedConfigPopConAnalyzer::analyze(), DTKeyedConfigPopConAnalyzer::analyze(), and get().

55 { return m_objects.size();}
std::vector< boost::shared_ptr< void > > m_objects
Definition: KeyList.h:62

Member Data Documentation

std::map<size_t,std::pair<std::string,std::pair<cond::Binary,cond::Binary> > > cond::persistency::KeyList::m_data
mutableprivate

Definition at line 61 of file KeyList.h.

Referenced by get(), init(), and load().

bool cond::persistency::KeyList::m_isOra = false
private

Definition at line 63 of file KeyList.h.

Referenced by get(), and load().

std::vector<boost::shared_ptr<void> > cond::persistency::KeyList::m_objects
mutableprivate

Definition at line 62 of file KeyList.h.

Referenced by get(), init(), load(), and size().

IOVProxy cond::persistency::KeyList::m_proxy
private

Definition at line 59 of file KeyList.h.

Referenced by init(), and load().