CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
20 template <class GenLogic>
21 class LogicTool {
22 public:
24  LogicTool( ) { };
25 
26  virtual ~LogicTool( ) {
27  m_logkeys.clear();
28  };
29 
31 
33 
34  GenLogic * (*createlogic) ();
35 
37 
38  bool initialise()
39  {
40  bool status(true);
41 
42  //...
43  std::string key = std::string("ChamberORLogic");
44  createlogic = (GenLogic * (*)()) &createChamberORLogic;
45  status = m_rbclogic.Register( key , createlogic );
46 
47  m_logkeys.push_back( key );
48 
49  key = std::string("TestLogic");
50  createlogic = (GenLogic * (*)()) &createTestLogic;
51  status = m_rbclogic.Register( key , createlogic );
52 
53  m_logkeys.push_back( key );
54 
55  key = std::string("PatternLogic");
56  createlogic = (GenLogic * (*)()) &createPatternLogic;
57  status = m_rbclogic.Register( key , createlogic );
58  //...
59 
60  m_logkeys.push_back( key );
61 
62  key = std::string("TrackingAlg");
63  createlogic = (GenLogic * (*)()) &createTrackingAlg;
64  status = m_rbclogic.Register( key , createlogic );
65 
66  m_logkeys.push_back( key );
67 
68  key = std::string("SectorORLogic");
69  createlogic = (GenLogic * (*)()) &createSectorORLogic;
70  status = m_rbclogic.Register( key , createlogic );
71 
72  m_logkeys.push_back( key );
73 
74  key = std::string("TwoORLogic");
75  createlogic = (GenLogic * (*)()) &createTwoORLogic;
76  status = m_rbclogic.Register( key , createlogic );
77 
78  m_logkeys.push_back( key );
79 
80  key = std::string("WedgeORLogic");
81  createlogic = (GenLogic * (*)()) &createWedgeORLogic;
82  status = m_rbclogic.Register( key , createlogic );
83 
84  m_logkeys.push_back( key );
85 
86  key = std::string("PointingLogic");
87  createlogic = (GenLogic * (*)()) &createPointingLogic;
88  status = m_rbclogic.Register( key , createlogic );
89 
90  m_logkeys.push_back( key );
91 
92  return status;
93 
94  };
95 
96 
97  GenLogic * retrieve( const std::string & _logic_name )
98  {
99  GenLogic * _obj;
100  _obj = m_rbclogic.CreateObject( _logic_name );
101  return _obj;
102  };
103 
104  bool endjob()
105  {
106  bool status(true);
107  typename std::vector<std::string>::iterator itr = m_logkeys.begin();
108  while ( itr != m_logkeys.end() )
109  {
110  status = status && ( m_rbclogic.Unregister( (*itr) ) );
111  ++itr;
112  }
113  return status;
114 
115  };
116 
117 
118 protected:
119 
120 private:
121 
122  typename std::vector<std::string> m_logkeys;
123 
124 };
125 #endif // LOGICTOOL_H
Ilogic * CreateObject(const Identifier &id)
Definition: LogicFactory.h:38
TTUWedgeORLogic * createWedgeORLogic()
Definition: LogicImp.cc:18
RBCChamberORLogic * createChamberORLogic()
Definition: LogicImp.cc:13
TTUSectorORLogic * createSectorORLogic()
Definition: LogicImp.cc:16
GenLogic * retrieve(const std::string &_logic_name)
Definition: LogicTool.h:97
LogicFactory< GenLogic, std::string > RBCLogicType
Destructor.
Definition: LogicTool.h:28
bool Register(const Identifier &id, LogicCreator creator)
Definition: LogicFactory.h:23
LogicTool()
Standard constructor.
Definition: LogicTool.h:24
GenLogic *(* createlogic)()
Definition: LogicTool.h:34
RBCTestLogic * createTestLogic()
Definition: LogicImp.cc:12
bool Unregister(const Identifier &id)
Definition: LogicFactory.h:28
TTUPointingLogic * createPointingLogic()
Definition: LogicImp.cc:19
bool initialise()
Definition: LogicTool.h:38
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
TTUTwoORLogic * createTwoORLogic()
Definition: LogicImp.cc:17
std::vector< std::string > m_logkeys
Definition: LogicTool.h:115
bool endjob()
Definition: LogicTool.h:104
virtual ~LogicTool()
Definition: LogicTool.h:26
TTUTrackingAlg * createTrackingAlg()
Definition: LogicImp.cc:15
RBCPatternLogic * createPatternLogic()
Definition: LogicImp.cc:14
RBCLogicType m_rbclogic
Definition: LogicTool.h:36
tuple status
Definition: mps_update.py:57