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 std::shared_ptr< SessionImpl > &session)
 
 GTProxy (const GTProxy &rhs)
 
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() {}
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113

◆ 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) {}
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113

◆ 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) {}
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113

Member Function Documentation

◆ begin()

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

Definition at line 146 of file GTProxy.cc.

References m_data.

146  {
147  if (m_data.get()) {
148  return Iterator(m_data->tagList.begin());
149  }
150  return Iterator();
151  }
TGeoIterator Iterator
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ checkTransaction()

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

Definition at line 139 of file GTProxy.cc.

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

Referenced by load().

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  }
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ end()

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

Definition at line 153 of file GTProxy.cc.

References m_data.

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

153  {
154  if (m_data.get()) {
155  return Iterator(m_data->tagList.end());
156  }
157  return Iterator();
158  }
TGeoIterator Iterator
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ 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.

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().

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  }
void checkTransaction(const std::string &ctx)
Definition: GTProxy.cc:139
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ name()

std::string GTProxy::name ( ) const

◆ operator=()

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

Definition at line 83 of file GTProxy.cc.

References m_data, and m_session.

83  {
84  m_data = rhs.m_data;
85  m_session = rhs.m_session;
86  return *this;
87  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:113

◆ reload()

void GTProxy::reload ( )

Definition at line 123 of file GTProxy.cc.

References load(), and m_data.

123 { load(m_data->name); }
void load(const std::string &gtName, const std::string &preFix="", const std::string &postFix="")
Definition: GTProxy.cc:107
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ reset()

void GTProxy::reset ( void  )

Definition at line 125 of file GTProxy.cc.

References m_data.

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

125  {
126  if (m_data.get()) {
127  m_data->tagList.clear();
128  }
129  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ size()

int GTProxy::size ( void  ) const

Definition at line 160 of file GTProxy.cc.

References m_data.

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

160 { return m_data.get() ? m_data->tagList.size() : 0; }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ snapshotTime()

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

Definition at line 135 of file GTProxy.cc.

References m_data.

Referenced by CondDBESSource::fillTagCollectionFromGT().

135  {
136  return m_data.get() ? m_data->snapshotTime : boost::posix_time::ptime();
137  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

◆ validity()

cond::Time_t GTProxy::validity ( ) const

Definition at line 133 of file GTProxy.cc.

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

133 { return m_data.get() ? m_data->validity : cond::time::MIN_VAL; }
const Time_t MIN_VAL(0)
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:112

Member Data Documentation

◆ m_data

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

Definition at line 112 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 113 of file GTProxy.h.

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