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

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::GTProxy ( )

Definition at line 91 of file GTProxy.cc.

91  :
92  m_data(),
93  m_session(){
94  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105
GTProxy::GTProxy ( const std::shared_ptr< SessionImpl > &  session)
explicit

Definition at line 96 of file GTProxy.cc.

96  :
97  m_data( new GTProxyData ),
98  m_session( session ){
99  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105
GTProxy::GTProxy ( const GTProxy rhs)

Definition at line 101 of file GTProxy.cc.

101  :
102  m_data( rhs.m_data ),
103  m_session( rhs.m_session ){
104  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105

Member Function Documentation

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

Definition at line 175 of file GTProxy.cc.

References m_data.

175  {
176  if( m_data.get() ){
177  return Iterator( m_data->tagList.begin() );
178  }
179  return Iterator();
180  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
void GTProxy::checkTransaction ( const std::string &  ctx)
private

Definition at line 170 of file GTProxy.cc.

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

Referenced by load().

170  {
171  if( !m_session.get() ) throwException("The session is not active.",ctx );
172  if( !m_session->isTransactionActive( false ) ) throwException("The transaction is not active.",ctx );
173  }
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
GTProxy::Iterator GTProxy::end ( void  ) const

Definition at line 182 of file GTProxy.cc.

References m_data.

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

182  {
183  if( m_data.get() ){
184  return Iterator( m_data->tagList.end() );
185  }
186  return Iterator();
187  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
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 130 of file GTProxy.cc.

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

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

130  {
131  // clear
132  reset();
133 
134  checkTransaction( "GTProxy::load" );
135 
136  if(!m_session->gtSchema().gtTable().select( gtName, m_data->validity, m_data->snapshotTime ) ){
137  throwException( "Global Tag \""+gtName+"\" has not been found in the database.","GTProxy::load");
138  }
139  m_data->name = gtName;
140  m_data->preFix = pref;
141  m_data->postFix = postf;
142 
143  m_session->gtSchema().gtMapTable().select( m_data->name, pref, postf, m_data->tagList );
144 
145  }
void checkTransaction(const std::string &ctx)
Definition: GTProxy.cc:170
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
std::string GTProxy::name ( ) const
GTProxy & GTProxy::operator= ( const GTProxy rhs)

Definition at line 106 of file GTProxy.cc.

References m_data, and m_session.

106  {
107  m_data = rhs.m_data;
108  m_session = rhs.m_session;
109  return *this;
110  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
std::shared_ptr< SessionImpl > m_session
Definition: GTProxy.h:105
void GTProxy::reload ( )

Definition at line 148 of file GTProxy.cc.

References load(), and m_data.

148  {
149  load( m_data->name );
150  }
void load(const std::string &gtName, const std::string &preFix="", const std::string &postFix="")
Definition: GTProxy.cc:130
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
void GTProxy::reset ( void  )

Definition at line 152 of file GTProxy.cc.

References m_data.

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

152  {
153  if( m_data.get() ){
154  m_data->tagList.clear();
155  }
156  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
int GTProxy::size ( void  ) const

Definition at line 189 of file GTProxy.cc.

References m_data.

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

189  {
190  return m_data.get()? m_data->tagList.size() : 0;
191  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
boost::posix_time::ptime GTProxy::snapshotTime ( ) const

Definition at line 166 of file GTProxy.cc.

References m_data.

Referenced by CondDBESSource::fillTagCollectionFromGT().

166  {
167  return m_data.get() ? m_data->snapshotTime : boost::posix_time::ptime();
168  }
std::shared_ptr< GTProxyData > m_data
Definition: GTProxy.h:104
cond::Time_t GTProxy::validity ( ) const

Definition at line 162 of file GTProxy.cc.

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

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

Member Data Documentation

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

Definition at line 104 of file GTProxy.h.

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

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

Definition at line 105 of file GTProxy.h.

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