CMS 3D CMS Logo

LMFDefFabric.cc
Go to the documentation of this file.
7 
8 #include <iostream>
9 
11  noDebug();
12 }
13 
14 LMFDefFabric::LMFDefFabric(oracle::occi::Environment* env,
15  oracle::occi::Connection* conn) {
16  noDebug();
17  setConnection(env, conn);
18  initialize();
19 }
20 
22  noDebug();
23  setConnection(c->getEnv(), c->getConn());
24  initialize();
25 }
26 
28 }
29 
31  _debug = true;
32 }
33 
35  _debug = false;
36 }
37 
38 std::list<LMFColor> LMFDefFabric::getColors() const {
39  return _lmfColors;
40 }
41 
42 std::list<LMFTrigType> LMFDefFabric::getTriggerTypes() const {
43  return _lmfTrigTypes;
44 }
45 
46 std::list<LMFRunTag> LMFDefFabric::getRunTags() const {
47  return _lmfRunTags;
48 }
49 
51  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
52  std::list<LMFColor>::const_iterator e = _lmfColors.end();
53  LMFColor ret;
54  bool loop = true;
55  while ((loop) && (i != e)) {
56  if (i->getShortName() == name) {
57  ret = *i;
58  loop = false;
59  }
60  i++;
61  }
62  return ret;
63 }
64 
66  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
67  std::list<LMFColor>::const_iterator e = _lmfColors.end();
68  LMFColor ret;
69  bool loop = true;
70  while ((loop) && (i != e)) {
71  if (i->getID() == id) {
72  ret = *i;
73  loop = false;
74  }
75  i++;
76  }
77  return ret;
78 }
79 
81  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
82  std::list<LMFColor>::const_iterator e = _lmfColors.end();
83  LMFColor ret;
84  bool loop = true;
85  while ((loop) && (i != e)) {
86  if (i->getColorIndex() == index) {
87  ret = *i;
88  loop = false;
89  }
90  i++;
91  }
92  return ret;
93 }
94 
96  return getColor(sname).getID();
97 }
98 
100  return getColor(index).getID();
101 }
102 
104  return getTrigType(sname).getID();
105 }
106 
108  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
109  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
110  LMFTrigType tt;
111  bool loop = true;
112  while ((loop) && (i != e)) {
113  if (i->getShortName() == sname) {
114  tt = *i;
115  loop = false;
116  }
117  i++;
118  }
119  return tt;
120 }
121 
123  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
124  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
125  LMFTrigType tt;
126  bool loop = true;
127  while ((loop) && (i != e)) {
128  if (i->getID() == id) {
129  tt = *i;
130  loop = false;
131  }
132  i++;
133  }
134  return tt;
135 }
136 
138  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
139  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
140  LMFRunTag rt;
141  bool loop = true;
142  while ((loop) && (i != e)) {
143  if ((i->getGeneralTag()) == tag && (i->getVersion() == version)) {
144  rt = *i;
145  }
146  i++;
147  }
148  return rt;
149 }
150 
152  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
153  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
154  LMFRunTag rt;
155  bool loop = true;
156  while ((loop) && (i != e)) {
157  if (i->getID() == id) {
158  rt = *i;
159  }
160  i++;
161  }
162  return rt;
163 }
164 
166  return getRunTag(tag, version).getID();
167 }
168 
170  noexcept(false) {
171  _lmfColors.clear();
172  _lmfTrigTypes.clear();
173  _lmfRunTags.clear();
174  _lmfPrimVersions.clear();
175  _lmfSeqVersions.clear();
176  _lmfCorrVersions.clear();
177  if ((m_env != nullptr) && (m_conn != nullptr)) {
178  boost::ptr_list<LMFUnique> listOfObjects;
179  boost::ptr_list<LMFUnique>::const_iterator i;
180  boost::ptr_list<LMFUnique>::const_iterator e;
181  listOfObjects = LMFColor(m_env, m_conn).fetchAll();
182  i = listOfObjects.begin();
183  e = listOfObjects.end();
184  while (i != e) {
185  LMFColor *c = (LMFColor*)&(*i);
186  _lmfColors.push_back(*c);
187  i++;
188  }
189  listOfObjects.clear();
190  listOfObjects = LMFTrigType(m_env, m_conn).fetchAll();
191  i = listOfObjects.begin();
192  e = listOfObjects.end();
193  while (i != e) {
194  LMFTrigType *c = (LMFTrigType*)&(*i);
195  _lmfTrigTypes.push_back(*c);
196  i++;
197  }
198  listOfObjects.clear();
199  listOfObjects = LMFRunTag(m_env, m_conn).fetchAll();
200  i = listOfObjects.begin();
201  e = listOfObjects.end();
202  while (i != e) {
203  LMFRunTag *c = (LMFRunTag*)&(*i);
204  _lmfRunTags.push_back(*c);
205  i++;
206  }
207  listOfObjects.clear();
208  listOfObjects = LMFPrimVers(m_env, m_conn).fetchAll();
209  i = listOfObjects.begin();
210  e = listOfObjects.end();
211  while (i != e) {
212  LMFPrimVers *c = (LMFPrimVers*)&(*i);
213  _lmfPrimVersions.push_back(*c);
214  i++;
215  }
216  listOfObjects.clear();
217  listOfObjects = LMFCorrVers(m_env, m_conn).fetchAll();
218  i = listOfObjects.begin();
219  e = listOfObjects.end();
220  while (i != e) {
221  LMFCorrVers *c = (LMFCorrVers*)&(*i);
222  _lmfCorrVersions.push_back(*c);
223  i++;
224  }
225  listOfObjects.clear();
226  listOfObjects = LMFSeqVers(m_env, m_conn).fetchAll();
227  i = listOfObjects.begin();
228  e = listOfObjects.end();
229  while (i != e) {
230  LMFSeqVers *c = (LMFSeqVers*)&(*i);
231  _lmfSeqVersions.push_back(*c);
232  i++;
233  }
234  listOfObjects.clear();
235  _lmfColors.sort();
236  _lmfTrigTypes.sort();
237  _lmfRunTags.sort();
238  _lmfPrimVersions.sort();
239  _lmfSeqVersions.sort();
240  _lmfCorrVersions.sort();
241  } else {
242  throw(std::runtime_error("LMFDefFabric: cannot initialize since connection not"
243  "set"));
244  }
245 }
246 
248  std::cout << "========= Fabric dump @ address " << this << " ============"
249  << std::endl;
250  std::list<LMFColor>::const_iterator i1 = _lmfColors.begin();
251  std::list<LMFTrigType>::const_iterator i2 = _lmfTrigTypes.begin();
252  std::list<LMFRunTag>::const_iterator i3 = _lmfRunTags.begin();
253  std::list<LMFPrimVers>::const_iterator i4 = _lmfPrimVersions.begin();
254  std::list<LMFSeqVers>::const_iterator i5 = _lmfSeqVersions.begin();
255  std::list<LMFCorrVers>::const_iterator i6 = _lmfCorrVersions.begin();
256  std::list<LMFColor>::const_iterator e1 = _lmfColors.end();
257  std::list<LMFTrigType>::const_iterator e2 = _lmfTrigTypes.end();
258  std::list<LMFRunTag>::const_iterator e3 = _lmfRunTags.end();
259  std::list<LMFPrimVers>::const_iterator e4 = _lmfPrimVersions.end();
260  std::list<LMFSeqVers>::const_iterator e5 = _lmfSeqVersions.end();
261  std::list<LMFCorrVers>::const_iterator e6 = _lmfCorrVersions.end();
262  std::cout << "=== Colors" << std::endl;
263  while (i1 != e1) {
264  i1++->dump();
265  }
266  std::cout << "=== Trigger Types" << std::endl;
267  while (i2 != e2) {
268  i2++->dump();
269  }
270  std::cout << "=== Run Tags" << std::endl;
271  while (i3 != e3) {
272  i3++->dump();
273  }
274  std::cout << "=== Prim. Vers." << std::endl;
275  while (i4 != e4) {
276  i4++->dump();
277  }
278  std::cout << "=== Seq. Vers." << std::endl;
279  while (i5 != e5) {
280  i5++->dump();
281  }
282  std::cout << "=== Corr. Vers." << std::endl;
283  while (i6 != e6) {
284  i6++->dump();
285  }
286 }
LMFRunTag getRunTag(std::string tag, int version) const
virtual boost::ptr_list< LMFUnique > fetchAll() const noexcept(false)
Definition: LMFUnique.cc:64
LMFColor getColorFromID(int color_id) const
Definition: LMFDefFabric.cc:65
std::list< LMFTrigType > getTriggerTypes() const
Definition: LMFDefFabric.cc:42
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
int getID() const
Definition: LMFUnique.h:52
void initialize() noexcept(false)
void noDebug()
Definition: LMFDefFabric.cc:34
LMFColor getColor(std::string name) const
Definition: LMFDefFabric.cc:50
#define noexcept
int getColorID(std::string name) const
Definition: LMFDefFabric.cc:95
oracle::occi::Environment * getEnv() const
std::list< LMFPrimVers > _lmfPrimVersions
Definition: LMFDefFabric.h:62
oracle::occi::Connection * getConn() const
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
LMFRunTag getRunTagFromID(int runTag_id) const
std::list< LMFSeqVers > _lmfSeqVersions
Definition: LMFDefFabric.h:63
std::list< LMFCorrVers > _lmfCorrVersions
Definition: LMFDefFabric.h:64
int getRunTagID(std::string tag, int version) const
int getTrigTypeID(std::string sname) const
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
std::list< LMFRunTag > getRunTags() const
Definition: LMFDefFabric.cc:46
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
LMFTrigType getTrigType(std::string sname) const
LMFTrigType getTrigTypeFromID(int trigType_id) const
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::list< LMFColor > getColors() const
Definition: LMFDefFabric.cc:38
~LMFDefFabric() override
Definition: LMFDefFabric.cc:27