7 #include "RelationalAccess/IColumn.h"
8 #include "RelationalAccess/ITableDescription.h"
22 m_schemaversion = triggerDBSchemaVersion();
30 loadSequences( sequences );
44 TRG_MSG_INFO(
"Start loading sequences with SMK " << m_smk);
46 coral::ITable & teTable = m_session.nominalSchema().tableHandle(
"HLT_TRIGGER_ELEMENT");
48 const coral::ITableDescription &
desc = teTable.description();
50 bool hasTopoStartsFrom =
false;
52 desc.columnDescription(
"HTE_TOPO_START_FROM");
53 hasTopoStartsFrom =
true;
55 catch(coral::InvalidColumnNameException & ex) { }
61 TRG_MSG_INFO(
"Found HTE_TOPO_START_FROM : " << (hasTopoStartsFrom ?
"true" :
"false") );
63 unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
65 q->addToTableList (
"SUPER_MASTER_TABLE" ,
"SM");
66 q->addToTableList (
"HLT_MASTER_TABLE" ,
"HM");
67 q->addToTableList (
"HLT_TM_TO_TC" ,
"M2C");
68 q->addToTableList (
"HLT_TC_TO_TS" ,
"TC2TS");
69 q->addToTableList (
"HLT_TS_TO_TE" ,
"S2TE");
70 q->addToTableList (
"HLT_TRIGGER_ELEMENT" ,
"TE");
71 q->addToTableList (
"HLT_TE_TO_CP" ,
"TE2CP");
72 q->addToTableList (
"HLT_TE_TO_TE" ,
"TE2TE");
73 q->addToTableList (
"HLT_COMPONENT" ,
"CP");
77 bindings.extend<
int>(
"smid");
78 bindings[0].data<
int>() = (
int)m_smk;
80 string theCondition =
"";
81 theCondition +=
" SM.SMT_ID = :smid";
82 theCondition +=
" AND HM.HMT_ID = SM.SMT_HLT_MASTER_TABLE_ID";
83 theCondition +=
" AND HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID";
84 theCondition +=
" AND M2C.HTM2TC_TRIGGER_CHAIN_ID = TC2TS.HTC2TS_TRIGGER_CHAIN_ID";
85 theCondition +=
" AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID";
86 theCondition +=
" AND TE.HTE_ID = S2TE.HTS2TE_TRIGGER_ELEMENT_ID";
87 theCondition +=
" AND TE.HTE_ID = TE2CP.HTE2CP_TRIGGER_ELEMENT_ID";
88 theCondition +=
" AND TE.HTE_ID = TE2TE.HTE2TE_TE_ID";
89 theCondition +=
" AND CP.HCP_ID = TE2CP.HTE2CP_COMPONENT_ID";
91 q->setCondition( theCondition, bindings );
95 attList.extend<
int> (
"TE.HTE_ID" );
96 attList.extend<
string>(
"TE.HTE_NAME" );
98 attList.extend<
string>(
"TE.HTE_TOPO_START_FROM" );
99 attList.extend<
string>(
"CP.HCP_NAME" );
100 attList.extend<
string>(
"CP.HCP_ALIAS" );
101 attList.extend<
int> (
"TE2CP.HTE2CP_ALGORITHM_COUNTER" );
102 attList.extend<
string>(
"TE2TE.HTE2TE_TE_INP_ID" );
103 attList.extend<
string>(
"TE2TE.HTE2TE_TE_INP_TYPE" );
104 attList.extend<
int> (
"TE2TE.HTE2TE_TE_COUNTER" );
108 q->addToOrderList(
"TE.HTE_ID ASC, TE2CP.HTE2CP_ALGORITHM_COUNTER DESC, TE2TE.HTE2TE_TE_COUNTER DESC" );
112 coral::ICursor&
cursor =
q->execute();
123 string te_name =
rmtilde(
row[
"TE.HTE_NAME"].data<string>());
128 if(hasTopoStartsFrom) {
129 string topo_start_from =
rmtilde(
row[
"TE.HTE_TOPO_START_FROM"].data<string>());
130 if( !topo_start_from.empty())
136 string alg_name =
row[
"CP.HCP_NAME"].data<
string>() +
"/" +
row[
"CP.HCP_ALIAS"].data<string>();
137 unsigned int alg_pos =
row[
"TE2CP.HTE2CP_ALGORITHM_COUNTER"].data<
int>();
139 vector<string>& alg_list =
seq->algorithms();
140 if( alg_list.size() < alg_pos+1 )
141 alg_list.resize( alg_pos+1,
"" );
143 if(
auto &algitem = alg_list[alg_pos]; algitem.empty()) {
147 cerr <<
"Two different algs in the same position " << alg_pos << endl;
151 string input_te =
rmtilde(
row[
"TE2TE.HTE2TE_TE_INP_ID"].data<string>());
152 if(!input_te.empty()) {
153 unsigned int input_te_pos =
row[
"TE2TE.HTE2TE_TE_COUNTER"].data<
int>();
155 vector<HLTTriggerElement*>& inp_list =
seq->inputTEs();
156 if( inp_list.size() < input_te_pos+1 )
159 if(
auto &
item = inp_list[input_te_pos];
item == 0) {
162 if(
item->name() != input_te ) {
163 cerr <<
"Two different input TE's at the same position " << input_te_pos << endl;
170 TRG_MSG_INFO(
"Loading " << seqlist.size() <<
" sequences");