Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PartitionSwitchTool.cpp
Go to the documentation of this file.
1 // $Id: PartitionSwitchTool.cpp,v 1.2 2006/01/10 20:09:25 hmd Exp $
2 
3 // Framework include files
4 #include "GaudiKernel/AlgTool.h"
5 #include "GaudiKernel/SmartIF.h"
10 
16 class PartitionSwitchTool: public extends1<AlgTool, IPartitionControl> {
17 
18  typedef const std::string& CSTR;
19  typedef StatusCode STATUS;
20 
21 private:
22 
24  std::string m_actorName;
27 
28 public:
29 
32  : base_class(typ, nam , parent)
33  {
34  declareProperty("Actor", m_actorName = "EventDataService");
35  }
38  m_actor = 0;
39  }
40 
42  virtual STATUS initialize() {
45  MsgStream log(msgSvc(), name());
46  if ( !sc.isSuccess() ) {
47  log << MSG::ERROR << "Cannot initialize base class!" << endmsg;
48  return sc;
49  }
50  m_actor = 0;
51  IPartitionControl* tmpPtr = 0;
52  sc = service(m_actorName, tmpPtr);
53  m_actor = tmpPtr;
54  if ( !sc.isSuccess() ) {
55  log << MSG::ERROR << "Cannot retrieve partition controller \""
56  << m_actorName << "\"!" << endmsg;
57  return sc;
58  }
59  return sc;
60  }
62  virtual STATUS finalize() {
63  m_actor = 0;
64  return AlgTool::finalize();
65  }
66 
67  void _check(STATUS sc, CSTR msg) const {
68  MsgStream log(msgSvc(), name());
69  log << MSG::ERROR << msg << " Status=" << sc.getCode() << endmsg;
70  }
71 #define CHECK(x,y) if ( !x.isSuccess() ) _check(x, y); return x;
72 
74  virtual STATUS create(CSTR nam, CSTR typ) {
75  STATUS sc = m_actor ? m_actor->create(nam,typ) : NO_INTERFACE;
76  CHECK(sc, "Cannot create partition: "+nam+" of type "+typ);
77  }
79  virtual STATUS create(CSTR nam, CSTR typ, IInterface*& pPartition) {
80  STATUS sc = m_actor ? m_actor->create(nam,typ,pPartition) : NO_INTERFACE;
81  CHECK(sc, "Cannot create partition: "+nam+" of type "+typ);
82  }
84  virtual STATUS drop(CSTR nam) {
85  STATUS sc = m_actor ? m_actor->drop(nam) : NO_INTERFACE;
86  CHECK(sc, "Cannot drop partition: "+nam);
87  }
89  virtual STATUS drop(IInterface* pPartition) {
90  STATUS sc = m_actor ? m_actor->drop(pPartition) : NO_INTERFACE;
91  CHECK(sc, "Cannot drop partition by Interface.");
92  }
94  virtual STATUS activate(CSTR nam) {
95  STATUS sc = m_actor ? m_actor->activate(nam) : NO_INTERFACE;
96  CHECK(sc, "Cannot activate partition: "+nam);
97  }
99  virtual STATUS activate(IInterface* pPartition) {
100  STATUS sc = m_actor ? m_actor->activate(pPartition) : NO_INTERFACE;
101  CHECK(sc, "Cannot activate partition by Interface.");
102  }
104  virtual STATUS get(CSTR nam, IInterface*& pPartition) const {
105  STATUS sc = m_actor ? m_actor->get(nam, pPartition) : NO_INTERFACE;
106  CHECK(sc, "Cannot get partition "+nam);
107  }
109  virtual STATUS activePartition(std::string& nam, IInterface*& pPartition) const {
110  STATUS sc = m_actor ? m_actor->activePartition(nam, pPartition) : NO_INTERFACE;
111  CHECK(sc, "Cannot determine active partition.");
112  }
113 };
114 
115 // Declaration of the Tool Factory

Generated at Wed Jun 4 2014 14:48:56 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004