NCBI C++ ToolKit
table_data_suc_job.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: table_data_suc_job.cpp 32231 2015-01-22 15:57:41Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 
39 
41  : m_InputObjects(objects)
42 {
43 }
44 
46 {
48 }
49 
51 {
52  return m_Result;
53 }
54 
55 
57 {
59 }
60 
61 
63 {
64  return "SUC job";
65 }
66 
67 
69 {
70  string err_msg, logMsg = GetDescr() + " - exception in Run() ";
71 
72  try {
73  CLockerGuard guard = x_GetGuard();
74  if (IsCanceled()) return eCanceled;
76  m_Result.Reset(results.GetPointerOrNull());
77 
78  }
79  catch (CException& e) {
80  err_msg = e.GetMsg();
81  LOG_POST(Error << logMsg << GetDescr() << ". " << err_msg);
82  //e.ReportAll();
83  } catch (std::exception& e) {
84  err_msg = GetDescr() + ". " + e.what();
85  LOG_POST(Error << logMsg << GetDescr() << ". " << err_msg);
86  }
87 
88  if (IsCanceled())
89  return eCanceled;
90 
91  if (!err_msg.empty()) {
92  string s = err_msg;
93  m_Error.Reset(new CAppJobError(s));
94  return eFailed;
95  }
96 
97  return eCompleted;
98 }
99 
101 
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
static CRef< CSUCResults > GetSUCResults(TConstScopedObjects &objects)
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
CTableDataSUCJob(const TConstScopedObjects &objects)
TConstScopedObjects m_InputObjects
CRef< CAppJobError > m_Error
CRef< CObject > m_Result
virtual CRef< CObject > GetResult()
Returns the Job Result.
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
CLockerGuard x_GetGuard()
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
@ eCanceled
Definition: app_job.hpp:91
@ eCompleted
Definition: app_job.hpp:89
@ eFailed
Definition: app_job.hpp:90
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:986
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
USING_SCOPE(objects)
Modified on Wed Dec 06 07:12:51 2023 by modify_doxy.py rev. 669887