ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TrigConf::QueryDefinition Class Reference

#include <TrigDBHelper.h>

Collaboration diagram for TrigConf::QueryDefinition:

Public Member Functions

void addToTableList (const std::string &table, const std::string &table_short="")
 
void extendCondition (const std::string &condext)
 
template<typename T >
void extendOutput (const std::string &fieldName)
 
template<typename T >
void extendBinding (const std::string &fieldName)
 
template<typename T >
void setBoundValue (const std::string &fieldName, const T &value)
 
std::unique_ptr< coral::IQuery > createQuery (coral::ISessionProxy *session)
 
void setDataName (const std::string &dataName)
 
const std::string & dataName ()
 

Private Attributes

std::vector< std::pair< std::string, std::string > > m_tables {}
 
std::string m_condition {""}
 
coral::AttributeList m_attList
 
coral::AttributeList m_bindList
 
std::string m_dataName
 
std::set< std::string > m_bound
 

Detailed Description

Definition at line 30 of file TrigDBHelper.h.

Member Function Documentation

◆ addToTableList()

void TrigConf::QueryDefinition::addToTableList ( const std::string &  table,
const std::string &  table_short = "" 
)

Definition at line 44 of file TrigDBHelper.cxx.

45 {
46  m_tables.emplace_back(table, table_short);
47 }

◆ createQuery()

std::unique_ptr< coral::IQuery > TrigConf::QueryDefinition::createQuery ( coral::ISessionProxy *  session)

Definition at line 13 of file TrigDBHelper.cxx.

14 {
15 
16  std::unique_ptr< coral::IQuery > query( session->nominalSchema().newQuery() );
17 
18  // set tables
19  for( auto & table : m_tables ) {
20  query->addToTableList( table.first, table.second );
21  }
22 
23  // ensure that all the requested variables are bound
24  for( auto & bindVar : m_bindList ) {
25  const std::string & fieldName = bindVar.specification().name();
26  if( m_bound.find( fieldName ) == m_bound.end() ) {
27  throw std::runtime_error( "Column " + fieldName + " has been bound, but not set to a value" );
28  }
29  }
30 
31  // condition
32  query->setCondition( m_condition, m_bindList );
33 
34  // output
35  query->defineOutput( m_attList );
36  for( const coral::Attribute & attr : m_attList ) {
37  query->addToOutputList(attr.specification().name());
38  }
39 
40  return query;
41 }

◆ dataName()

const std::string& TrigConf::QueryDefinition::dataName ( )
inline

Definition at line 53 of file TrigDBHelper.h.

53  {
54  return m_dataName;
55  }

◆ extendBinding()

template<typename T >
void TrigConf::QueryDefinition::extendBinding ( const std::string &  fieldName)

Definition at line 72 of file TrigDBHelper.h.

72  {
73  m_bindList.extend<T>( fieldName );
74  }

◆ extendCondition()

void TrigConf::QueryDefinition::extendCondition ( const std::string &  condext)

Definition at line 50 of file TrigDBHelper.cxx.

50  {
51  if( m_condition.size()>0 && condext.size()>0 && m_condition.back() != ' ' && condext[0] != ' ') {
52  m_condition += " ";
53  }
54  m_condition += condext;
55 }

◆ extendOutput()

template<typename T >
void TrigConf::QueryDefinition::extendOutput ( const std::string &  fieldName)

Definition at line 67 of file TrigDBHelper.h.

67  {
68  m_attList.extend<T>( fieldName );
69  }

◆ setBoundValue()

template<typename T >
void TrigConf::QueryDefinition::setBoundValue ( const std::string &  fieldName,
const T &  value 
)

Definition at line 77 of file TrigDBHelper.h.

77  {
78  m_bindList[fieldName].setValue(value);
79  m_bound.insert(fieldName);
80  }

◆ setDataName()

void TrigConf::QueryDefinition::setDataName ( const std::string &  dataName)
inline

Definition at line 49 of file TrigDBHelper.h.

49  {
51  }

Member Data Documentation

◆ m_attList

coral::AttributeList TrigConf::QueryDefinition::m_attList
private

Definition at line 60 of file TrigDBHelper.h.

◆ m_bindList

coral::AttributeList TrigConf::QueryDefinition::m_bindList
private

Definition at line 61 of file TrigDBHelper.h.

◆ m_bound

std::set<std::string> TrigConf::QueryDefinition::m_bound
private

Definition at line 63 of file TrigDBHelper.h.

◆ m_condition

std::string TrigConf::QueryDefinition::m_condition {""}
private

Definition at line 59 of file TrigDBHelper.h.

◆ m_dataName

std::string TrigConf::QueryDefinition::m_dataName
private

Definition at line 62 of file TrigDBHelper.h.

◆ m_tables

std::vector<std::pair<std::string,std::string> > TrigConf::QueryDefinition::m_tables {}
private

Definition at line 58 of file TrigDBHelper.h.


The documentation for this class was generated from the following files:
TrigConf::QueryDefinition::m_condition
std::string m_condition
Definition: TrigDBHelper.h:59
athena.value
value
Definition: athena.py:124
query
Definition: query.py:1
taskman.fieldName
fieldName
Definition: taskman.py:489
TrigConf::QueryDefinition::m_attList
coral::AttributeList m_attList
Definition: TrigDBHelper.h:60
TrigConf::QueryDefinition::m_bindList
coral::AttributeList m_bindList
Definition: TrigDBHelper.h:61
python.ext.table_printer.table
list table
Definition: table_printer.py:78
TrigConf::QueryDefinition::m_tables
std::vector< std::pair< std::string, std::string > > m_tables
Definition: TrigDBHelper.h:58
index.query
query
Definition: index.py:72
TrigConf::QueryDefinition::m_dataName
std::string m_dataName
Definition: TrigDBHelper.h:62
TrigConf::QueryDefinition::m_bound
std::set< std::string > m_bound
Definition: TrigDBHelper.h:63
TrigConf::QueryDefinition::dataName
const std::string & dataName()
Definition: TrigDBHelper.h:53
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35