CMS 3D CMS Logo

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

#include <GTProxy.h>

Classes

class  Iterator
 

Public Types

typedef std::vector< std::tuple< std::string, std::string, std::string > > GTContainer
 

Public Member Functions

Iterator begin () const
 
Iterator end () const
 
 GTProxy ()
 
 GTProxy (const GTProxy &rhs)
 
 GTProxy (const std::shared_ptr< SessionImpl > &session)
 
void load (const std::string &gtName, const std::string &preFix="", const std::string &postFix="")
 
std::string name () const
 
GTProxyoperator= (const GTProxy &rhs)
 
void reload ()
 
void reset ()
 
int size () const
 
boost::posix_time::ptime snapshotTime () const
 
cond::Time_t validity () const
 

Private Member Functions

void checkTransaction (const std::string &ctx)
 

Private Attributes

std::shared_ptr< GTProxyDatam_data
 
std::shared_ptr< SessionImplm_session
 

Detailed Description

Definition at line 32 of file GTProxy.h.

Member Typedef Documentation

◆ GTContainer

typedef std::vector<std::tuple<std::string, std::string, std::string> > cond::persistency::GTProxy::GTContainer

Definition at line 34 of file GTProxy.h.

Constructor & Destructor Documentation

◆ GTProxy() [1/3]

GTProxy::GTProxy ( )

Definition at line 77 of file GTProxy.cc.

77 : m_data(), m_session() {}

◆ GTProxy() [2/3]

GTProxy::GTProxy ( const std::shared_ptr< SessionImpl > &  session)
explicit

Definition at line 79 of file GTProxy.cc.

79 : m_data(new GTProxyData), m_session(session) {}

◆ GTProxy() [3/3]

GTProxy::GTProxy ( const GTProxy rhs)

Definition at line 81 of file GTProxy.cc.

81 : m_data(rhs.m_data), m_session(rhs.m_session) {}

Member Function Documentation

◆ begin()

GTProxy::Iterator GTProxy::begin ( void  ) const

Definition at line 146 of file GTProxy.cc.

146  {
147  if (m_data.get()) {
148  return Iterator(m_data->tagList.begin());
149  }
150  return Iterator();
151  }

References m_data.

◆ checkTransaction()

void GTProxy::checkTransaction ( const std::string &  ctx)
private

Definition at line 139 of file GTProxy.cc.

139  {
140  if (!m_session.get())
141  throwException("The session is not active.", ctx);
142  if (!m_session->isTransactionActive(false))
143  throwException("The transaction is not active.", ctx);
144  }

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

Referenced by load().

◆ end()

GTProxy::Iterator GTProxy::end ( void  ) const

Definition at line 153 of file GTProxy.cc.

153  {
154  if (m_data.get()) {
155  return Iterator(m_data->tagList.end());
156  }
157  return Iterator();
158  }

References m_data.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

◆ load()

void GTProxy::load ( const std::string &  gtName,
const std::string &  pref = "",
const std::string &  postf = "" 
)

this will be the final function void GTProxy::load( const std::string& gtName ){ clear reset();

checkSession( "GTProxy::load" );

if(!m_session->gtSchema().gtTable().select( gtName, m_data->validity, m_data->snapshotTime ) ){ throwException( "Global Tag \""+gtName+"" has not been found in the database.","GTProxy::load"); } m_data->name = gtName;

m_session->gtSchema().gtMapTable().select( m_data->name, m_data->tagList );

}

Definition at line 107 of file GTProxy.cc.

107  {
108  // clear
109  reset();
110 
111  checkTransaction("GTProxy::load");
112 
113  if (!m_session->gtSchema().gtTable().select(gtName, m_data->validity, m_data->snapshotTime)) {
114  throwException("Global Tag \"" + gtName + "\" has not been found in the database.", "GTProxy::load");
115  }
116  m_data->name = gtName;
117  m_data->preFix = pref;
118  m_data->postFix = postf;
119 
120  m_session->gtSchema().gtMapTable().select(m_data->name, pref, postf, m_data->tagList);
121  }

References checkTransaction(), m_data, m_session, reset(), and cond::persistency::throwException().

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

◆ name()

std::string GTProxy::name ( ) const

◆ operator=()

GTProxy & GTProxy::operator= ( const GTProxy rhs)

Definition at line 83 of file GTProxy.cc.

83  {
84  m_data = rhs.m_data;
85  m_session = rhs.m_session;
86  return *this;
87  }

References m_data, and m_session.

◆ reload()

void GTProxy::reload ( )

Definition at line 123 of file GTProxy.cc.

123 { load(m_data->name); }

References load(), and m_data.

◆ reset()

void GTProxy::reset ( void  )

Definition at line 125 of file GTProxy.cc.

125  {
126  if (m_data.get()) {
127  m_data->tagList.clear();
128  }
129  }

References m_data.

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

◆ size()

int GTProxy::size ( void  ) const

Definition at line 160 of file GTProxy.cc.

160 { return m_data.get() ? m_data->tagList.size() : 0; }

References m_data.

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

◆ snapshotTime()

boost::posix_time::ptime GTProxy::snapshotTime ( ) const

Definition at line 135 of file GTProxy.cc.

135  {
136  return m_data.get() ? m_data->snapshotTime : boost::posix_time::ptime();
137  }

References m_data.

Referenced by CondDBESSource::fillTagCollectionFromGT().

◆ validity()

cond::Time_t GTProxy::validity ( ) const

Definition at line 133 of file GTProxy.cc.

133 { return m_data.get() ? m_data->validity : cond::time::MIN_VAL; }

References m_data, and cond::time::MIN_VAL().

Member Data Documentation

◆ m_data

std::shared_ptr<GTProxyData> cond::persistency::GTProxy::m_data
private

Definition at line 105 of file GTProxy.h.

Referenced by begin(), end(), load(), name(), operator=(), reload(), reset(), size(), snapshotTime(), and validity().

◆ m_session

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

Definition at line 106 of file GTProxy.h.

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

cond::time::MIN_VAL
const Time_t MIN_VAL(0)
cond::persistency::GTProxy::reset
void reset()
Definition: GTProxy.cc:125
cond::persistency::GTProxy::checkTransaction
void checkTransaction(const std::string &ctx)
Definition: GTProxy.cc:139
cms::Iterator
TGeoIterator Iterator
Definition: DDFilteredView.h:49
cond::persistency::GTProxy::m_data
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:105
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::GTProxy::load
void load(const std::string &gtName, const std::string &preFix="", const std::string &postFix="")
Definition: GTProxy.cc:107
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
cond::persistency::GTProxy::m_session
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:106