Loading...
Searching...
No Matches
eonc::Job Class Referenceabstract

Declaration of job class. More...

#include <Job.h>

Inheritance diagram for eonc::Job:

Public Member Functions

void adoptRuntime (std::unique_ptr< Runtime > rt)
 Take ownership of a Runtime previously passed as Runtime&.
 Job (std::unique_ptr< Parameters > parameters, Runtime &rt)
 Borrow: caller keeps Runtime alive (CLI stack / Python Session).
 Job (std::unique_ptr< Parameters > parameters, std::unique_ptr< Runtime > rt)
 Own a Runtime (one-shot makeJob / rvalue).
 Job (std::unique_ptr< Parameters > parameters)
 Own a default-constructed Runtime.
 Job (std::shared_ptr< Potential > potPassed, const Parameters &parameters)
virtual ~Job ()=default
virtual std::vector< std::string > run ()=0
 Virtual run; used solely for dynamic dispatch.
JobType getType ()
PotRegistry & pots () noexcept
void releasePotential ()
 Drop the Potential so on_destroyed is recorded before Runtime dies.

Protected Attributes

JobType jtype
Parameters params
std::unique_ptr< Runtime > owned_runtime_
 Non-null when this Job owns the composition root (one-shot makeJob).
Runtime * runtime_
 Always valid: either owned_runtime_.get() or a caller-owned Runtime.
std::shared_ptr< Potential > pot

Detailed Description

Declaration of job class.

Definition at line 53 of file Job.h.

Constructor & Destructor Documentation

◆ Job() [1/4]

eonc::Job::Job ( std::unique_ptr< Parameters > parameters,
Runtime & rt )
inline

Borrow: caller keeps Runtime alive (CLI stack / Python Session).

Definition at line 76 of file Job.h.

77 : jtype{parameters->main_options().job},
78 params{*std::move(parameters)},
80 runtime_{&rt},
81 pot{helpers::makePotential(params.potential_options().potential, params,
82 rt)} {}
std::unique_ptr< Runtime > owned_runtime_
Non-null when this Job owns the composition root (one-shot makeJob).
Definition Job.h:60
JobType jtype
Definition Job.h:57
std::shared_ptr< Potential > pot
Definition Job.h:63
Parameters params
Definition Job.h:58
Runtime * runtime_
Always valid: either owned_runtime_.get() or a caller-owned Runtime.
Definition Job.h:62
std::shared_ptr< Potential > makePotential(const Parameters &params)

◆ Job() [2/4]

eonc::Job::Job ( std::unique_ptr< Parameters > parameters,
std::unique_ptr< Runtime > rt )
inline

Own a Runtime (one-shot makeJob / rvalue).

Definition at line 84 of file Job.h.

85 : Job(std::move(parameters), *rt) {
86 adoptRuntime(std::move(rt));
87 }
Job(std::unique_ptr< Parameters > parameters, Runtime &rt)
Borrow: caller keeps Runtime alive (CLI stack / Python Session).
Definition Job.h:76
void adoptRuntime(std::unique_ptr< Runtime > rt)
Take ownership of a Runtime previously passed as Runtime&.
Definition Job.h:67

◆ Job() [3/4]

eonc::Job::Job ( std::unique_ptr< Parameters > parameters)
inlineexplicit

Own a default-constructed Runtime.

Definition at line 89 of file Job.h.

90 : Job(std::move(parameters), std::make_unique<Runtime>()) {}

◆ Job() [4/4]

eonc::Job::Job ( std::shared_ptr< Potential > potPassed,
const Parameters & parameters )
inline

Definition at line 91 of file Job.h.

92 : jtype{parameters.main_options().job},
93 params{parameters},
94 owned_runtime_{std::make_unique<Runtime>()},
96 pot{potPassed} {}

◆ ~Job()

virtual eonc::Job::~Job ( )
virtualdefault

Member Function Documentation

◆ adoptRuntime()

void eonc::Job::adoptRuntime ( std::unique_ptr< Runtime > rt)
inline

Take ownership of a Runtime previously passed as Runtime&.

Definition at line 67 of file Job.h.

67 {
68 if (!rt || runtime_ != rt.get()) {
69 throw std::logic_error(
70 "Job::adoptRuntime: Runtime is not the borrowed instance");
71 }
72 owned_runtime_ = std::move(rt);
73 }

◆ getType()

JobType eonc::Job::getType ( )
inlinenodiscard

Definition at line 100 of file Job.h.

100{ return this->jtype; };

◆ pots()

PotRegistry & eonc::Job::pots ( )
inlinenodiscardnoexcept

Definition at line 101 of file Job.h.

101{ return runtime_->pots(); }

◆ releasePotential()

void eonc::Job::releasePotential ( )
inline

Drop the Potential so on_destroyed is recorded before Runtime dies.

Definition at line 103 of file Job.h.

103{ pot.reset(); }

◆ run()

Member Data Documentation

◆ jtype

JobType eonc::Job::jtype
protected

Definition at line 57 of file Job.h.

◆ owned_runtime_

std::unique_ptr<Runtime> eonc::Job::owned_runtime_
protected

Non-null when this Job owns the composition root (one-shot makeJob).

Definition at line 60 of file Job.h.

◆ params

Parameters eonc::Job::params
protected

Definition at line 58 of file Job.h.

◆ pot

std::shared_ptr<Potential> eonc::Job::pot
protected

Definition at line 63 of file Job.h.

◆ runtime_

Runtime* eonc::Job::runtime_
protected

Always valid: either owned_runtime_.get() or a caller-owned Runtime.

Definition at line 62 of file Job.h.


The documentation for this class was generated from the following file:
  • /home/runner/work/eOn/eOn/include/eon/Job.h