CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
cond::persistency::RunInfoProxy Class Reference

#include <RunInfoProxy.h>

Classes

class  Iterator
 

Public Types

typedef std::vector< std::tuple< Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > RunInfoData
 

Public Member Functions

Iterator begin () const
 
Iterator end () const
 
Iterator find (Time_t target) const
 
Iterator find (const boost::posix_time::ptime &target) const
 
cond::RunInfo_t get (Time_t target) const
 
cond::RunInfo_t get (const boost::posix_time::ptime &target) const
 
void load (Time_t low, Time_t up)
 
void load (const boost::posix_time::ptime &low, const boost::posix_time::ptime &up)
 
RunInfoProxyoperator= (const RunInfoProxy &rhs)
 
void reset ()
 
 RunInfoProxy ()
 
 RunInfoProxy (const std::shared_ptr< SessionImpl > &session)
 
 RunInfoProxy (const RunInfoProxy &rhs)
 
int size () const
 

Private Member Functions

void checkTransaction (const std::string &ctx)
 

Private Attributes

std::shared_ptr< RunInfoProxyDatam_data
 
std::shared_ptr< SessionImplm_session
 

Detailed Description

Definition at line 26 of file RunInfoProxy.h.

Member Typedef Documentation

typedef std::vector<std::tuple<Time_t,boost::posix_time::ptime,boost::posix_time::ptime> > cond::persistency::RunInfoProxy::RunInfoData

Definition at line 28 of file RunInfoProxy.h.

Constructor & Destructor Documentation

RunInfoProxy::RunInfoProxy ( )

Definition at line 64 of file RunInfoProxy.cc.

