CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LogicTool.h
Go to the documentation of this file.
1 #ifndef LOGICTOOL_H
2 #define LOGICTOOL_H 1
3 
4 // Include files
7 
8 #include <ostream>
9 #include <vector>
10 #include <cassert>
11 
21 template <class GenLogic>
22 class LogicTool {
23 public:
25  LogicTool() {}
26 
28 
29  std::unique_ptr<GenLogic> retrieve(const std::string& _logic_name) { return rbclogic().CreateObject(_logic_name); };
30 
31 protected:
32 private:
34 
36  GenLogic* (*createlogic)();
37  bool status(true);
38 
40  //...
41  std::string key = std::string("ChamberORLogic");
42  createlogic = (GenLogic * (*)()) & createChamberORLogic;
43  status = rbclogic.Register(key, createlogic);
44 
45  key = std::string("TestLogic");
46  createlogic = (GenLogic * (*)()) & createTestLogic;
47  status = rbclogic.Register(key, createlogic);
48 
49  key = std::string("PatternLogic");
50  createlogic = (GenLogic * (*)()) & createPatternLogic;
51  status = rbclogic.Register(key, createlogic);
52  //...
53 
54  key = std::string("TrackingAlg");
55  createlogic = (GenLogic * (*)()) & createTrackingAlg;
56  status = rbclogic.Register(key, createlogic);
57 
58  key = std::string("SectorORLogic");
59  createlogic = (GenLogic * (*)()) & createSectorORLogic;
60  status = rbclogic.Register(key, createlogic);
61 
62  key = std::string("TwoORLogic");
63  createlogic = (GenLogic * (*)()) & createTwoORLogic;
64  status = rbclogic.Register(key, createlogic);
65 
66  key = std::string("WedgeORLogic");
67  createlogic = (GenLogic * (*)()) & createWedgeORLogic;
68  status = rbclogic.Register(key, createlogic);
69 
70  key = std::string("PointingLogic");
71  createlogic = (GenLogic * (*)()) & createPointingLogic;
72  status = rbclogic.Register(key, createlogic);
73 
74  assert(status);
75  return rbclogic;
76  };
77 
78  static RBCLogicType const& rbclogic() {
79  static const RBCLogicType s_rbclogic = initialise();
80  return s_rbclogic;
81  }
82 };
83 #endif // LOGICTOOL_H
std::unique_ptr< Ilogic > CreateObject(const Identifier &id) const
Definition: LogicFactory.h:28
TTUWedgeORLogic * createWedgeORLogic()
Definition: LogicImp.cc:18
RBCChamberORLogic * createChamberORLogic()
Definition: LogicImp.cc:13
TTUSectorORLogic * createSectorORLogic()
Definition: LogicImp.cc:16
list status
Definition: mps_update.py:107
assert(be >=bs)
bool Register(const Identifier &id, LogicCreator creator)
Definition: LogicFactory.h:22
LogicTool()
Standard constructor.
Definition: LogicTool.h:25
RBCTestLogic * createTestLogic()
Definition: LogicImp.cc:12
tuple key
prepare the HTCondor submission files and eventually submit them
TTUPointingLogic * createPointingLogic()
Definition: LogicImp.cc:19
static RBCLogicType initialise()
Definition: LogicTool.h:35
TTUTwoORLogic * createTwoORLogic()
Definition: LogicImp.cc:17
static RBCLogicType const & rbclogic()
Definition: LogicTool.h:78
TTUTrackingAlg * createTrackingAlg()
Definition: LogicImp.cc:15
RBCPatternLogic * createPatternLogic()
Definition: LogicImp.cc:14
std::unique_ptr< GenLogic > retrieve(const std::string &_logic_name)
...
Definition: LogicTool.h:29