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 52 of file RunInfoProxy.cc.

52 : m_data(), m_session() {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
RunInfoProxy::RunInfoProxy ( const std::shared_ptr< SessionImpl > &  session)
explicit

Definition at line 54 of file RunInfoProxy.cc.

55  : m_data(new RunInfoProxyData), m_session(session) {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
RunInfoProxy::RunInfoProxy ( const RunInfoProxy rhs)

Definition at line 57 of file RunInfoProxy.cc.

57 : m_data(rhs.m_data), m_session(rhs.m_session) {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

Member Function Documentation

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

Definition at line 105 of file RunInfoProxy.cc.

References m_data.

105  {
106  if (m_data.get()) {
107  return Iterator(m_data->runList.begin());
108  }
109  return Iterator();
110  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
void RunInfoProxy::checkTransaction ( const std::string &  ctx)
private

Definition at line 98 of file RunInfoProxy.cc.

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

Referenced by load().

98  {
99  if (!m_session.get())
100  throwException("The session is not active.", ctx);
101  if (!m_session->isTransactionActive(false))
102  throwException("The transaction is not active.", ctx);
103  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
RunInfoProxy::Iterator RunInfoProxy::end ( void  ) const

Definition at line 112 of file RunInfoProxy.cc.

References m_data.

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

112  {
113  if (m_data.get()) {
114  return Iterator(m_data->runList.end());
115  }
116  return Iterator();
117  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
RunInfoProxy::Iterator RunInfoProxy::find ( Time_t  target) const

Definition at line 135 of file RunInfoProxy.cc.

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

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

135  {
136  if (m_data.get()) {
137  auto p = std::lower_bound(m_data->runList.begin(), m_data->runList.end(), target, IOVRunComp());
138  return Iterator(p);
139  }
140  return Iterator();
141  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
RunInfoProxy::Iterator RunInfoProxy::find ( const boost::posix_time::ptime &  target) const

Definition at line 143 of file RunInfoProxy.cc.

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

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

143  {
144  if (m_data.get()) {
145  auto p = std::lower_bound(m_data->runList.begin(), m_data->runList.end(), target, IOVTimeComp());
146  return Iterator(p);
147  }
148  return Iterator();
149  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
cond::RunInfo_t RunInfoProxy::get ( Time_t  target) const

Definition at line 152 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().

152  {
153  Iterator it = find(target);
154  if (it == Iterator())
155  throwException("No data has been found.", "RunInfoProxy::get(Time_t)");
156  if (it == end())
157  throwException("The target run has not been found in the selected run range.", "RunInfoProxy::get(Time_t)");
158  return *it;
159  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
cond::RunInfo_t RunInfoProxy::get ( const boost::posix_time::ptime &  target) const

Definition at line 162 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().

162  {
163  Iterator it = find(target);
164  if (it == Iterator())
165  throwException("No data has been found.", "RunInfoProxy::get(const boost::posix_time::ptime&)");
166  if (it == end())
167  throwException("The target time has not been found in the selected time range.",
168  "RunInfoProxy::get(const boost::posix_time::ptime&)");
169  return *it;
170  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
void RunInfoProxy::load ( Time_t  low,
Time_t  up 
)

Definition at line 66 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().

66  {
67  if (!m_data.get())
68  return;
69 
70  // clear
71  reset();
72 
73  checkTransaction("RunInfoProxy::load(Time_t,Time_t)");
74 
76  m_session->runInfoSchema().runInfoTable().getInclusiveRunRange(low, up, m_data->runList);
77  }
Definition: BitonicSort.h:7
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void checkTransaction(const std::string &ctx)
Definition: RunInfoProxy.cc:98
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
void RunInfoProxy::load ( const boost::posix_time::ptime &  low,
const boost::posix_time::ptime &  up 
)

Definition at line 79 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().

79  {
80  if (!m_data.get())
81  return;
82 
83  // clear
84  reset();
85 
86  checkTransaction("RunInfoProxy::load(const boost::posix_time::ptime&,const boost::posix_time::ptime&)");
87 
89  m_session->runInfoSchema().runInfoTable().getInclusiveTimeRange(low, up, m_data->runList);
90  }
Definition: BitonicSort.h:7
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void checkTransaction(const std::string &ctx)
Definition: RunInfoProxy.cc:98
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
RunInfoProxy & RunInfoProxy::operator= ( const RunInfoProxy rhs)

Definition at line 59 of file RunInfoProxy.cc.

References m_data, and m_session.

59  {
60  m_data = rhs.m_data;
61  m_session = rhs.m_session;
62  return *this;
63  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
void RunInfoProxy::reset ( void  )

Definition at line 92 of file RunInfoProxy.cc.

References m_data.

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

92  {
93  if (m_data.get()) {
94  m_data->runList.clear();
95  }
96  }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
int RunInfoProxy::size ( void  ) const

Definition at line 172 of file RunInfoProxy.cc.

References m_data.

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

172 { return m_data.get() ? m_data->runList.size() : 0; }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

Member Data Documentation

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

Definition at line 103 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 104 of file RunInfoProxy.h.

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