CMS 3D CMS Logo

l1t::OMDSReader Class Reference

#include <CondTools/L1Trigger/interface/OMDSReader.h>

Inheritance diagram for l1t::OMDSReader:

l1t::DataManager

List of all members.

Public Types

typedef std::pair< std::vector
< std::string >, std::vector
< coral::AttributeList > > 
QueryResults

Public Member Functions

const QueryResults basicQuery (const std::string &columnName, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
const QueryResults basicQuery (const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
 OMDSReader (const std::string &connectString, const std::string &authenticationPath)
const QueryResults singleAttribute (const std::string &data) const
virtual ~OMDSReader ()

Private Member Functions

 OMDSReader (const OMDSReader &)
const OMDSReaderoperator= (const OMDSReader &)

Private Attributes

cond::CoralTransactionm_coralTransaction


Detailed Description

Definition at line 39 of file OMDSReader.h.


Member Typedef Documentation

typedef std::pair< std::vector< std::string >, std::vector< coral::AttributeList > > l1t::OMDSReader::QueryResults

Definition at line 58 of file OMDSReader.h.


Constructor & Destructor Documentation

OMDSReader::OMDSReader ( const std::string &  connectString,
const std::string &  authenticationPath 
)

Definition at line 37 of file OMDSReader.cc.

References l1t::DataManager::connection, cond::Connection::coralTransaction(), m_coralTransaction, and cond::CoralTransaction::start().

00039     : DataManager( connectString, authenticationPath, true )
00040   {
00041     m_coralTransaction = &( connection->coralTransaction() ) ;
00042     m_coralTransaction->start( true ) ;
00043   }

OMDSReader::~OMDSReader (  )  [virtual]

Definition at line 50 of file OMDSReader.cc.

00051 {
00052 }

l1t::OMDSReader::OMDSReader ( const OMDSReader  )  [private]


Member Function Documentation

const OMDSReader::QueryResults OMDSReader::basicQuery ( const std::string &  columnName,
const std::string &  schemaName,
const std::string &  tableName,
const std::string &  conditionLHS = "",
const QueryResults  conditionRHS = QueryResults(),
const std::string &  conditionRHSName = "" 
) const

Definition at line 136 of file OMDSReader.cc.

00143   {
00144     std::vector< std::string > columnNames ;
00145     columnNames.push_back( columnName ) ;
00146     return basicQuery( columnNames, schemaName, tableName,
00147                         conditionLHS, conditionRHS, conditionRHSName ) ;
00148   }

const OMDSReader::QueryResults OMDSReader::basicQuery ( const std::vector< std::string > &  columnNames,
const std::string &  schemaName,
const std::string &  tableName,
const std::string &  conditionLHS = "",
const QueryResults  conditionRHS = QueryResults(),
const std::string &  conditionRHSName = "" 
) const

Definition at line 75 of file OMDSReader.cc.

References end, it, python::listobjects::schema, and edm::table.

Referenced by L1TriggerKeyOnlineProd::produce(), and L1TriggerConfigOnlineProd::produceL1RCTParameters().

00082   {
00083     coral::ISchema& schema = schemaName.empty() ?
00084       m_coralTransaction->nominalSchema() :
00085       m_coralTransaction->coralSessionProxy().schema( schemaName ) ;
00086 
00087     coral::ITable& table = schema.tableHandle( tableName ) ;
00088 
00089     // Pointer is deleted automatically at end of function.
00090     boost::shared_ptr< coral::IQuery > query( table.newQuery() ) ;
00091 
00092     // Construct query
00093     std::vector< std::string >::const_iterator it = columnNames.begin() ;
00094     std::vector< std::string >::const_iterator end = columnNames.end() ;
00095     for( ; it != end ; ++it )
00096       {
00097         query->addToOutputList( *it ) ;
00098       }
00099 
00100     // Only apply condition if RHS has one row.
00101     if( !conditionLHS.empty() && conditionRHS.second.size() == 1 )
00102       {
00103         if( !conditionRHSName.empty() )
00104           {
00105             coral::AttributeList attList ;
00106             attList.extend( conditionRHSName, typeid( std::string ) ) ;
00107             attList[ conditionRHSName ].data< std::string >() =
00108               conditionRHS.second.front()[ conditionRHSName ].data< std::string >() ;
00109 
00110             query->setCondition( conditionLHS + " = :" + conditionRHSName,
00111                                  attList ) ;
00112             //                           conditionRHS.second.front() ) ;
00113           }
00114         else if( conditionRHS.first.size() == 1 ) // check for only one column
00115           {
00116             query->setCondition( conditionLHS + " = :" +
00117                                     conditionRHS.first.front(),
00118                                  conditionRHS.second.front() ) ;
00119           }
00120       }
00121 
00122     coral::ICursor& cursor = query->execute() ;
00123 
00124     // Copy AttributeLists for external use because the cursor is deleted
00125     // when the query goes out of scope.
00126     std::vector< coral::AttributeList > atts ;
00127     while( cursor.next() )
00128       {
00129         atts.push_back( cursor.currentRow() ) ;
00130       } ;
00131 
00132     return std::make_pair( columnNames, atts ) ;
00133   }

const OMDSReader& l1t::OMDSReader::operator= ( const OMDSReader  )  [private]

const OMDSReader::QueryResults OMDSReader::singleAttribute ( const std::string &  data  )  const

Definition at line 151 of file OMDSReader.cc.

References names.

Referenced by L1TriggerKeyOnlineProd::produce(), and L1TriggerConfigOnlineProd::produceL1RCTParameters().

00152   {
00153     std::vector< std::string > names ;
00154     names.push_back( "dummy" ) ;
00155 
00156     coral::AttributeList attList ;
00157     attList.extend( "dummy", typeid( std::string ) ) ;
00158     attList[ "dummy" ].data< std::string >() = data ;
00159 
00160     std::vector< coral::AttributeList > atts ;
00161     atts.push_back( attList ) ;
00162 
00163     return std::make_pair( names, atts ) ;
00164   }


Member Data Documentation

cond::CoralTransaction* l1t::OMDSReader::m_coralTransaction [private]

Definition at line 103 of file OMDSReader.h.

Referenced by OMDSReader().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:48:01 2009 for CMSSW by  doxygen 1.5.4