NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Job.h
Go to the documentation of this file.
1//***************************************************************************************
4//***************************************************************************************
5
6#pragma once
7
8#include "NAGASH/Global.h"
9#include "NAGASH/ConfigTool.h"
10#include "NAGASH/MSGTool.h"
11#include "NAGASH/Toolkit.h"
12#include "NAGASH/Timer.h"
13#include "NAGASH/ResultGroup.h"
14
15namespace NAGASH
16{
40 class Job
41 {
42 public:
43 Job(const ConfigTool &c);
44 Job() = delete;
45 Job(const Job &) = delete;
46 Job &operator=(const Job &) = delete;
47 Job &operator=(Job &&) = delete;
48 Job(Job &&) = delete;
49 virtual ~Job() = default;
50 std::shared_ptr<ResultGroup> ResultGroupUser();
51 friend class Analysis;
52
53 protected:
54 std::shared_ptr<ConfigTool> ConfigUser();
55 std::shared_ptr<Toolkit> ToolkitUser();
56 std::shared_ptr<Timer> TimerUser();
57 std::shared_ptr<MSGTool> MSGUser();
58 int JobNumber();
59 inline static std::recursive_mutex DefaultMutex = std::recursive_mutex();
60
61 private:
62 std::shared_ptr<ConfigTool> config;
63 std::shared_ptr<MSGTool> msg;
64 std::shared_ptr<Toolkit> toolkit;
65 std::shared_ptr<Timer> timer;
66 std::shared_ptr<ResultGroup> result;
68 };
69
72 inline Job::Job(const ConfigTool &c)
73 {
74 config = std::make_shared<ConfigTool>(c);
75 msg = ConfigUser()->MSGUser();
76 jobnumber = ConfigUser()->GetPar<int>("JobNumber");
77 if (jobnumber >= 0)
78 {
79 msg = std::make_shared<MSGTool>(*(ConfigUser()->MSGUser().get()), jobnumber);
80 }
81 ConfigUser()->SetMSG(MSGUser());
82 result = std::make_shared<ResultGroup>(msg, config);
83 toolkit = std::make_shared<Toolkit>(msg);
84 timer = toolkit->GetTool<Timer>();
85 }
86
87 inline std::shared_ptr<ConfigTool> Job::ConfigUser() { return config; }
88 inline std::shared_ptr<Toolkit> Job::ToolkitUser() { return toolkit; }
89 inline std::shared_ptr<MSGTool> Job::MSGUser() { return msg; }
90 inline std::shared_ptr<Timer> Job::TimerUser() { return timer; }
91 inline std::shared_ptr<ResultGroup> Job::ResultGroupUser() { return result; }
92 inline int Job::JobNumber() { return jobnumber; }
93} // namespace NAGASH
Some global definitions.
Provide multi-thread interface to manipulate with Job.
Definition Analysis.h:235
provide interface to config objects in NAGASH.
Definition ConfigTool.h:14
Virtual base class for all kinds of jobs inside NAGASH, handled by Analysis.
Definition Job.h:41
std::shared_ptr< ResultGroup > ResultGroupUser()
get the ResultGroup.
Definition Job.h:91
Job & operator=(Job &&)=delete
std::shared_ptr< Toolkit > toolkit
Definition Job.h:64
std::shared_ptr< ResultGroup > result
Definition Job.h:66
virtual ~Job()=default
std::shared_ptr< MSGTool > msg
Definition Job.h:63
Job(const Job &)=delete
int jobnumber
Definition Job.h:67
std::shared_ptr< ConfigTool > config
Definition Job.h:62
Job()=delete
Job & operator=(const Job &)=delete
std::shared_ptr< ConfigTool > ConfigUser()
get the ConfigTool.
Definition Job.h:87
std::shared_ptr< Timer > timer
Definition Job.h:65
std::shared_ptr< MSGTool > MSGUser()
get the MSGTool.
Definition Job.h:89
static std::recursive_mutex DefaultMutex
Default mutex, for multi-thread usage.
Definition Job.h:59
std::shared_ptr< Timer > TimerUser()
get the Timer.
Definition Job.h:90
std::shared_ptr< Toolkit > ToolkitUser()
get the Toolkit.
Definition Job.h:88
int JobNumber()
get the number of job inside Analysis.
Definition Job.h:92
Job(Job &&)=delete
calculate the time interval between two time stamps.
Definition Timer.h:14