Commits

Anonymous committed 211fe5e

checked in missing GaudiExamples/src/StatusCodeSvc/*

Comments (0)

Files changed (2)

GAUDI_v20r4-branch/GaudiExamples/src/StatusCodeSvc/SCSAlg.cpp

+#include "SCSAlg.h"
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/ISvcLocator.h"
+#include "GaudiKernel/GaudiException.h"
+
+#include "GaudiKernel/AlgFactory.h"
+
+// Static Factory declaration
+
+DECLARE_ALGORITHM_FACTORY(SCSAlg);
+
+
+///////////////////////////////////////////////////////////////////////////
+
+SCSAlg::SCSAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
+  Algorithm(name, pSvcLocator)
+{
+
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+StatusCode SCSAlg::initialize() {
+
+  return StatusCode::SUCCESS;
+  
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+StatusCode SCSAlg::execute() {
+
+  MsgStream log(msgSvc(), name());
+
+
+  fncChecked();
+  fncUnchecked();
+  fncUnchecked2();
+
+  try {
+
+    fncTestThrow();
+
+  } catch ( const GaudiException& e ) {
+
+    log << MSG::INFO << "caught GaudiException " << e.message() << endreq;
+
+  }
+
+
+  return StatusCode::SUCCESS;
+
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+StatusCode SCSAlg::finalize() {
+
+  return StatusCode::SUCCESS;
+
+}
+
+void SCSAlg::fncTestThrow() {
+
+  MsgStream log(msgSvc(), name());
+
+  StatusCode sc;
+
+  sc = fncThrow();
+
+  // the following should never get called.
+  log << MSG::INFO << "This should not be seen" << endreq;
+  sc.setChecked();
+
+}
+
+StatusCode SCSAlg::fncThrow() {
+
+  //  StatusCode sc(StatusCode::SUCCESS);
+
+
+  throw GaudiException("Exception thrown by fncThrow", name(),StatusCode::SUCCESS);
+
+  return StatusCode::SUCCESS;
+
+}
+
+
+StatusCode SCSAlg::test() {
+  return StatusCode::SUCCESS;
+}
+
+void SCSAlg::fncChecked() {
+
+  test().isSuccess();
+
+
+}
+
+void SCSAlg::fncUnchecked() {
+  
+  test();
+
+}
+
+void SCSAlg::fncUnchecked2() {
+  
+  test();
+
+}

GAUDI_v20r4-branch/GaudiExamples/src/StatusCodeSvc/SCSAlg.h

+#ifndef SCS_SCSALG_H
+# define SCS_SCSALG_H
+
+//<<<<<< INCLUDES                                                       >>>>>>
+#include "GaudiKernel/Algorithm.h"
+//<<<<<< CLASS DECLARATIONS                                             >>>>>>
+/** @class ColorMgs
+ * @brief  an algorithm to test the StatusCodeSvc
+ * @author Charles Leggett
+ *$Id:  $
+ */
+
+
+
+class SCSAlg : public Algorithm {
+
+public:
+  SCSAlg (const std::string& name, ISvcLocator* pSvcLocator);
+  StatusCode initialize();
+  StatusCode execute();
+  StatusCode finalize();
+
+  StatusCode test();
+
+  void fncChecked();
+  void fncUnchecked();
+  void fncUnchecked2();
+
+  void fncTestThrow();
+  StatusCode fncThrow();
+  
+private:
+
+};
+
+#endif // SCS_SCSALG_H