64  :
65  m_data(),
66  m_session(){
67  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
RunInfoProxy::RunInfoProxy ( const std::shared_ptr< SessionImpl > &  session)
explicit

Definition at line 69 of file RunInfoProxy.cc.

69  :
70  m_data( new RunInfoProxyData ),
71  m_session( session ){
72  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
RunInfoProxy::RunInfoProxy ( const RunInfoProxy rhs)

Definition at line 74 of file RunInfoProxy.cc.

74  :
75  m_data( rhs.m_data ),
76  m_session( rhs.m_session ){
77  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102

Member Function Documentation

RunInfoProxy::Iterator RunInfoProxy::begin ( void  ) const

Definition at line 121 of file RunInfoProxy.cc.

References m_data.

121  {
122  if( m_data.get() ){
123  return Iterator( m_data->runList.begin() );
124  }
125  return Iterator();
126  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
void RunInfoProxy::checkTransaction ( const std::string &  ctx)
private

Definition at line 116 of file RunInfoProxy.cc.

References m_session, and cond::persistency::throwException().

Referenced by load().

116  {
117  if( !m_session.get() ) throwException("The session is not active.",ctx );
118  if( !m_session->isTransactionActive( false ) ) throwException("The transaction is not active.",ctx );
119  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
RunInfoProxy::Iterator RunInfoProxy::end ( void  ) const

Definition at line 128 of file RunInfoProxy.cc.

References m_data.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::fill(), and get().

128  {
129  if( m_data.get() ){
130  return Iterator( m_data->runList.end() );
131  }
132  return Iterator();
133  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
RunInfoProxy::Iterator RunInfoProxy::find ( Time_t  target) const

Definition at line 149 of file RunInfoProxy.cc.

References m_data, AlCaHLTBitMon_ParallelJobs::p, and edmPickEvents::target.

Referenced by BeautifulSoup.Tag::__getattr__(), cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::fill(), BeautifulSoup.Tag::firstText(), and get().

149  {
150  if( m_data.get() ){
151  auto p = std::lower_bound( m_data->runList.begin(), m_data->runList.end(), target, IOVRunComp() );
152  return Iterator( p );
153  }
154  return Iterator();
155  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
RunInfoProxy::Iterator RunInfoProxy::find ( const boost::posix_time::ptime &  target) const

Definition at line 157 of file RunInfoProxy.cc.

References m_data, AlCaHLTBitMon_ParallelJobs::p, and edmPickEvents::target.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

157  {
158  if( m_data.get() ){
159  auto p = std::lower_bound( m_data->runList.begin(), m_data->runList.end(), target, IOVTimeComp() );
160  return Iterator( p );
161  }
162  return Iterator();
163  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
cond::RunInfo_t RunInfoProxy::get ( Time_t  target) const

Definition at line 166 of file RunInfoProxy.cc.

References end(), find(), and cond::persistency::throwException().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

166  {
167  Iterator it = find( target );
168  if( it == Iterator() ) throwException("No data has been found.","RunInfoProxy::get(Time_t)" );
169  if( it == end() ) throwException("The target run has not been found in the selected run range.","RunInfoProxy::get(Time_t)" );
170  return *it;
171  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
cond::RunInfo_t RunInfoProxy::get ( const boost::posix_time::ptime &  target) const

Definition at line 174 of file RunInfoProxy.cc.

References end(), find(), and cond::persistency::throwException().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

174  {
175  Iterator it = find( target );
176  if( it == Iterator() ) throwException("No data has been found.","RunInfoProxy::get(const boost::posix_time::ptime&)" );
177  if( it == end() ) throwException("The target time has not been found in the selected time range.","RunInfoProxy::get(const boost::posix_time::ptime&)" );
178  return *it;
179  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
void RunInfoProxy::load ( Time_t  low,
Time_t  up 
)

Definition at line 86 of file RunInfoProxy.cc.

References checkTransaction(), m_data, m_session, reset(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), cond::persistency::Session::getRunInfo(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

86  {
87  if( !m_data.get() ) return;
88 
89  // clear
90  reset();
91 
92  checkTransaction( "RunInfoProxy::load(Time_t,Time_t)" );
93 
95  m_session->runInfoSchema().runInfoTable().getInclusiveRunRange( low, up, m_data->runList );
96  }
Definition: BitonicSort.h:8
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
void checkTransaction(const std::string &ctx)
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
void RunInfoProxy::load ( const boost::posix_time::ptime &  low,
const boost::posix_time::ptime &  up 
)

Definition at line 98 of file RunInfoProxy.cc.

References checkTransaction(), m_data, m_session, reset(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

98  {
99  if( !m_data.get() ) return;
100 
101  // clear
102  reset();
103 
104  checkTransaction( "RunInfoProxy::load(const boost::posix_time::ptime&,const boost::posix_time::ptime&)" );
105 
107  m_session->runInfoSchema().runInfoTable().getInclusiveTimeRange( low, up, m_data->runList );
108  }
Definition: BitonicSort.h:8
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
void checkTransaction(const std::string &ctx)
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
RunInfoProxy & RunInfoProxy::operator= ( const RunInfoProxy rhs)

Definition at line 79 of file RunInfoProxy.cc.

References m_data, and m_session.

79  {
80  m_data = rhs.m_data;
81  m_session = rhs.m_session;
82  return *this;
83  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:103
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
void RunInfoProxy::reset ( void  )

Definition at line 110 of file RunInfoProxy.cc.

References m_data.

Referenced by MatrixReader.MatrixReader::__init__(), load(), data_sources.json_list::next(), and MatrixReader.MatrixReader::showRaw().

110  {
111  if( m_data.get() ){
112  m_data->runList.clear();
113  }
114  }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102
int RunInfoProxy::size ( void  ) const

Definition at line 183 of file RunInfoProxy.cc.

References m_data.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

183  {
184  return m_data.get()? m_data->runList.size() : 0;
185  }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:102

Member Data Documentation

std::shared_ptr<RunInfoProxyData> cond::persistency::RunInfoProxy::m_data
private

Definition at line 102 of file RunInfoProxy.h.

Referenced by begin(), end(), find(), load(), operator=(), reset(), and size().

std::shared_ptr<SessionImpl> cond::persistency::RunInfoProxy::m_session
private

Definition at line 103 of file RunInfoProxy.h.

Referenced by checkTransaction(), load(), and operator=().