CMS 3D CMS Logo

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 
20 template <class GenLogic>
21 class LogicTool {
22 public:
24  LogicTool( ) {
25  }
26 
28 
29  std::unique_ptr<GenLogic> retrieve( const std::string & _logic_name )
30  {
31  return rbclogic().CreateObject( _logic_name );
32  };
33 
34 protected:
35 
36 private:
38 
40  {
41  GenLogic * (*createlogic) ();
42  bool status(true);
43 
45  //...
46  std::string key = std::string("ChamberORLogic");
47  createlogic = (GenLogic * (*)()) &createChamberORLogic;
48  status = rbclogic.Register( key , createlogic );
49 
50  key = std::string("TestLogic");
51  createlogic = (GenLogic * (*)()) &createTestLogic;
52  status = rbclogic.Register( key , createlogic );
53 
54  key = std::string("PatternLogic");
55  createlogic = (GenLogic * (*)()) &createPatternLogic;
56  status = rbclogic.Register( key , createlogic );
57  //...
58 
59  key = std::string("TrackingAlg");
60  createlogic = (GenLogic * (*)()) &createTrackingAlg;
61  status = rbclogic.Register( key , createlogic );
62 
63  key = std::string("SectorORLogic");
64  createlogic = (GenLogic * (*)()) &createSectorORLogic;
65  status = rbclogic.Register( key , createlogic );
66 
67  key = std::string("TwoORLogic");
68  createlogic = (GenLogic * (*)()) &createTwoORLogic;
69  status = rbclogic.Register( key , createlogic );
70 
71  key = std::string("WedgeORLogic");
72  createlogic = (GenLogic * (*)()) &createWedgeORLogic;
73  status = rbclogic.Register( key , createlogic );
74 
75  key = std::string("PointingLogic");
76  createlogic = (GenLogic * (*)()) &createPointingLogic;
77  status = rbclogic.Register( key , createlogic );
78 
79  assert(status);
80  return rbclogic;
81 
82  };
83 
84  static RBCLogicType const& rbclogic() {
85  static const RBCLogicType s_rbclogic = initialise();
86  return s_rbclogic;
87  }
88 
89 };
90 #endif // LOGICTOOL_H
std::unique_ptr< Ilogic > CreateObject(const Identifier &id) const
Definition: LogicFactory.h:33
TTUWedgeORLogic * createWedgeORLogic()
Definition: LogicImp.cc:18
RBCChamberORLogic * createChamberORLogic()
Definition: LogicImp.cc:13
TTUSectorORLogic * createSectorORLogic()
Definition: LogicImp.cc:16
bool Register(const Identifier &id, LogicCreator creator)
Definition: LogicFactory.h:23
LogicTool()
Standard constructor.
Definition: LogicTool.h:24
RBCTestLogic * createTestLogic()
Definition: LogicImp.cc:12
TTUPointingLogic * createPointingLogic()
Definition: LogicImp.cc:19
static RBCLogicType initialise()
Definition: LogicTool.h:39
TTUTwoORLogic * createTwoORLogic()
Definition: LogicImp.cc:17
static RBCLogicType const & rbclogic()
Definition: LogicTool.h:84
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